php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64034 weird error "could not implement interface It..." when extending ArrayIterator
Submitted: 2013-01-21 09:37 UTC Modified: 2016-08-31 20:47 UTC
From: georg at georgbuske dot de Assigned: cmb (profile)
Status: Wont fix Package: APC (PECL)
PHP Version: 5.4.11 OS: Ubuntu 12.10, Redhat 5.7, Centos
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: georg at georgbuske dot de
New email:
PHP Version: OS:

 

 [2013-01-21 09:37 UTC] georg at georgbuske dot de
Description:
------------
(note the problem is that it looks like that when using php 5.4 the remi repository of Redhat automatically installs apc version 3.1.14, a yum downgrade to 3.1.13 fixes the problem)

Error message from: Zend/zend_compile.c:3351

as there is no segfault I didn't get a backtrace with GDB (even when php5.4.11 is compiled with debug headers, enable apc debug makes things worst)

It happens in version php-pecl-apc 3.1.14 (not in 3.1.13), I suspect the changes in apc_compile.c are responsible for the failure (but couldn't figure it out in a short time, so I place just the bug report :-| )

Error when calling the class in an php-fpm environment:
E_CORE_ERROR Class ClassName could not implement interface Iterator

Error when running php - script (extracted code from phpt script) in CLI env (the phpt test itself passes because it generates the correct output): see 
--- Actual Result ---



Test script:
---------------
--TEST--
APC: can use ArrayIterator
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php

class foo extends ArrayIterator { }
$foo = new foo;
var_dump($foo);

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(foo)#%d (1) {
  ["storage":"ArrayIterator":private]=>
  array(0) {
  }
}
===DONE===


Expected result:
----------------
object(foo)#1 (1) {
  ["storage":"ArrayIterator":private]=>
  array(0) {
  }
}

Actual result:
--------------
object(foo)#1 (1) {
  ["storage":"ArrayIterator":private]=>
  array(0) {
  }
}
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(450) :  Freeing 0x7FD27B84F1A8 (256 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
Zend/zend_language_scanner.l(1898) :  Freeing 0x7FD27B853B48 (4 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_compile.c(4816) :  Freeing 0x7FD27B854250 (568 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_compile.c(3373) :  Freeing 0x7FD27B854588 (48 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(292) :  Freeing 0x7FD27B854610 (64 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
/home/gbuske/Downloads/php-5.4.11/Zend/zend_alloc.c(2529) : Actual location (location was relayed)
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(324) :  Freeing 0x7FD27B8546A8 (72 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
Last leak repeated 25 times
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_compile.c(2867) :  Freeing 0x7FD27B854920 (240 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(236) : Actual location (location was relayed)
[Mon Jan 21 07:27:21 2013]  Script:  '/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php'
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(893) :  Freeing 0x7FD27B854B08 (240 bytes), script=/home/gbuske/Downloads/APC-3.1.14/tests/bug_CompileIterator.php
/home/gbuske/Downloads/php-5.4.11/Zend/zend_hash.c(339) : Actual location (location was relayed)
Last leak repeated 22 times
=== Total 55 memory leaks detected ===

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-21 09:58 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2013-01-21 09:58 UTC] laruence@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

could you please try with the latest svn snapshot?  seems I can not reproduce this 
with it.
 [2013-01-21 10:17 UTC] laruence@php.net
... not the php snapshot, should be http://svn.php.net/viewvc/pecl/apc/trunk/
 [2013-01-21 14:40 UTC] georg at georgbuske dot de
The error is more weired than expected when I tried to extract the concrete Error
E_CORE_ERROR Class ClassName could not implement interface Iterator I got the following observations:
 - a Zend_Server_Json - Webservice calls the complained class
 - the webservice is called from a frontend php application (the service is the backend php application)
 - when trying to call the webservice from the command line it works without problems, when creating a simple php script and call via browser (in the same fpm / nginx instance as the frontend application) it works also
 - when calling then the service through the frontend application it works
 - restarting php-fpm and calling the action of the frontend application after restart just as the normal workflow it fails with this error

the memory leaks during the test I got also with the current trunk version (but the test itself still succeeds, which means the error which happen in the backend service after connecting with frontend application it fails with E_CORE_ERROR Class ClassName could)... 

I wasn't able yet to get it extracted without populating a lot of internal source code but the it happens with php5.4.10, php5.4.11 on centos 5.8, redhat 5.7 after upgrade from php 5.4.8 (which upgrades the apc version as well, a downgrade to apc 3.1.13 - as said - fixed this) and my current testing machine where i compiled everything on ubuntu 12.10. I try to get better reproducable results...
 [2013-01-21 14:40 UTC] georg at georgbuske dot de
-Status: Feedback +Status: Open
 [2013-01-21 15:51 UTC] rasmus@php.net
I wasn't able to reproduce this either. But, as Lauruence said, could you try it 
with APC trunk from svn? It is easy to do:

svn co http://svn.php.net/repository/pecl/apc/trunk apc
cd apc
phpize
./configure --enable-apc-pthreadrwlocks
make
make install
 [2013-01-22 02:18 UTC] georg at georgbuske dot de
(sry for delayed feedback)
yep, thx I tested again with trunk version but this time with --enable-apc-pthreadrwlocks but again the same behaviour - and again the same; only in this special constellation - also I ran following tests:
frontend application with a php-fpm socket pointing to 5.11 with apc to trunk version and backend app php-fpm socket to 5.6, no problems at all - the other way around backend app (Zend) to 5.11 with apc trunk and frontend app (yii) to 5.6 it comes to the reported error/problem... Actually all this information doesn't matter much - especially that I only get the error when using the way the application is running (even using the same frontend application, just calling the same functionality from another action which calls the backend service it works - funny here call i first the normal application way and call then the new action it fails also, only after restart of php-fpm it works again with the new action)... I'll write again when find the answer (the debugging is time dependent and as we can use the old version of 3.1.13 it is not as critical) ;-) (actually I don't think it should be closed as this error obviously exists - operating system indedependent (several redhat servers -> live, several centos -> testing and locally on my machine - with trunk version and apc 3.1.14 but not 3.1.13) - maybe next I'll try other apc options (but somehow it makes no sense as we have live slightly different from normal - and locally and on testing we have the pure basic default settings :-| )
Some suggestions to get better feedback about this error? THX :)
 [2016-08-31 20:47 UTC] cmb@php.net
-Summary: weired error "could not implement interface It..." when extending ArrayIterator +Summary: weird error "could not implement interface It..." when extending ArrayIterator -Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2016-08-31 20:47 UTC] cmb@php.net
According to <https://bugs.php.net/69618>, APC support has been
discontinued in favor of OPcache, APCu, the session upload
progress API and WinCache. Therefore this issue won't get fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 16:01:26 2024 UTC