Ask a Question related to PHP Bugs, Design and Development.
-
hannes dot magnusson at gmail dot com #1
#40711 [NEW]: RecursiveIteratorIterator unable to successfully clean up after itself
From: hannes dot magnusson at gmail dot com
Operating system: FreeBSD
PHP version: 5CVS-2007-03-03 (CVS)
PHP Bug Type: Reproducible crash
Bug description: RecursiveIteratorIterator unable to successfully clean up after itself
Description:
------------
Run the code below with reasonable low memory_limit on, for
instance, PHP5.2 source directory.
Reproduce code:
---------------
<?php
class rfi extends RecursiveFilterIterator {
public function __construct($path) {
parent::__construct(new RecursiveDirectoryIterator($path));
}
}
class rii extends RecursiveIteratorIterator {
}
$rii = new rii(new rfi("."));
foreach($rii as $obj) {
}
Actual result:
--------------
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
719 sub_iter->funcs->dtor(sub_iter
TSRMLS_CC);
[New LWP 100098]
(gdb) bt
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
#1 0x0836d384 in zend_objects_store_free_object_storage
(objects=0x84f2618, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_objects_API.c:89
#2 0x0833d2db in shutdown_executor (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_execute_API.c:299
#3 0x0834c77e in zend_deactivate (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend.c:860
#4 0x082f5354 in php_request_shutdown (dummy=0x0)
at /usr/src/php/5.2/main/main.c:1311
#5 0x083bd0d8 in main (argc=2, argv=0xbfbfe960)
at /usr/src/php/5.2/sapi/cli/php_cli.c:1294
--
Edit bug report at [url]http://bugs.php.net/?id=40711&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40711&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40711&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40711&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40711&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40711&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40711&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40711&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40711&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40711&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40711&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40711&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40711&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40711&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40711&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40711&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40711&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40711&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40711&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40711&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40711&r=mysqlcfg[/url]
hannes dot magnusson at gmail dot com Guest
-
#39151 [NEW]: Parse error in recursiveiteratoriterator.php
From: harvey dot robin at gmail dot com Operating system: Linux, Ubuntu PHP version: 5.2.0RC5 PHP Bug Type: SPL related Bug... -
Can't successfully install PSE 2.0 w/ XP
I cannot successfully install my purchase of PSE 2.0 with my XP OS. I had previous problems with my limited edition PS that came w/ camera after... -
anybody successfully installed msttcorefonts ???
At least, these last several days, I continuously get this: --20:49:01-- http://unc.dl.sourceforge.net/sourceforge/corefonts/andale32.exe =>... -
[CVS] How to move a tag successfully?
I want to move a tag of a file from version 1.3 to 1.5, I have checked the help and documents of cvs, but it doesn't work. Would anyone help me? ... -
Has anyone successfully installed PHP 5?
Has anyone installed PHP 5 on Windows or Linux using Apache 2? -
iliaa@php.net #2
#40711 [Opn->Asn]: RecursiveIteratorIterator unable to successfully clean up after itself
ID: 40711
Updated by: [email]iliaa@php.net[/email]
Reported By: hannes dot magnusson at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Reproducible crash
Operating System: FreeBSD
PHP Version: 5CVS-2007-03-03 (CVS)
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2007-03-03 17:25:55] hannes dot magnusson at gmail dot com
Description:
------------
Run the code below with reasonable low memory_limit on, for
instance, PHP5.2 source directory.
Reproduce code:
---------------
<?php
class rfi extends RecursiveFilterIterator {
public function __construct($path) {
parent::__construct(new RecursiveDirectoryIterator($path));
}
}
class rii extends RecursiveIteratorIterator {
}
$rii = new rii(new rfi("."));
foreach($rii as $obj) {
}
Actual result:
--------------
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
719 sub_iter->funcs->dtor(sub_iter
TSRMLS_CC);
[New LWP 100098]
(gdb) bt
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
#1 0x0836d384 in zend_objects_store_free_object_storage
(objects=0x84f2618, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_objects_API.c:89
#2 0x0833d2db in shutdown_executor (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_execute_API.c:299
#3 0x0834c77e in zend_deactivate (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend.c:860
#4 0x082f5354 in php_request_shutdown (dummy=0x0)
at /usr/src/php/5.2/main/main.c:1311
#5 0x083bd0d8 in main (argc=2, argv=0xbfbfe960)
at /usr/src/php/5.2/sapi/cli/php_cli.c:1294
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40711&edit=1[/url]
iliaa@php.net Guest
-
helly@php.net #3
#40711 [Asn->Bgs]: RecursiveIteratorIterator unable to successfully clean up after itself
ID: 40711
Updated by: [email]helly@php.net[/email]
Reported By: hannes dot magnusson at gmail dot com
-Status: Assigned
+Status: Bogus
Bug Type: Reproducible crash
-Operating System: FreeBSD
+Operating System: *
-PHP Version: 5CVS-2007-03-03 (CVS)
+PHP Version: *
Assigned To: helly
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
First thanks for filing this because I found an error in the class
layout. RecursiveFilterIterator::accept must be abstract. And instead
you want to use ParentIterator (PI). Another issue is actually in your
code. RecursiveIteratorIterator (RII) does not return parents until you
specify so by changing its mode (for instance RII::SELF_FIRST). The next
issue in the code is that PI::getChildren returns a RecursiveIterator
(RI) since it calls RDI::geChildren. This is then passed to
PI::__construct becuase it needs to keep the structure. Now in you
rcode RFI::__construct you create another RDI. That is the ctor
receives a PI that contains an RDI instance and creates a new RDI from
it. While doing so the inner RDI is being rewound to its first element
which is ".". Now as far as I can tell there will be a recursion
somehow with this approach. For me it actually aborts with an exception
message like, too many open files.
Given the fact that we don't fix recursions I'd say this is expected
behavior. If you feel different reopen this report.
The correct code to get the directories is below:
<?php
class RDI extends RecursiveDirectoryIterator {}
class PI extends ParentIterator {}
class RII extends RecursiveIteratorIterator {}
$rii = new RII(new PI(new RDI($argv[1])), RII::SELF_FIRST);
foreach($rii as $f) {
echo "$f\n";
}
Previous Comments:
------------------------------------------------------------------------
[2007-03-03 17:25:55] hannes dot magnusson at gmail dot com
Description:
------------
Run the code below with reasonable low memory_limit on, for
instance, PHP5.2 source directory.
Reproduce code:
---------------
<?php
class rfi extends RecursiveFilterIterator {
public function __construct($path) {
parent::__construct(new RecursiveDirectoryIterator($path));
}
}
class rii extends RecursiveIteratorIterator {
}
$rii = new rii(new rfi("."));
foreach($rii as $obj) {
}
Actual result:
--------------
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
719 sub_iter->funcs->dtor(sub_iter
TSRMLS_CC);
[New LWP 100098]
(gdb) bt
#0 0x081d6e23 in spl_RecursiveIteratorIterator_free_storage
(_object=0x850464c, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/ext/spl/spl_iterators.c:719
#1 0x0836d384 in zend_objects_store_free_object_storage
(objects=0x84f2618, tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_objects_API.c:89
#2 0x0833d2db in shutdown_executor (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend_execute_API.c:299
#3 0x0834c77e in zend_deactivate (tsrm_ls=0x84e82b0)
at /usr/src/php/5.2/Zend/zend.c:860
#4 0x082f5354 in php_request_shutdown (dummy=0x0)
at /usr/src/php/5.2/main/main.c:1311
#5 0x083bd0d8 in main (argc=2, argv=0xbfbfe960)
at /usr/src/php/5.2/sapi/cli/php_cli.c:1294
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40711&edit=1[/url]
helly@php.net Guest



Reply With Quote

