Skip to content

chore(PLATFORM-11898): bump apcu - #2

Merged
peterdevpl merged 102 commits into
apcu_soft_expiredfrom
PLATFORM-11898-apcu
Aug 27, 2026
Merged

chore(PLATFORM-11898): bump apcu#2
peterdevpl merged 102 commits into
apcu_soft_expiredfrom
PLATFORM-11898-apcu

Conversation

@albertsko

Copy link
Copy Markdown

PLATFORM-11898

Changes

  • Merged upstream v5.1.28 into the fork, to pick up PHP 8.4 compatibility and the 5.1.24–5.1.28 performance work (defragmentation, faster allocation, lower lock contention).
  • Kept the fork's only behavior delta in apc_cache.c, so the global apc.ttl still soft-expires entries that carry a per-entry TTL.
  • Renamed the fork's apc_026.phpt to apc_soft_expired.phpt, because upstream added a different apc_026.phpt in 5.1.28.
  • Replaced the unconditional skips in apc_019.phpt and apc_020.phpt with assertions of the fork's expiry behavior, so the policy is covered rather than ignored.

nikic and others added 30 commits October 16, 2023 21:26
Now that setup-php-sdk has been moved to the php org and is
maintained again.
PHP 8.4 changed the PHP_ZTS constant to bool:
https://www.github.com/php/php-src/pull/13079

As a result, the tests that fail with ZTS would no longer be skipped.
This replaces the "hacky" Makefile variable usage in config.m4 with a
regular shell variable.

Issue initially noted at php/php-src#15642
- Instead of AC_ARG_ENABLE the PHP_ARG_ENABLE works in similar manner
  and outputs the 2nd argument as the check message. Result variable is
  the same (PHP_APCU_RWLOCKS). By default the option is enabled like
  before. The 4th argument sets whether the option is enabled, the 5th
  argument indicates that this is not direct extension related
  configuration option (build system internal handling stuff).
- AC_CACHE_CHECK check refactored: Entire check moved inside the main
  "extension-enabled" if block, AS_VAR_IF used, redundant double
  Autoconf quotes reduced.
- AC_MSG_FAILURE works the same as AC_MSG_ERROR except that it also
  outputs the "See config.log for details" message at the end in case of
  failure, directing the user where to check for possible failure
  reason.
The HAVE_SEMUN usage was removed via
fcf43c9 and the check is redundant at
this point.
- This uses the PHP_ARG_ENABLE instead of core AC_ARG_ENABLE to have
  check message automatically output and result variable
  PHP_APCU_SPINLOCKS set.
- AS_VAR_IF used
- AC_DEFINE arguments quoted and some simplistic help message text
  added.
- ZTS
- PHP_WIN32
- HAVE_SIGACTION

are either undefined or defined to 1. This fixes possible -Wundef
(Windows C4668 warning code) warnings if such compiler configuration is
set.
- AC_ARG_ENABLE replaced with PHP_ARG_ENABLE
- checks sorted
- AS_VAR_IF macros used
- For checking the Valgrind header, the AC_CHECK_HEADERS is used which
  defines the HAVE_VALGRIND_MEMCHECK_H preprocessor macro by default
- The APC_MMAP preprocessor macro is either undefined or defined to 1
  so the `#if` checks are also replaced with `#ifdef` to not cause
  possible -Wundef warnings emitted if such compiler configuration is
  set
This appends the -lrt only as needed to the LIBS (if apcu is built as
static) or to the APCU_SHARED_LIBADD variable (when APCu is built as
shared). Modern *nix systems have shared memory operations located in
default libraries and explicit linking with -lrt is redundant.
nikic and others added 26 commits July 28, 2025 20:49
Since PHP 8.5, a missing trait is no longer a fatal error. Therefore,
we must use a different fatal error.
Under high load, multiple parallel insert operations could trigger
multiple default expunge operations at the same time. To prevent this,
pending default expunge operations are now aborted if another default
expunge operation has run in the meantime.
This fixes a race condition that can occur when a newly allocated entry
is moved by defragmentation before it is inserted into the hash table.
The comments for a legacy code folding mechanism and other useless
comments have been removed. In addition, several other comments
have been improved.
In apc_cache_store(), the ref_count was decremented even when the entry
needed to be deleted. This allowed the entry to be moved by
defragmentation (by another process) before deletion. As a result, the
pointer no longer pointed to the desired entry during deletion, causing
segmentation faults.
The "report_memleaks" ini directive is deprecated in PHP 8.5 and has
therefore been removed from the tests.
The fprev field now stores the used memory size for allocated blocks.
This is used during defragmentation to shrink blocks if more memory
has been allocated than necessary.
The test has been removed because it serves no purpose anymore, as the
opcode caching functionality was removed from the project long ago.
Furthermore, the magic method __sleep() is deprecated in PHP 8.5,
causing this test to fail the CI pipeline starting with PHP 8.5.
These files are no longer used by any test and have therefore been
deleted.
The function sma_allocate() now inserts the unused part of a split block
at the beginning of the free list, instead of reinserting it at the
position of the original block. This prevents large blocks from falling
behind in the list when many small blocks are inserted at the beginning
of the list by sma_deallocate(). Benchmarks show that this improves
allocation performance and reduces the time the SMA lock must be held.
The new functions link_free_block() and unlink_free_block_at_start()
are used to insert or remove blocks from the free list. This improves
readability and removes duplicate code. Also, some code comments have
been refined.
This should never happen, but it should still be handled properly to
avoid worse.
Since the array keys "cleanups" and "defragmentations" only exist since
APCu 5.1.25, PHP warnings could occur if you are using a current version
of apc.php with APCu versions <= 5.1.24.
Call zval_ptr_dtor_nogc() directly instead
Trying to insert entries larger than the shared memory no longer results
in the whole cache being discarded.
@albertsko

Copy link
Copy Markdown
Author

The PR fails are for the windows env. All ubuntu checks are green :)

@albertsko

albertsko commented Aug 26, 2026

Copy link
Copy Markdown
Author

Important → Create a merge commit.

Do NOT squash PR because of ref provided in the https://github.com/Wikia/platform-container-images/pull/303/changes.

@peterdevpl
peterdevpl merged commit cdd4db7 into apcu_soft_expired Aug 27, 2026
33 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.