Edit report at http://bugs.php.net/bug.php?id=54119&edit=1
ID: 54119 Updated by: [email protected] Reported by: damien at commerceguys dot com Summary: Bogus behavior of Zend in relation to stream wrappers -Status: Open +Status: Duplicate Type: Bug Package: Filesystem function related Operating System: Linux PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: dup; already fixed in trunk Previous Comments: ------------------------------------------------------------------------ [2011-02-28 15:50:00] damien at commerceguys dot com I can confirm this works on 5.3.6-dev. So this seems to have go fixed along the way, any idea where? ------------------------------------------------------------------------ [2011-02-28 13:23:32] [email protected] Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2011-02-28 13:21:25] damien at commerceguys dot com Description: ------------ See test script: when returning a undefined key from stream_stat(), the behavior of the Zend interpretor changes. I confirmed this on PHP 5.3.5, pjoye reproduced it separately. Test script: --------------- --TEST-- Test that user space streams do not break the fabric of the universe. --FILE-- <?php class UserSpaceStream { public function stream_open($uri, $mode, $options, &$opened_path) { return TRUE; } public function stream_read($count) { return ''; } public function stream_write($data) { return TRUE; } public function stream_eof() { return FALSE; } public function stream_stat() { $stat = array(); // This triggers (correctly) a "Notice: Undefined index: size in %s on line %d". $array = array(); $stat['size'] = $array['size']; return $stat; } } stream_wrapper_register("test", "UserSpaceStream"); // Alone, the assignment of a key to an undefined variable is legal. $undefined_variable['key'] = 'value'; // This fstat() call triggers something weird... $h = fopen('test://anyfile', 'r'); fstat($h); // ... from this point, PHP triggers a "Warning: Cannot use a scalar value as // an array" for each assignement of array keys to undefined variables. $undefined_variable2['key'] = 'value'; ?> --EXPECTF-- Notice: Undefined index: size in %s on line %d ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54119&edit=1
