Page MenuHomePhabricator

APCu support
Closed, ResolvedPublic


PHP 5.5 has apc_ and apcu_. PHP 7 only has apcu_ (without installing apc-bc in pecl. Ugh). HHVM only has apc_

For HHVM supporting apcu_ see

For T140587 and I originally just replaced apc_ with apcu_, but for HHVM support, this isn't gonna work.

So, do we create an APCuBagOStuff, and add some if/elseif function_exists in MemoizedCallable as appropriate?

Or, do we "move" everything over to apcu_ calls, and add in GlobalFunctions some wrappers around apc_ per the Compatibility functions?

 * Compatibility functions
 * We support PHP 5.5.9 and up.
 * Re-implementations of newer functions or functions in non-standard
 * PHP extensions may be included here.

As is, upgrading to PHP 7 can break login and other stuff if you're trying to use APC, as @Krenair found out... So, it could be suggested our PHP 7 support in REL1_27 is buggy at least

Event Timeline

Reedy created this task.Jul 20 2016, 11:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 20 2016, 11:14 PM
Reedy added a comment.EditedJul 20 2016, 11:16 PM

From @PleaseStand on gerrit:

In APCu 5.1.0 and newer, there is a behavior change between apc_inc (as provided by older versions of APCu, as well as apcu-bc 1.0.2 and newer) and apcu_inc: a value is now initialized to zero with no TTL (prior to performing the operation) if it does not already exist.
The doc comment for RedisBagOStuff::incr() states:

  • Non-atomic implementation of incr(). *
  • Probably all callers actually want incr() to atomically initialise
  • values to zero if they don't exist, as provided by the Redis INCR
  • command. But we are constrained by the memcached-like interface to
  • return null in that case. Once the key exists, further increments are
  • atomic.

Actually, at least one caller, incrWithInit(), assumes that incr() will fail if the key does not exist (and expects false in that case, not null), in order to set the specified initial value and/or TTL.

WIP P3530 for APCuBagOStuff

P3531 for the basic back compat wrappers for globalfunctions

inc and dec MAY need some work to match the apcu spec...

Danny_B moved this task from Unsorted to PHP 7 on the [DO NOT USE] NewPHP board.Jul 21 2016, 3:24 PM
Reedy added a comment.Oct 2 2016, 1:32 PM

T140587 is now fixed in master, just waiting on backport to REL1_27... Then both of these bugs can be closed in one go

Change 313756 had a related patch set uploaded (by Reedy):
Detect/use APCu properly

@Reedy by broken php7 in your description is that fixed in the above patches?

Change 313756 merged by jenkins-bot:
Detect/use APCu properly

Reedy closed this task as Resolved.Oct 4 2016, 11:28 PM
Reedy claimed this task.