APCu:无法在无效迭代器上调用key()问题求助
ILIAS 5.4在DDEV Docker环境中APCUIterator报错求助
我在DDEV(Docker)开发环境中维护旧版本的ILIAS 5.4(一款PHP开发的学习管理系统LMS),运行环境如下:
- GNU/Linux Debian 10 Buster
- PHP 7.3
- MariaDB 10.3
目前遇到APCUIterator相关错误:在调用迭代器key()方法的while循环中,报错「Cannot call key() on invalid iterator」。相关代码片段如下:
/** * @param bool $complete * * @return bool */ public function flush($complete = false) { if ($complete) { return apcu_clear_cache(); } $key_prefix = $this->returnKey(''); $apcu_iterator = new APCUIterator(); $apcu_iterator->rewind(); while ($current_key = $apcu_iterator->key()) { // "begins with" if (substr($current_key, 0, strlen($key_prefix)) === $key_prefix) { $this->delete($current_key); } $apcu_iterator->next(); } return true; }
在容器中用以下极简代码可复现错误:
<?php $iterator = new APCUIterator(); $iterator->key(); # Nothing else matters
我猜测容器中缺少依赖或配置存在问题,恳请提供排查建议。
容器内APC配置信息(执行ddev php -i | grep -i apc输出):
/etc/php/7.3/cli/conf.d/20-apcu.ini, /etc/php/7.3/cli/conf.d/25-apcu_bc.ini, /etc/php/7.3/cli/conf.d/enableapcu.ini, apc APC Compatibility => 1.0.5 apcu APCu Support => Enabled APCu Debugging => Disabled apc.coredump_unmap => Off => Off apc.enable_cli => On => On apc.enabled => On => On apc.entries_hint => 4096 => 4096 apc.gc_ttl => 3600 => 3600 apc.mmap_file_mask => no value => no value apc.preload_path => no value => no value apc.serializer => php => php apc.shm_segments => 1 => 1 apc.shm_size => 32M => 32M apc.slam_defense => Off => Off apc.smart => 0 => 0 apc.ttl => 0 => 0 apc.use_request_time => Off => Off igbinary APCu serializer ABI => 0
原生staging系统(非Docker,Debian+Apache)的APC配置信息:
/etc/php/7.3/cli/conf.d/20-apcu.ini, apcu APCu Support => Disabled APCu Debugging => Disabled apc.coredump_unmap => Off => Off apc.enable_cli => Off => Off apc.enabled => On => On apc.entries_hint => 4096 => 4096 apc.gc_ttl => 3600 => 3600 apc.mmap_file_mask => no value => no value apc.preload_path => no value => no value apc.serializer => php => php apc.shm_segments => 1 => 1 apc.shm_size => 32M => 32M apc.slam_defense => Off => Off apc.smart => 0 => 0 apc.ttl => 0 => 0 apc.use_request_time => On => On
内容的提问来源于stack exchange,提问作者mrkskwsnck
相关产品推荐
相关产品推荐

