#48643 [Com]: Memory not freed with FilterIterator
ID: 48643 Comment by: robin_fernandes at uk dot ibm dot com Reported By: z...@php.net Status: Open Bug Type: SPL related Operating System: Linux (Ubuntu) PHP Version: 5.2CVS-2009-06-22 (CVS) New Comment: Below is a simplified testcase which I think exposes the same leak. '/manyFiles' is a directory containing 1 files. Output on php52: noop call in loop (no leak) : 66176 strlen call in loop (leak on 53) : 66176 Output on php53: noop call in loop (no leak) : 337448 strlen call in loop (leak on 53) : 6028496 Previous Comments: [2009-06-22 14:33:05] z...@php.net I tested with PHP 5.2 but do not see the same issue. I believe this is specific to PHP 5.3. [2009-06-22 12:32:02] z...@php.net By the way, I traced the memory consumption using xdebug: xdebug.auto_trace = on; xdebug.show_mem_delta = on; The first few lines are here http://pastebin.ca/1469804 This makes it look more like a bug with the way the accept() method is invoked inside PhptFilterIterator. [2009-06-22 11:41:59] z...@php.net Description: An excessive about of memory is used when a class which extends FilterIterator is used to filter for certain file types when scanning a source tree. Reproduce code: --- A small benchmark is provided in the tar file here:http://filebin.ca/okgvtt/memcheck.tar The file contains three tests which all use code in Util.php. To run the tests edit the shell script memcheck to add the top level directory of a PHP source tree as input to each test. Then just execute the shell script. The benchmarks produce a list of directories which contain .phpt files, the memory usage when the class PhptFilterIterator is used is 20 times higher than the other two methods. Expected result: Would expect the memory usage to be similar. Actual result: -- Memory usage is 20 times higher. -- Edit this bug report at http://bugs.php.net/?id=48643&edit=1
#48643 [Com]: Memory not freed with FilterIterator
ID: 48643 Comment by: robin_fernandes at uk dot ibm dot com Reported By: z...@php.net Status: Open Bug Type: SPL related Operating System: Linux (Ubuntu) PHP Version: 5.2CVS-2009-06-22 (CVS) New Comment: Testcase below shows that the issue relates to an implicit cast to string on an SplFileInfo object when retrieved from a RecursiveDirectoryIterator during iteration. php52: SplFileInfo explicit cast to string: 262144 SplFileInfo implicit cast to string: 262144 php53: SplFileInfo explicit cast to string: 524288 SplFileInfo implicit cast to string: 6291456 Previous Comments: [2009-06-23 13:02:34] z...@php.net Looking backwards through PHP builds I have currently narrowed this down to a change that went in to PHP 5.3 somewhere between the 12th June 2008 and the 1st July 2008. [2009-06-23 12:13:49] robin_fernandes at uk dot ibm dot com Below is a simplified testcase which I think exposes the same leak. '/manyFiles' is a directory containing 1 files. Output on php52: noop call in loop (no leak) : 66176 strlen call in loop (leak on 53) : 66176 Output on php53: noop call in loop (no leak) : 337448 strlen call in loop (leak on 53) : 6028496 [2009-06-22 14:33:05] z...@php.net I tested with PHP 5.2 but do not see the same issue. I believe this is specific to PHP 5.3. [2009-06-22 12:32:02] z...@php.net By the way, I traced the memory consumption using xdebug: xdebug.auto_trace = on; xdebug.show_mem_delta = on; The first few lines are here http://pastebin.ca/1469804 This makes it look more like a bug with the way the accept() method is invoked inside PhptFilterIterator. [2009-06-22 11:41:59] z...@php.net Description: An excessive about of memory is used when a class which extends FilterIterator is used to filter for certain file types when scanning a source tree. Reproduce code: --- A small benchmark is provided in the tar file here:http://filebin.ca/okgvtt/memcheck.tar The file contains three tests which all use code in Util.php. To run the tests edit the shell script memcheck to add the top level directory of a PHP source tree as input to each test. Then just execute the shell script. The benchmarks produce a list of directories which contain .phpt files, the memory usage when the class PhptFilterIterator is used is 20 times higher than the other two methods. Expected result: Would expect the memory usage to be similar. Actual result: -- Memory usage is 20 times higher. -- Edit this bug report at http://bugs.php.net/?id=48643&edit=1
#43483 [NEW]: get_class_methods() does not list all visible methods.
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-03 (snap) PHP Bug Type: Class/Object related Bug description: get_class_methods() does not list all visible methods. Description: get_class_methods() should list accessible private and protected methods if it is called from class scope (this is not stated explicitly in the doc, but is mentioned in Dmitry's comment to bug 32296). However, the testcase below shows a situation where, at a given scope, a method is accessible yet not listed by get_class_methods(). Specifically, this occurs with protected methods accessed from a superclass scope. Reproduced on php53 and php6 snaps on Windows. Reproduce code: --- Expected result: Successfully called D::prot(). array(2) { [0]=> string(4) "prot" [1]=> string(4) "test" } Actual result: -- Successfully called D::prot(). array(1) { [0]=> string(4) "test" } -- Edit bug report at http://bugs.php.net/?id=43483&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43483&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43483&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43483&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43483&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43483&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43483&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43483&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43483&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43483&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43483&r=support Expected behavior:http://bugs.php.net/fix.php?id=43483&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43483&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43483&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43483&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43483&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43483&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43483&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43483&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43483&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43483&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43483&r=mysqlcfg
#43483 [Opn]: get_class_methods() does not list all visible methods.
ID: 43483 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Class/Object related Operating System: Windows PHP Version: 5.3CVS-2007-12-03 (snap) New Comment: The standard get_method handler (which is used to retrieve a method before executing it) uses zend_check_protected() to verify whether a protected method is accessible. zend_check_protected() returns true if the current scope is the same as, a child of OR a parent of the protected method's declaring class. However, get_class_methods() implements its own algorithm to filter out non visible methods. This algorithm excludes protected methods unless the current scope is an "instance of" the method's declaring class (so it is more restrictive than zend_check_protected()): [...] if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC) || (EG(scope) && (((mptr->common.fn_flags & ZEND_ACC_PROTECTED) && instanceof_function(EG(scope), mptr->common.scope TSRMLS_CC)) || ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && EG(scope) == mptr->common.scope { [...] Previous Comments: ---------------------------- [2007-12-03 13:44:12] robin_fernandes at uk dot ibm dot com Description: get_class_methods() should list accessible private and protected methods if it is called from class scope (this is not stated explicitly in the doc, but is mentioned in Dmitry's comment to bug 32296). However, the testcase below shows a situation where, at a given scope, a method is accessible yet not listed by get_class_methods(). Specifically, this occurs with protected methods accessed from a superclass scope. Reproduced on php53 and php6 snaps on Windows. Reproduce code: --- Expected result: Successfully called D::prot(). array(2) { [0]=> string(4) "prot" [1]=> string(4) "test" } Actual result: -- Successfully called D::prot(). array(1) { [0]=> string(4) "test" } -- Edit this bug report at http://bugs.php.net/?id=43483&edit=1
#43484 [NEW]: call_user_func_array(): questionable pass-by-val/pass-by-ref behaviour.
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-03 (snap) PHP Bug Type: Scripting Engine problem Bug description: call_user_func_array(): questionable pass-by-val/pass-by-ref behaviour. Description: This issue was originally raised as documentation bug 43079. Raising as Scripting Engine problem as suggested by vrana at php dot net. The pass-by-value/pass-by-ref behaviour of call_user_func_array() is not intuitive (see the user contributed notes on the documentation page: http://php.net/call_user_func_array ). It appears that the way in which an argument is passed depends not on the target function signature, but rather on whether its entry in $param_arr is referenced or not. Specifically, it is possible to force an argument to be passed by reference to a function which expects a pass-by-value argument, even with call time pass by reference DISABLED in php.ini. Reproduced on php5.3 and php6 snaps on Windows. Reproduce code: --- Expected result: array(2) { [0]=> string(9) "changed.a" [1]=> string(9) "changed.b" } array(2) { [0]=> &string(10) "original.a" [1]=> string(10) "original.b" } Actual result: -- array(2) { [0]=> string(10) "original.a" [1]=> string(10) "original.b" } array(2) { [0]=> &string(9) "changed.a" [1]=> string(10) "original.b" } -- Edit bug report at http://bugs.php.net/?id=43484&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43484&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43484&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43484&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43484&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43484&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43484&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43484&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43484&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43484&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43484&r=support Expected behavior:http://bugs.php.net/fix.php?id=43484&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43484&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43484&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43484&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43484&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43484&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43484&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43484&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43484&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43484&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43484&r=mysqlcfg
#42009 [Csd->Opn]: is_subclass_of: behaviour contradicts is_a.phpt testcase description
ID: 42009 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com -Status: Closed +Status: Open Bug Type: Scripting Engine problem Operating System: * -PHP Version: 5CVS-2007-08-17 +PHP Version: PHP 5.3.0-dev (cli) (built: Nov 27 2007 16:18:57) Assigned To: dmitry New Comment: This has been fixed for the second argument passed to is_subclass_of(), but not the first. The test below shows that is_subclass_of() still invokes __autoload() for the first argument, contradicting the description (but not the content) of test is_a.phpt. Note that if this is fixed, the expected output for is_a.phpt will need to change. ---( Test case: )--- ---( Expected output: )--- Warning: Unknown class passed as parameter in %s on line 6 bool(false) ---( Actual output: )--- AUTOLOAD 'Undef' Warning: Unknown class passed as parameter in %s on line 6 bool(false) Previous Comments: [2007-08-22 13:24:03] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. [2007-08-17 20:13:25] [EMAIL PROTECTED] According to the commit log is_a() and is_subclass_of() should NOT call __autoload, in the same way as "instanceof" operator. But indeed the is_a.phpt does have check to see if __autoload was called and expects it -> there's bug somewhere. Dmitry, please check this out. [2007-07-16 15:02:50] robin_fernandes at uk dot ibm dot com Description: This is either a minor mistake in a testcase description, or a bug in is_subclass_of(). The description of testcase http://lxr.php.net/source/ZendEngine2/tests/is_a.phpt states: "is_a() and is_subclass_of() shouldn't call __autoload". However, the expected output explicitly checks for __autoload() calls *in some cases* (lines 49 and 50). Either the testcase description (and perhaps documentation) should clarify in which circumstances is_subclass_of() does result in an invocation of __autoload(), or is_subclass_of() should be fixed. Below is a simplified testcase illustrating a case where is_subclass_of() does invoke __autoload(). Reproduce code: --- Expected result: bool(false) Actual result: -- AUTOLOAD 'Undef' bool(false) -- Edit this bug report at http://bugs.php.net/?id=42009&edit=1
#42009 [Csd]: is_subclass_of: behaviour contradicts is_a.phpt testcase description
ID: 42009 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Closed Bug Type: Scripting Engine problem Operating System: * PHP Version: PHP 5.3.0-dev (cli) (built: Nov 27 2007 16:18:57) Assigned To: dmitry New Comment: Thanks for the explanation. Would it be reasonable to change the description of the test is_a.phpt, which currently states: "is_a() and is_subclass_of() shouldn't call __autoload" ? Previous Comments: [2007-12-03 16:29:12] [EMAIL PROTECTED] is_subclass_of() doesn't call __autoload() in case if first atgument is an object. Because if it's an object its class ,all parent classes and implemented interfaces are already loaded. In case if first arguments is string, PHP will call __autoload() for it. This is not a bug but expected behavior. ---- [2007-12-03 15:46:44] robin_fernandes at uk dot ibm dot com This has been fixed for the second argument passed to is_subclass_of(), but not the first. The test below shows that is_subclass_of() still invokes __autoload() for the first argument, contradicting the description (but not the content) of test is_a.phpt. Note that if this is fixed, the expected output for is_a.phpt will need to change. ---( Test case: )--- ---( Expected output: )--- Warning: Unknown class passed as parameter in %s on line 6 bool(false) ---( Actual output: )--- AUTOLOAD 'Undef' Warning: Unknown class passed as parameter in %s on line 6 bool(false) [2007-08-22 13:24:03] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. [2007-08-17 20:13:25] [EMAIL PROTECTED] According to the commit log is_a() and is_subclass_of() should NOT call __autoload, in the same way as "instanceof" operator. But indeed the is_a.phpt does have check to see if __autoload was called and expects it -> there's bug somewhere. Dmitry, please check this out. -------------------- [2007-07-16 15:02:50] robin_fernandes at uk dot ibm dot com Description: This is either a minor mistake in a testcase description, or a bug in is_subclass_of(). The description of testcase http://lxr.php.net/source/ZendEngine2/tests/is_a.phpt states: "is_a() and is_subclass_of() shouldn't call __autoload". However, the expected output explicitly checks for __autoload() calls *in some cases* (lines 49 and 50). Either the testcase description (and perhaps documentation) should clarify in which circumstances is_subclass_of() does result in an invocation of __autoload(), or is_subclass_of() should be fixed. Below is a simplified testcase illustrating a case where is_subclass_of() does invoke __autoload(). Reproduce code: --- Expected result: bool(false) Actual result: -- AUTOLOAD 'Undef' bool(false) -- Edit this bug report at http://bugs.php.net/?id=42009&edit=1
#43529 [NEW]: readdir(), rewinddir() and closedir() don't always fail when passed 0 arguments
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-07 (snap) PHP Bug Type: Directory function related Bug description: readdir(), rewinddir() and closedir() don't always fail when passed 0 arguments Description: According to the docs, readdir(), rewinddir() and closedir() should take at least one argument: the directory handle. However, these methods are also aliases for the Directory class methods Directory::read(), Directory::rewind() and Directory::close(). Instances of the Directory class hold the directory handle in $this->handle. Therefore, if no argument is passed, the implementation of these methods is such that $this->handle is used as the directory handle. However, no check is made to ensure $this is an instance of Directory. Consequently, calling readdir() etc.. with no arguments from a context where $this->handle just happens to exists will result in unexpected behaviour instead of an error message. Reproduce code: --- handle = opendir(getcwd()); $c->test(); ?> Expected result: Warning: readdir(): no Directory resource supplied in %s on line 6 bool(false) Warning: rewinddir(): no Directory resource supplied in %s on line 7 bool(false) Warning: closedir(): no Directory resource supplied in %s on line 8 bool(false) Actual result: -- string(1) "." NULL NULL -- Edit bug report at http://bugs.php.net/?id=43529&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43529&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43529&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43529&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43529&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43529&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43529&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43529&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43529&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43529&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43529&r=support Expected behavior:http://bugs.php.net/fix.php?id=43529&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43529&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43529&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43529&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43529&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43529&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43529&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43529&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43529&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43529&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43529&r=mysqlcfg
#43596 [NEW]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-14 (snap) PHP Bug Type: Arrays related Bug description: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5) Description: With php5.2.x, explicitly specifying an argument of length 0 would result in an array of length 0. However, with the snaps for php5.3 and php6.0, the length argument is ignored if it is 0. This may have been introduced by the patch for bug 43541, which fixed the type conversion for this parameter. Note that testcase ext/standard/tests/array/array_slice.phpt is affected by this change. Expected output below is taken from php5.2.5. Reproduce code: --- Expected result: array(0) { } Actual result: -- array(3) { [0]=> int(2) [1]=> int(3) [2]=> int(4) } -- Edit bug report at http://bugs.php.net/?id=43596&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43596&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43596&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43596&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43596&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43596&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43596&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43596&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43596&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43596&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43596&r=support Expected behavior:http://bugs.php.net/fix.php?id=43596&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43596&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43596&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43596&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43596&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43596&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43596&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43596&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43596&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43596&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43596&r=mysqlcfg
#43596 [Opn]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
ID: 43596 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.3CVS-2007-12-14 (snap) New Comment: First line should read "With php5.2.x, explicitly specifying a $length argument of 0 would result in an array of length 0" - sorry. Previous Comments: [2007-12-14 14:52:49] robin_fernandes at uk dot ibm dot com Description: With php5.2.x, explicitly specifying an argument of length 0 would result in an array of length 0. However, with the snaps for php5.3 and php6.0, the length argument is ignored if it is 0. This may have been introduced by the patch for bug 43541, which fixed the type conversion for this parameter. Note that testcase ext/standard/tests/array/array_slice.phpt is affected by this change. Expected output below is taken from php5.2.5. Reproduce code: --- Expected result: array(0) { } Actual result: -- array(3) { [0]=> int(2) [1]=> int(3) [2]=> int(4) } -- Edit this bug report at http://bugs.php.net/?id=43596&edit=1
#43596 [Opn]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
ID: 43596 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.3CVS-2007-12-14 (snap) New Comment: Hi Felipe, thanks for the update. I understand and agree with the documented case in which the argument is omitted. However, in the case described above, it is not omitted, but rather explicitly provided as 0. If this change in behaviour is intentional, I think the documentation will need to be updated. Previous Comments: [2007-12-14 21:46:28] [EMAIL PROTECTED] Seeing the code, we note that is intentional, and according to documentation: "If it is omitted, then the sequence will have everything from offset up until the end of the array." Seems to be right. [2007-12-14 18:59:45] [EMAIL PROTECTED] In PHP 5.3.0-dev (cli) (built: Dec 11 2007 13:57:26) returns: array(0) { } [2007-12-14 14:54:38] robin_fernandes at uk dot ibm dot com First line should read "With php5.2.x, explicitly specifying a $length argument of 0 would result in an array of length 0" - sorry. [2007-12-14 14:52:49] robin_fernandes at uk dot ibm dot com Description: With php5.2.x, explicitly specifying an argument of length 0 would result in an array of length 0. However, with the snaps for php5.3 and php6.0, the length argument is ignored if it is 0. This may have been introduced by the patch for bug 43541, which fixed the type conversion for this parameter. Note that testcase ext/standard/tests/array/array_slice.phpt is affected by this change. Expected output below is taken from php5.2.5. Reproduce code: --- Expected result: array(0) { } Actual result: -- array(3) { [0]=> int(2) [1]=> int(3) [2]=> int(4) } -- Edit this bug report at http://bugs.php.net/?id=43596&edit=1
#43698 [NEW]: Assignment to inaccessible private property in __set() has no effect.
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-28 (snap) PHP Bug Type: Scripting Engine problem Bug description: Assignment to inaccessible private property in __set() has no effect. Description: The assignment in the __set() method below is caught by the setter recursion guard. Subsequently, I would expect it to be treated like a direct assignment, and therefore to fail due to an attempt to write to another class's private property. Instead, nothing happens at all. I believe this is related to bug 38461, whereby a crash caused by a similar testcase was fixed, but the expected result of the assignment was not discussed. Reproduce code: --- $name = $value; } } class D extends C { private $hidden = "Original Value"; } $d = new D; $d->hidden = "New Value"; var_dump($d); ?> Expected result: In C::__set('hidden', 'New Value') Fatal error: Cannot access private property D::$hidden in %s on line 5 Actual result: -- In C::__set('hidden', 'New Value') object(D)#1 (1) { ["hidden":"D":private]=> string(14) "Original Value" } -- Edit bug report at http://bugs.php.net/?id=43698&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43698&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43698&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43698&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43698&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43698&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43698&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43698&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43698&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43698&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43698&r=support Expected behavior:http://bugs.php.net/fix.php?id=43698&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43698&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43698&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43698&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43698&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43698&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43698&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43698&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43698&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43698&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43698&r=mysqlcfg
#43736 [NEW]: Cannot return an overloaded property by reference
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: Cannot return an overloaded property by reference Description: Even with a __get() that returns by reference, attempting to return an overloaded property by reference directly will return by value with a notice. A work-around is to assign the overloaded property by reference to another variable, and return that variable. However, I think it should be possible to return the property by reference directly. This affects 5.2.5 and the latest 5.3 and 6.0 snaps. Reproduce code: --- Testcase over 20 lines - see: http://pastebin.com/f35a74bdb Expected result: Get reference to global via return-by-ref __get() called implicitly - OK: string(13) "First change!" Get reference to global via return-by-ref __get() called explicitly from return-by-ref function - OK: string(14) "Second change!" Get reference to global via return-by-ref __get() called implicitly from return-by-ref function: string(13) "Third change!" Actual result: -- Get reference to global via return-by-ref __get() called implicitly - OK: string(13) "First change!" Get reference to global via return-by-ref __get() called explicitly from return-by-ref function - OK: string(14) "Second change!" Get reference to global via return-by-ref __get() called implicitly from return-by-ref function: Notice: Only variable references should be returned by reference in %s on line 20 string(8) "original" -- Edit bug report at http://bugs.php.net/?id=43736&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43736&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43736&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43736&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43736&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43736&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43736&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43736&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43736&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43736&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43736&r=support Expected behavior:http://bugs.php.net/fix.php?id=43736&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43736&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43736&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43736&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43736&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43736&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43736&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43736&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43736&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43736&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43736&r=mysqlcfg
#43596 [Opn]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
ID: 43596 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.3CVS-2007-12-14 (snap) New Comment: Hi msaraujo, thanks for looking at this. Just to ensure there is no confusion: the purpose of this report is to notify of a change in behaviour at least in the php 5.3 / 6.0 snaps. We agree that php 5.2.5 outputs array(0) { }, and I believe that is the correct output. Previous Comments: [2008-01-25 20:16:48] [EMAIL PROTECTED] I have tried with 5.2.5 and actual result is: array(0) { } [2007-12-15 07:36:47] robin_fernandes at uk dot ibm dot com Hi Felipe, thanks for the update. I understand and agree with the documented case in which the argument is omitted. However, in the case described above, it is not omitted, but rather explicitly provided as 0. If this change in behaviour is intentional, I think the documentation will need to be updated. [2007-12-14 21:46:28] [EMAIL PROTECTED] Seeing the code, we note that is intentional, and according to documentation: "If it is omitted, then the sequence will have everything from offset up until the end of the array." Seems to be right. [2007-12-14 18:59:45] [EMAIL PROTECTED] In PHP 5.3.0-dev (cli) (built: Dec 11 2007 13:57:26) returns: array(0) { } [2007-12-14 14:54:38] robin_fernandes at uk dot ibm dot com First line should read "With php5.2.x, explicitly specifying a $length argument of 0 would result in an array of length 0" - sorry. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/43596 -- Edit this bug report at http://bugs.php.net/?id=43596&edit=1
#43973 [NEW]: __autoload called with wrong classname when triggered by static callback
From: robin_fernandes at uk dot ibm dot com Operating system: PHP version: 6CVS-2008-01-29 (snap) PHP Bug Type: Class/Object related Bug description: __autoload called with wrong classname when triggered by static callback Description: NB: This issue is specific to PHP6 snaps. PHP5.2 and PHP5.3 snaps produce the expected output. When using a callback of the form 'C::f' where class C is not yet defined, __autoload() is invoked with the fully qualified method name as an argument, rather than just the class name. Reproduce code: --- Expected result: Autoload class: C In C::f() Actual result: -- Autoload class: C::f Warning: call_user_func() expects parameter 1 to be valid callback, string given in %s on line 9 -- Edit bug report at http://bugs.php.net/?id=43973&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43973&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43973&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43973&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43973&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43973&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43973&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43973&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43973&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43973&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43973&r=support Expected behavior:http://bugs.php.net/fix.php?id=43973&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43973&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43973&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43973&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43973&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43973&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43973&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43973&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43973&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43973&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43973&r=mysqlcfg
#43984 [NEW]: Extra parentheses prevent implicit variable initialisation when passing by ref
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: Extra parentheses prevent implicit variable initialisation when passing by ref Description: Passing an undefined variable by reference causes that variable to be implicitly defined. However, this is not the case if the argument is inside parentheses. This is reproducible on php5.2.5 as well as php5.3 and php6 snaps. Reproduce code: --- Expected result: Pass undefined variable by ref: string(7) "changed" Pass undefined variable by ref with parentheses: string(7) "changed" Actual result: -- Pass undefined variable by ref: string(7) "changed" Pass undefined variable by ref with parentheses: Notice: Undefined variable: b in %s on line 11 Strict Standards: Only variables should be passed by reference in %s on line 11 Notice: Undefined variable: b in %s on line 12 NULL -- Edit bug report at http://bugs.php.net/?id=43984&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43984&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43984&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43984&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43984&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43984&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43984&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43984&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43984&r=needscript Try newer version:http://bugs.php.net/fix.php?id=43984&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43984&r=support Expected behavior:http://bugs.php.net/fix.php?id=43984&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43984&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43984&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43984&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43984&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43984&r=dst IIS Stability:http://bugs.php.net/fix.php?id=43984&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43984&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43984&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43984&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43984&r=mysqlcfg
#43984 [Opn]: Extra parentheses prevent implicit variable initialisation when passing by ref
ID: 43984 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Scripting Engine problem Operating System: Windows PHP Version: 5.2.5 New Comment: Note that if the variable is defined, it is correctly passed by reference whether or not the parens are present: Prints: Pass defined variable by ref with parentheses: string(7) "changed" Previous Comments: [2008-01-30 18:00:49] robin_fernandes at uk dot ibm dot com Description: Passing an undefined variable by reference causes that variable to be implicitly defined. However, this is not the case if the argument is inside parentheses. This is reproducible on php5.2.5 as well as php5.3 and php6 snaps. Reproduce code: --- Expected result: Pass undefined variable by ref: string(7) "changed" Pass undefined variable by ref with parentheses: string(7) "changed" Actual result: -- Pass undefined variable by ref: string(7) "changed" Pass undefined variable by ref with parentheses: Notice: Undefined variable: b in %s on line 11 Strict Standards: Only variables should be passed by reference in %s on line 11 Notice: Undefined variable: b in %s on line 12 NULL -- Edit this bug report at http://bugs.php.net/?id=43984&edit=1
#44100 [NEW]: Inconsistent handling of static array declarations with duplicate keys
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2CVS-2008-02-11 (snap) PHP Bug Type: Scripting Engine problem Bug description: Inconsistent handling of static array declarations with duplicate keys Description: There is an inconsistency when handling array declarations that include multiple entries with the same key but different values, such as array('a'=>0, 'a'=>1). In almost all cases, the last value will be used (1 in the example above). But the last part of the testcase below shows an inconsistent case, where the array is a static variable AND the first duplicate key is a constant rather than a literal. This is because in zval_update_constant_ex(), array entries with keys marked IS_CONSTANT_INDEX are always updated, regardless of the presence and position of other elements with the same key. Reproduce code: --- 0, 'a'=>1); print_r($nonStatic1); // [a] => 1 --> OK echo "\nDuplicate key in static array declaration:\n"; static $static1 = array('a'=>0, 'a'=>1); print_r($static1); // [a] => 1 --> OK define('DUP_KEY', 'a'); echo "\nDuplicate key in non static array declaration using constant as first key:\n"; $nonStatic2 = array(DUP_KEY=>0, 'a'=>1); print_r($nonStatic2); // [a] => 1 --> OK echo "\nDuplicate key in static array declaration using constant as first key:\n"; static $static2 = array(DUP_KEY=>0, 'a'=>1); print_r($static2); // [a] => 0 --> bug? ?> Expected result: Duplicate key in non static array declaration: Array ( [a] => 1 ) Duplicate key in static array declaration: Array ( [a] => 1 ) Duplicate key in non static array declaration using constant as first key: Array ( [a] => 1 ) Duplicate key in static array declaration using constant as first key: Array ( [a] => 1 ) Actual result: -- Duplicate key in non static array declaration: Array ( [a] => 1 ) Duplicate key in static array declaration: Array ( [a] => 1 ) Duplicate key in non static array declaration using constant as first key: Array ( [a] => 1 ) Duplicate key in static array declaration using constant as first key: Array ( [a] => 0 ) -- Edit bug report at http://bugs.php.net/?id=44100&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=44100&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44100&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44100&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44100&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44100&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44100&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44100&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=44100&r=needscript Try newer version:http://bugs.php.net/fix.php?id=44100&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44100&r=support Expected behavior:http://bugs.php.net/fix.php?id=44100&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44100&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44100&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44100&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44100&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=44100&r=dst IIS Stability:http://bugs.php.net/fix.php?id=44100&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44100&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44100&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44100&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=44100&r=mysqlcfg
#44181 [NEW]: extract($a, EXTR_OVERWRITE|EXTR_REFS) can fail to create references to $a
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2CVS-2008-02-20 (snap) PHP Bug Type: Arrays related Bug description: extract($a, EXTR_OVERWRITE|EXTR_REFS) can fail to create references to $a Description: Using extract() with EXTR_OVERWRITE|EXTR_REFS does not create references to the array elements if the following conditions are true: - $a is referenced by some other variable (its is_ref flag is true). - A variable already exists in the current scope with a name matching the key. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $foo = 'test'; $ref = &$a; extract($a, EXTR_OVERWRITE|EXTR_REFS); $foo = 'changed.foo'; var_dump($a['foo']); //expecting changed.foo ?> Expected result: string(11) "changed.foo" Actual result: -- string(12) "original.foo" -- Edit bug report at http://bugs.php.net/?id=44181&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44181&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44181&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44181&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44181&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44181&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44181&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=44181&r=needscript Try newer version:http://bugs.php.net/fix.php?id=44181&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44181&r=support Expected behavior:http://bugs.php.net/fix.php?id=44181&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44181&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44181&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44181&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44181&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44181&r=dst IIS Stability:http://bugs.php.net/fix.php?id=44181&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44181&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44181&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44181&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=44181&r=mysqlcfg
#44182 [Opn]: extract($a, EXTR_REFS) can fail to split copy-on-write references
ID: 44182 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.2CVS-2008-02-20 (snap) New Comment: I think the problem is that extract() can set the is_ref flag on zvals without splitting them (i.e. zvals which have more than 1 copy-on-write references can get their is_ref flag set). >From array.c: ... } else { if (Z_REFCOUNT_P(var_array) > 1 || *entry == EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); } else { Z_SET_ISREF_PP(entry); // <-- causes damage if entry has COW references! } ... I believe that the only reliable way to fix this would be to make extract() take its array argument as PREFER_REF. This way, we can safely split array elements away from their copy-on-write references, and still end up with a zval that belongs to the original array. I'm attaching a patch which implements this and fixes this bug, as well as bug http://bugs.php.net/44181. Disclaimer: - I am not an internals expert. I might have disregarded some scenarios. Feedback welcome! - Patch tested on Windows XP 32bit only. Patch against php6.0-200802191530 snap (includes test cases): http://pastebin.ca/910172 Previous Comments: [2008-02-20 09:26:54] robin_fernandes at uk dot ibm dot com Description: extract($a, EXTR_REFS) does not always respect copy-on-write reference logic. In the testcase below, $nonRef is initially a copy-on-write reference to an element of $a. After the call to extract, it has become a real reference to an element of $a. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $nonref = $a['foo']; $ref = &$a; extract($a, EXTR_REFS); $a['foo'] = 'changed.foo'; var_dump($nonref); //expecting original.foo ?> Expected result: string(12) "original.foo" Actual result: -- string(11) "changed.foo" -- Edit this bug report at http://bugs.php.net/?id=44182&edit=1
#44181 [Opn]: extract($a, EXTR_OVERWRITE|EXTR_REFS) can fail to create references to $a
ID: 44181 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.2CVS-2008-02-20 (snap) New Comment: I think this is because $a is passed by value, and the call to SEPARATE_ZVAL_TO_MAKE_IS_REF(entry) below splits the array element from the original array. The reference is therefore created to the element of the argument array which, after the split, is not the same as the element of the original array. >From array.c: ... if (zend_u_hash_find(EG(active_symbol_table), Z_TYPE(final_name), Z_UNIVAL(final_name), Z_UNILEN(final_name) + 1, (void **) &orig_var) == SUCCESS) { SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);// <-- Split! entry no longer refers to element of $a. zval_add_ref(entry); zval_ptr_dtor(orig_var); *orig_var = *entry; } else { ... I believe the root cause for this bug is the same as bug http://bugs.php.net/44182. I have submitted a patch for that bug which fixes this one too. Previous Comments: [2008-02-20 09:25:43] robin_fernandes at uk dot ibm dot com Description: Using extract() with EXTR_OVERWRITE|EXTR_REFS does not create references to the array elements if the following conditions are true: - $a is referenced by some other variable (its is_ref flag is true). - A variable already exists in the current scope with a name matching the key. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $foo = 'test'; $ref = &$a; extract($a, EXTR_OVERWRITE|EXTR_REFS); $foo = 'changed.foo'; var_dump($a['foo']); //expecting changed.foo ?> Expected result: string(11) "changed.foo" Actual result: -- string(12) "original.foo" -- Edit this bug report at http://bugs.php.net/?id=44181&edit=1
#44182 [NEW]: extract($a, EXTR_REFS) can fail to split copy-on-write references
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2CVS-2008-02-20 (snap) PHP Bug Type: Arrays related Bug description: extract($a, EXTR_REFS) can fail to split copy-on-write references Description: extract($a, EXTR_REFS) does not always respect copy-on-write reference logic. In the testcase below, $nonRef is initially a copy-on-write reference to an element of $a. After the call to extract, it has become a real reference to an element of $a. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $nonref = $a['foo']; $ref = &$a; extract($a, EXTR_REFS); $a['foo'] = 'changed.foo'; var_dump($nonref); //expecting original.foo ?> Expected result: string(12) "original.foo" Actual result: -- string(11) "changed.foo" -- Edit bug report at http://bugs.php.net/?id=44182&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44182&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44182&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44182&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44182&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44182&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44182&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=44182&r=needscript Try newer version:http://bugs.php.net/fix.php?id=44182&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44182&r=support Expected behavior:http://bugs.php.net/fix.php?id=44182&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44182&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44182&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44182&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44182&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44182&r=dst IIS Stability:http://bugs.php.net/fix.php?id=44182&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44182&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44182&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44182&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=44182&r=mysqlcfg
#43484 [Bgs]: call_user_func_array(): questionable pass-by-val/pass-by-ref behaviour.
ID: 43484 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows PHP Version: 5.3CVS-2007-12-03 (snap) New Comment: Hi Johannes, Thanks for looking into this. I understand your comment, but I can't quite see how it relates to the behaviour described in the bug report. The bug describes how, using call_user_func_array(), one can force a function defined with pass-by-value args to take those args by reference - even with call time pass by reference DISABLED in php.ini. Note that this odd behaviour is now documented (thanks to bug 43079). But the documentation writer suggested raising a functional bug, because the behaviour is potentially dangerous. Here is a simplified example: ---( Expected Output )--- array(1) { [0]=> string(8) "original" } ---( Actual Output )--- array(1) { [0]=> &string(47) "This assignment should not affect global scope!" } Previous Comments: [2008-03-08 22:56:39] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php $args = array('original.a', 'original.b'); This puts a copy of the value 'original.a' into that array. ---------------------------- [2007-12-03 14:09:12] robin_fernandes at uk dot ibm dot com Description: This issue was originally raised as documentation bug 43079. Raising as Scripting Engine problem as suggested by vrana at php dot net. The pass-by-value/pass-by-ref behaviour of call_user_func_array() is not intuitive (see the user contributed notes on the documentation page: http://php.net/call_user_func_array ). It appears that the way in which an argument is passed depends not on the target function signature, but rather on whether its entry in $param_arr is referenced or not. Specifically, it is possible to force an argument to be passed by reference to a function which expects a pass-by-value argument, even with call time pass by reference DISABLED in php.ini. Reproduced on php5.3 and php6 snaps on Windows. Reproduce code: --- Expected result: array(2) { [0]=> string(9) "changed.a" [1]=> string(9) "changed.b" } array(2) { [0]=> &string(10) "original.a" [1]=> string(10) "original.b" } Actual result: -- array(2) { [0]=> string(10) "original.a" [1]=> string(10) "original.b" } array(2) { [0]=> &string(9) "changed.a" [1]=> string(10) "original.b" } -- Edit this bug report at http://bugs.php.net/?id=43484&edit=1
#44182 [Com]: extract($a, EXTR_REFS) can fail to split copy-on-write references
ID: 44182 Comment by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Feedback Bug Type: Arrays related Operating System: * PHP Version: 5.2CVS-2008-02-20 (snap) New Comment: The patch URL? Seems OK to me, perhaps it was temporarily broken. In any case, here's another one: http://soal.org/php/extract.patch.txt Previous Comments: [2008-10-25 13:25:36] [EMAIL PROTECTED] That url does not work.. [2008-02-20 09:29:24] robin_fernandes at uk dot ibm dot com I think the problem is that extract() can set the is_ref flag on zvals without splitting them (i.e. zvals which have more than 1 copy-on-write references can get their is_ref flag set). >From array.c: ... } else { if (Z_REFCOUNT_P(var_array) > 1 || *entry == EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); } else { Z_SET_ISREF_PP(entry); // <-- causes damage if entry has COW references! } ... I believe that the only reliable way to fix this would be to make extract() take its array argument as PREFER_REF. This way, we can safely split array elements away from their copy-on-write references, and still end up with a zval that belongs to the original array. I'm attaching a patch which implements this and fixes this bug, as well as bug http://bugs.php.net/44181. Disclaimer: - I am not an internals expert. I might have disregarded some scenarios. Feedback welcome! - Patch tested on Windows XP 32bit only. Patch against php6.0-200802191530 snap (includes test cases): http://pastebin.ca/910172 [2008-02-20 09:26:54] robin_fernandes at uk dot ibm dot com Description: extract($a, EXTR_REFS) does not always respect copy-on-write reference logic. In the testcase below, $nonRef is initially a copy-on-write reference to an element of $a. After the call to extract, it has become a real reference to an element of $a. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $nonref = $a['foo']; $ref = &$a; extract($a, EXTR_REFS); $a['foo'] = 'changed.foo'; var_dump($nonref); //expecting original.foo ?> Expected result: string(12) "original.foo" Actual result: -- string(11) "changed.foo" -- Edit this bug report at http://bugs.php.net/?id=44182&edit=1
#44182 [Fbk->Opn]: extract($a, EXTR_REFS) can fail to split copy-on-write references
ID: 44182 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com -Status: Feedback +Status: Open Bug Type: Arrays related Operating System: * PHP Version: 5.2CVS-2008-02-20 (snap) New Comment: Changing status back to Open now that an alternative URL has been provided. Previous Comments: [2008-10-25 13:52:02] robin_fernandes at uk dot ibm dot com The patch URL? Seems OK to me, perhaps it was temporarily broken. In any case, here's another one: http://soal.org/php/extract.patch.txt [2008-10-25 13:25:36] [EMAIL PROTECTED] That url does not work.. [2008-02-20 09:29:24] robin_fernandes at uk dot ibm dot com I think the problem is that extract() can set the is_ref flag on zvals without splitting them (i.e. zvals which have more than 1 copy-on-write references can get their is_ref flag set). >From array.c: ... } else { if (Z_REFCOUNT_P(var_array) > 1 || *entry == EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); } else { Z_SET_ISREF_PP(entry); // <-- causes damage if entry has COW references! } ... I believe that the only reliable way to fix this would be to make extract() take its array argument as PREFER_REF. This way, we can safely split array elements away from their copy-on-write references, and still end up with a zval that belongs to the original array. I'm attaching a patch which implements this and fixes this bug, as well as bug http://bugs.php.net/44181. Disclaimer: - I am not an internals expert. I might have disregarded some scenarios. Feedback welcome! - Patch tested on Windows XP 32bit only. Patch against php6.0-200802191530 snap (includes test cases): http://pastebin.ca/910172 [2008-02-20 09:26:54] robin_fernandes at uk dot ibm dot com Description: extract($a, EXTR_REFS) does not always respect copy-on-write reference logic. In the testcase below, $nonRef is initially a copy-on-write reference to an element of $a. After the call to extract, it has become a real reference to an element of $a. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $nonref = $a['foo']; $ref = &$a; extract($a, EXTR_REFS); $a['foo'] = 'changed.foo'; var_dump($nonref); //expecting original.foo ?> Expected result: string(12) "original.foo" Actual result: -- string(11) "changed.foo" -- Edit this bug report at http://bugs.php.net/?id=44182&edit=1
#44182 [Fbk->Opn]: extract($a, EXTR_REFS) can fail to split copy-on-write references
ID: 44182 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com -Status: Feedback +Status: Open Bug Type: Arrays related Operating System: * PHP Version: 5.2CVS-2008-02-20 (snap) New Comment: Confirmed this bug (and bug 44181) still present on: PHP 5.2.7RC3-dev (cli) (built: Oct 27 2008 11:40:07) PHP 5.3.0alpha3-dev (cli) (built: Oct 27 2008 14:06:30) PHP 6.0.0-dev (cli) (built: Oct 27 2008 12:39:36) Previous Comments: [2008-10-27 13:01:24] [EMAIL PROTECTED] Does this bug exist in HEAD, PHP_5_3 and PHP_5_2 branches? And in today's versions of them? [2008-10-25 13:52:02] robin_fernandes at uk dot ibm dot com The patch URL? Seems OK to me, perhaps it was temporarily broken. In any case, here's another one: http://soal.org/php/extract.patch.txt [2008-10-25 13:25:36] [EMAIL PROTECTED] That url does not work.. [2008-02-20 09:29:24] robin_fernandes at uk dot ibm dot com I think the problem is that extract() can set the is_ref flag on zvals without splitting them (i.e. zvals which have more than 1 copy-on-write references can get their is_ref flag set). >From array.c: ... } else { if (Z_REFCOUNT_P(var_array) > 1 || *entry == EG(uninitialized_zval_ptr)) { SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); } else { Z_SET_ISREF_PP(entry); // <-- causes damage if entry has COW references! } ... I believe that the only reliable way to fix this would be to make extract() take its array argument as PREFER_REF. This way, we can safely split array elements away from their copy-on-write references, and still end up with a zval that belongs to the original array. I'm attaching a patch which implements this and fixes this bug, as well as bug http://bugs.php.net/44181. Disclaimer: - I am not an internals expert. I might have disregarded some scenarios. Feedback welcome! - Patch tested on Windows XP 32bit only. Patch against php6.0-200802191530 snap (includes test cases): http://pastebin.ca/910172 [2008-02-20 09:26:54] robin_fernandes at uk dot ibm dot com Description: extract($a, EXTR_REFS) does not always respect copy-on-write reference logic. In the testcase below, $nonRef is initially a copy-on-write reference to an element of $a. After the call to extract, it has become a real reference to an element of $a. This is reproducible on 5.2, 5.3 and 6.0 snaps. Reproduce code: --- 'original.foo'); $nonref = $a['foo']; $ref = &$a; extract($a, EXTR_REFS); $a['foo'] = 'changed.foo'; var_dump($nonref); //expecting original.foo ?> Expected result: string(12) "original.foo" Actual result: -- string(11) "changed.foo" -- Edit this bug report at http://bugs.php.net/?id=44182&edit=1
#46749 [NEW]: Crash when repeatedly attempting to assign to property of non-object.
From: robin_fernandes at uk dot ibm dot com Operating system: * PHP version: 6CVS-2008-12-04 (snap) PHP Bug Type: Reproducible crash Bug description: Crash when repeatedly attempting to assign to property of non-object. Description: The script below crashes consistently on Windows and Linux on the latest php6 snap. This seems to be specific to HEAD: I could NOT recreate the crash on the latest 5_2 and 5_3 snaps. Reproduce code: --- nonEmptyString->prop = "Will eventually cause crash"; } echo "Done." ?> Expected result: 1...2...3...4...5...6...7...8...9...10...Done. Actual result: -- 1...2...[crash] -- Edit bug report at http://bugs.php.net/?id=46749&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46749&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46749&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46749&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46749&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46749&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46749&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46749&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46749&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46749&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46749&r=support Expected behavior: http://bugs.php.net/fix.php?id=46749&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46749&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46749&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46749&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46749&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46749&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46749&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46749&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46749&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46749&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46749&r=mysqlcfg
#46749 [Com]: Crash when repeatedly attempting to assign to property of non-object.
ID: 46749 Comment by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Reproducible crash Operating System: * PHP Version: 6CVS-2008-12-04 (snap) New Comment: In fact, the class C above is not necessary to get the crash; here is a shorter reproduce script. Expected and actual output as above. prop = 'Will eventually cause crash'; } echo "Done." ?> Previous Comments: [2008-12-04 15:26:55] robin_fernandes at uk dot ibm dot com Description: The script below crashes consistently on Windows and Linux on the latest php6 snap. This seems to be specific to HEAD: I could NOT recreate the crash on the latest 5_2 and 5_3 snaps. Reproduce code: --- nonEmptyString->prop = "Will eventually cause crash"; } echo "Done." ?> Expected result: 1...2...3...4...5...6...7...8...9...10...Done. Actual result: -- 1...2...[crash] -- Edit this bug report at http://bugs.php.net/?id=46749&edit=1
#46897 [NEW]: ob_flush() should fail to flush unerasable buffers
From: robin_fernandes at uk dot ibm dot com Operating system: * PHP version: 5.3CVS-2008-12-18 (snap) PHP Bug Type: Output Control Bug description: ob_flush() should fail to flush unerasable buffers Description: On 5_2 and 5_3, there is an inconsistency between ob_flush() and ob_get_flush() when attempting to flush a buffer created with the flag $erase=false: - ob_get_flush() raises a notice and does NOT flush the buffer; - ob_flush() DOES flush the buffer. Note that on HEAD, both ob_get_flush() and ob_flush() raise a notice and do NOT flush the buffer. I think the behaviour in HEAD is correct. Here's a simple patch for 5_3 that resolves the inconsistency and makes it behave more like HEAD: Index: output.c === RCS file: /repository/php-src/main/output.c,v retrieving revision 1.167.2.3.2.4.2.9 diff -u -w -p -r1.167.2.3.2.4.2.9 output.c --- output.c18 Aug 2008 07:46:31 - 1.167.2.3.2.4.2.9 +++ output.c18 Dec 2008 11:30:01 - @@ -774,6 +774,10 @@ PHP_FUNCTION(ob_flush) php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer. No buffer to flush."); RETURN_FALSE; } + if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) { + php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer %s", OG(active_ob_buffer).handler_name); + RETURN_FALSE; + } php_end_ob_buffer(1, 1 TSRMLS_CC); RETURN_TRUE; More generally, the behaviour of output buffering functions when dealing with unerasable buffers could benefit from better docs. I will raise a separate doc bug with some suggestions. Reproduce code: --- Expected result: [callback:1]Attempt to flush unerasable buffer - should fail... Notice: ob_flush(): failed to flush buffer callback in %s on line 11 bool(false) string(%d) "Attempt to flush unerasable buffer - should fail... Notice: ob_flush(): failed to flush buffer callback in %s on line 11 bool(false) " Actual result: -- [callback:1]Attempt to flush unerasable buffer - should fail... [callback:2]bool(true) string(11) "bool(true) " -- Edit bug report at http://bugs.php.net/?id=46897&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46897&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46897&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46897&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46897&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46897&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46897&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46897&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46897&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46897&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46897&r=support Expected behavior: http://bugs.php.net/fix.php?id=46897&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46897&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46897&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46897&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46897&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46897&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46897&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46897&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46897&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46897&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46897&r=mysqlcfg
#46900 [NEW]: Unexpected behaviour in HEAD when output buffer callback returns null
From: robin_fernandes at uk dot ibm dot com Operating system: * PHP version: 6CVS-2008-12-18 (snap) PHP Bug Type: Output Control Bug description: Unexpected behaviour in HEAD when output buffer callback returns null Description: In HEAD, the original input is sent to the output when the output buffer callback returns NULL. The docs for ob_start() only state this should happen when it returns FALSE - not NULL: "If output_callback returns FALSE original input is sent to the browser." On PHP 5_2 and 5_3, the empty string is sent to the output when the output buffer callback returns NULL. If the 5_2 & 5_3 behaviour is correct, here is a patch for HEAD : Index: output.c === RCS file: /repository/php-src/main/output.c,v retrieving revision 1.214 diff -u -w -p -r1.214 output.c --- output.c18 Aug 2008 07:45:59 - 1.214 +++ output.c18 Dec 2008 14:08:53 - @@ -983,7 +983,7 @@ static inline php_output_handler_status_ ZVAL_LONG(ob_mode, (long) context->op); zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode); -#define PHP_OUTPUT_USER_SUCCESS(retval) (retval && (Z_TYPE_P(retval) != IS_NULL) && (Z_TYPE_P(retval) != IS_BOOL || Z_BVAL_P(retval))) +#define PHP_OUTPUT_USER_SUCCESS(retval) (retval && !(Z_TYPE_P(retval) == IS_BOOL && Z_BVAL_P(retval)==0)) if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL TSRMLS_CC) && PHP_OUTPUT_USER_SUCCESS(retval)) { /* user handler may have returned TRUE */ status = PHP_OUTPUT_HANDLER_NO_DATA; If HEAD's current behaviour is as intended, the docs should be updated to describe the new behaviour in PHP6. Reproduce code: --- Expected result: done Actual result: -- You shouldn't see this. done -- Edit bug report at http://bugs.php.net/?id=46900&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46900&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46900&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46900&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46900&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46900&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46900&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46900&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46900&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46900&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46900&r=support Expected behavior: http://bugs.php.net/fix.php?id=46900&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46900&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46900&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46900&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46900&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46900&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46900&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46900&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46900&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46900&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46900&r=mysqlcfg
#46903 [NEW]: ob_start(): Special $chunk_size value of 1 is not honoured in HEAD
From: robin_fernandes at uk dot ibm dot com Operating system: PHP version: 6CVS-2008-12-18 (snap) PHP Bug Type: Output Control Bug description: ob_start(): Special $chunk_size value of 1 is not honoured in HEAD Description: The doc for ob_start() states: "If the optional parameter chunk_size is passed, the buffer will be flushed after any output call which causes the buffer's length to equal or exceed chunk_size . Default value 0 means that the function is called only in the end, other special value 1 sets chunk_size to 4096." In HEAD, setting $chunk_size=1 actually does set the buffer threshold size to 1 byte, rather than 4096 bytes as on 5_* and as documented. Here's a simple patch for HEAD to restore the documented behaviour: Index: output.c === RCS file: /repository/php-src/main/output.c,v retrieving revision 1.214 diff -u -w -p -r1.214 output.c --- output.c18 Aug 2008 07:45:59 - 1.214 +++ output.c18 Dec 2008 14:23:10 - @@ -1342,6 +1342,8 @@ PHP_FUNCTION(ob_start) } if (chunk_size < 0) { chunk_size = 0; + } else if (chunk_size == 1) { + chunk_size = 4096; } if (SUCCESS != php_output_start_user(output_handler, chunk_size, flags TSRMLS_CC)) { Reproduce code: --- 1, these two chars should // come out as part of a single flush: echo "1"; echo "2"; ?> Expected result: [1] int(4096) 12 Actual result: -- [1] int(1) [2] 1 [3] 2 [4] -- Edit bug report at http://bugs.php.net/?id=46903&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46903&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46903&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46903&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46903&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46903&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46903&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46903&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46903&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46903&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46903&r=support Expected behavior: http://bugs.php.net/fix.php?id=46903&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46903&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46903&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46903&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46903&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46903&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46903&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46903&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46903&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46903&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46903&r=mysqlcfg
#44660 [NEW]: Indexed and reference assignment to propery of non-object don't trigger warning
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2008-04-07 (snap) PHP Bug Type: Scripting Engine problem Bug description: Indexed and reference assignment to propery of non-object don't trigger warning Description: Attempting to read or write to a property of a (non-empty) non-object usually results in a notice or a warning. However, no warning or notice is raised when performing an indexed or reference assignment. Consequently, the assignment fails silently. Confirmed on 5_2, 5_3 and HEAD snaps. Reproduce code: --- read access: "; echo $a->p; echo "\n--> direct assignment: "; $a->p = $s; echo "\n--> increment: "; $a->p++; echo "\n--> reference assignment:"; $a->p =& $s; echo "\n--> indexed assignment:"; $a->p[0] = $s; echo "\n\n\n--> Confirm assignments have had no impact:"; var_dump($a, $a->p); ?> Expected result: --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: --> indexed assignment: --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL Actual result: -- --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: Warning: Attempt to assign property of non-object in %s on line 15 --> indexed assignment: Warning: Attempt to assign property of non-object in %s on line 18 --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL -- Edit bug report at http://bugs.php.net/?id=44660&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44660&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44660&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44660&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44660&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44660&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44660&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=44660&r=needscript Try newer version:http://bugs.php.net/fix.php?id=44660&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44660&r=support Expected behavior:http://bugs.php.net/fix.php?id=44660&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44660&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44660&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44660&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44660&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44660&r=dst IIS Stability:http://bugs.php.net/fix.php?id=44660&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44660&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44660&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44660&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=44660&r=mysqlcfg
#44660 [Opn]: Indexed and reference assignment to propery of non-object don't trigger warning
ID: 44660 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Scripting Engine problem Operating System: Windows PHP Version: 5.3CVS-2008-04-07 (snap) New Comment: Expected & actual result should be the other way around: the warnings for reference and indexed assignments are currently missing. Sorry! Previous Comments: [2008-04-07 13:22:01] robin_fernandes at uk dot ibm dot com Description: Attempting to read or write to a property of a (non-empty) non-object usually results in a notice or a warning. However, no warning or notice is raised when performing an indexed or reference assignment. Consequently, the assignment fails silently. Confirmed on 5_2, 5_3 and HEAD snaps. Reproduce code: --- read access: "; echo $a->p; echo "\n--> direct assignment: "; $a->p = $s; echo "\n--> increment: "; $a->p++; echo "\n--> reference assignment:"; $a->p =& $s; echo "\n--> indexed assignment:"; $a->p[0] = $s; echo "\n\n\n--> Confirm assignments have had no impact:"; var_dump($a, $a->p); ?> Expected result: --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: --> indexed assignment: --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL Actual result: -- --> read access: Notice: Trying to get property of non-object in %s on line 6 --> direct assignment: Warning: Attempt to assign property of non-object in %s on line 9 --> increment: Warning: Attempt to increment/decrement property of non-object in %s on line 12 --> reference assignment: Warning: Attempt to assign property of non-object in %s on line 15 --> indexed assignment: Warning: Attempt to assign property of non-object in %s on line 18 --> Confirm assignments have had no impact: Notice: Trying to get property of non-object in %s on line 21 bool(true) NULL -- Edit this bug report at http://bugs.php.net/?id=44660&edit=1
#44678 [NEW]: spliti error message includes wrong function name
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2CVS-2008-04-09 (snap) PHP Bug Type: Regexps related Bug description: spliti error message includes wrong function name Description: An "Invalid Regular Expression" error message issued by spliti() refers to function split(). Reproduce code: --- Expected result: Warning: spliti(): Invalid Regular Expression in %s on line 2 Actual result: -- Warning: spliti(): Invalid Regular Expression to split() in %s on line 2 -- Edit bug report at http://bugs.php.net/?id=44678&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44678&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44678&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44678&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44678&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44678&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44678&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=44678&r=needscript Try newer version:http://bugs.php.net/fix.php?id=44678&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44678&r=support Expected behavior:http://bugs.php.net/fix.php?id=44678&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44678&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44678&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44678&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44678&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44678&r=dst IIS Stability:http://bugs.php.net/fix.php?id=44678&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44678&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44678&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44678&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=44678&r=mysqlcfg
#45571 [NEW]: ReflectionClass::export() shows superclasses' private static methods.
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2008-07-20 (snap) PHP Bug Type: Reflection related Bug description: ReflectionClass::export() shows superclasses' private static methods. Description: A change was made in 5.3 so that ReflectionClass::export() does not list private methods from superclasses (see http://bugs.php.net/37964). However, the change was not applied for static methods. Proposed patch to restore consistency: http://pastebin.ca/1077574 . Reproduce code: --- Expected result: Class [ class C extends A ] { @@ %s 7-7 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } } Actual result: -- Class [ class C extends A ] { @@ %s 7-7 - Constants [0] { } - Static properties [0] { } - Static methods [1] { Method [ static private method sf ] { @@ %s 4 - 4 } } - Properties [0] { } - Methods [0] { } } -- Edit bug report at http://bugs.php.net/?id=45571&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45571&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45571&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45571&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45571&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45571&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45571&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=45571&r=needscript Try newer version:http://bugs.php.net/fix.php?id=45571&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45571&r=support Expected behavior:http://bugs.php.net/fix.php?id=45571&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45571&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45571&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45571&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45571&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45571&r=dst IIS Stability:http://bugs.php.net/fix.php?id=45571&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45571&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45571&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45571&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=45571&r=mysqlcfg
#45595 [NEW]: ArrayObject::STD_PROP_LIST does not behave as documented with foreach
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2CVS-2008-07-22 (snap) PHP Bug Type: SPL related Bug description: ArrayObject::STD_PROP_LIST does not behave as documented with foreach Description: The SPL documentation states that if the ArrayObject::STD_PROP_LIST flag is set on an ArrayObject instance: "Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.)" (see http://www.php.net/~helly/php/ext/spl/classArrayObject.html#daebe26f8478746da33c266a730714a9 ) This flag does affect var_dump(), but it seems to have no impact on foreach. See reproduce code. I'm not sure whether this is a functional problem or a documentation problem. Reproduce code: --- p1 = 1; $ao->p2 = 2; $ao->p3 = 3; echo "\nGet property list with var_dump:\n"; var_dump($ao); echo "\nGet property list with foreach:\n"; foreach ($ao as $key=>$value) { echo " $key=>$value\n"; } ?> Expected result: Create instance of ArrayObject and add some normal properties... Get property list with var_dump: object(ArrayObject)#1 (3) { ["p1"]=> int(1) ["p2"]=> int(2) ["p3"]=> int(3) } Get property list with foreach: p1=>1 p2=>2 p3=>3 Actual result: -- Create instance of ArrayObject and add some normal properties... Get property list with var_dump: object(ArrayObject)#1 (3) { ["p1"]=> int(1) ["p2"]=> int(2) ["p3"]=> int(3) } Get property list with foreach: 0=>x 1=>y 2=>z -- Edit bug report at http://bugs.php.net/?id=45595&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45595&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45595&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45595&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45595&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45595&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45595&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=45595&r=needscript Try newer version:http://bugs.php.net/fix.php?id=45595&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45595&r=support Expected behavior:http://bugs.php.net/fix.php?id=45595&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45595&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45595&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45595&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45595&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45595&r=dst IIS Stability:http://bugs.php.net/fix.php?id=45595&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45595&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45595&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45595&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=45595&r=mysqlcfg
#45614 [NEW]: ArrayIterator::current(), ::key() can show 1st private prop of wrapped object
From: robin_fernandes at uk dot ibm dot com Operating system: all PHP version: 5.3CVS-2008-07-24 (CVS) PHP Bug Type: SPL related Bug description: ArrayIterator::current(), ::key() can show 1st private prop of wrapped object Description: If the first property of a class is private and an instance of that class is wrapped by ArrayIterator, that first private property may be exposed by ArrayIterator::current() and ArrayIterator::key(). Specifically, this occurs when: - current() and key() are called right after obtaining the iterator from ArrayObject::getIterator(), OR - current() and key() are called right after the iterator position was reset due to the current position becoming invalid. In the reproduce code below, notice how the iterator behaves differently depending on how it was returned to its starting position. This issue affects snaps from 5_2, 5_3 and HEAD. It can be fixed with some extra calls to spl_array_skip_protected() in spl_array.c. Proposed patch against 5_3: http://pastebin.ca/1081771 Reproduce code: --- key()) . " => " . $it->current() . "\n"; $it->next(); echo str_replace("\0", '\0', $it->key()) . " => " . $it->current() . "\n"; } $ao = new ArrayObject(new C); $ai = $ao->getIterator(); echo "--> Show the first two items:\n"; showFirstTwoItems($ai); echo "\n--> Rewind and show the first two items:\n"; $ai->rewind(); showFirstTwoItems($ai); echo "\n--> Invalidate current position and show the first two items:\n"; unset($ai[$ai->key()]); $ai->current(); showFirstTwoItems($ai); ?> Expected result: --> Show the first two items: pub1 => public1 pub2 => public2 --> Rewind and show the first two items: pub1 => public1 pub2 => public2 --> Invalidate current position and show the first two items: pub1 => public1 pub3 => public3 Actual result: -- --> Show the first two items: \0C\0priv1 => secret1 pub1 => public1 --> Rewind and show the first two items: pub1 => public1 pub2 => public2 --> Invalidate current position and show the first two items: \0C\0priv1 => secret1 pub1 => public1 -- Edit bug report at http://bugs.php.net/?id=45614&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45614&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45614&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45614&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45614&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45614&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45614&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=45614&r=needscript Try newer version:http://bugs.php.net/fix.php?id=45614&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45614&r=support Expected behavior:http://bugs.php.net/fix.php?id=45614&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45614&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45614&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45614&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45614&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45614&r=dst IIS Stability:http://bugs.php.net/fix.php?id=45614&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45614&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45614&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45614&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=45614&r=mysqlcfg
#45622 [NEW]: isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set
From: robin_fernandes at uk dot ibm dot com Operating system: all PHP version: 5.3CVS-2008-07-25 (CVS) PHP Bug Type: SPL related Bug description: isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set Description: If an instance of ArrayObject $ao has flag ArrayObject::ARRAY_AS_PROPS set, $ao->p will access element p of the underlying storage array - but only if no real property p exists on $ao. If a real property p does exist, it will access that property as if the flag were not set. This works correctly with read, write and unset, but not with isset: when a real property p exists, isset($ao->p) always returns false . Reproduce code: --- 'array element')); $ao->setFlags(ArrayObject::ARRAY_AS_PROPS); echo "\n--> Access the real property:\n"; var_dump(isset($ao->p)); // bug var_dump($ao->p); echo "\n--> Remove the real property and access the array element:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); echo "\n--> Remove the array element and try access again:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); ?> Expected result: --> Access the real property: bool(true) string(15) "object property" --> Remove the real property and access the array element: bool(true) string(13) "array element" --> Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line 21 NULL Actual result: -- --> Access the real property: bool(false) string(15) "object property" --> Remove the real property and access the array element: bool(true) string(13) "array element" --> Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line 21 NULL -- Edit bug report at http://bugs.php.net/?id=45622&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45622&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45622&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45622&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45622&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45622&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45622&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=45622&r=needscript Try newer version:http://bugs.php.net/fix.php?id=45622&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45622&r=support Expected behavior:http://bugs.php.net/fix.php?id=45622&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45622&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45622&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45622&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45622&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45622&r=dst IIS Stability:http://bugs.php.net/fix.php?id=45622&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45622&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45622&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45622&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=45622&r=mysqlcfg
#45622 [Com]: isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set
ID: 45622 Comment by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: SPL related Operating System: all PHP Version: 5.3CVS-2008-07-25 (CVS) New Comment: The bug is due to an erroneous return 0 in spl_array_has_property: if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0) { if (!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); } return 0; /* if prop doesn't exist at all mode 0/1 cannot return 1 */ } The comment states we return 0 when "prop doesn't exist at all", but the previous condition is such that this branch will be taken specifically if the property DOES exist. Here's a simple patch against 5_3: http://pastebin.ca/1082412 Previous Comments: [2008-07-25 08:59:14] robin_fernandes at uk dot ibm dot com Description: If an instance of ArrayObject $ao has flag ArrayObject::ARRAY_AS_PROPS set, $ao->p will access element p of the underlying storage array - but only if no real property p exists on $ao. If a real property p does exist, it will access that property as if the flag were not set. This works correctly with read, write and unset, but not with isset: when a real property p exists, isset($ao->p) always returns false . Reproduce code: --- 'array element')); $ao->setFlags(ArrayObject::ARRAY_AS_PROPS); echo "\n--> Access the real property:\n"; var_dump(isset($ao->p)); // bug var_dump($ao->p); echo "\n--> Remove the real property and access the array element:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); echo "\n--> Remove the array element and try access again:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); ?> Expected result: --> Access the real property: bool(true) string(15) "object property" --> Remove the real property and access the array element: bool(true) string(13) "array element" --> Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line 21 NULL Actual result: -- --> Access the real property: bool(false) string(15) "object property" --> Remove the real property and access the array element: bool(true) string(13) "array element" --> Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line 21 NULL -- Edit this bug report at http://bugs.php.net/?id=45622&edit=1
#41961 [NEW]: Search for overridden private methods strays from class hierarchy
From: robin_fernandes at uk dot ibm dot com Operating system: Linux PHP version: 5CVS-2007-07-11 (snap) PHP Bug Type: Scripting Engine problem Bug description: Search for overridden private methods strays from class hierarchy Description: The wrong method is invoked if the following conditions are met: 1. A class has a public method that overrides/hides private method from its parent. 2. An unrelated class has a public method of the same name. 3. The overriding method is invoked from within the unrelated class. The unrelated class's method will be called instead of the overriding method. See the testcase below for an example. Reproduce code: --- The testcase is over 20 lines, but can be found here: http://www.nomorepasting.com/getpaste.php?pasteid=1270 Expected result: Called public ChildClass::secret() on an instance of: ChildClass Actual result: -- Called private X::secret() on an instance of: ChildClass -- Edit bug report at http://bugs.php.net/?id=41961&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41961&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41961&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41961&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41961&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41961&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41961&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=41961&r=needscript Try newer version:http://bugs.php.net/fix.php?id=41961&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41961&r=support Expected behavior:http://bugs.php.net/fix.php?id=41961&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41961&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41961&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41961&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41961&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41961&r=dst IIS Stability:http://bugs.php.net/fix.php?id=41961&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41961&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41961&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41961&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=41961&r=mysqlcfg
#41961 [Opn]: Search for overridden private methods strays from class hierarchy
ID: 41961 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5CVS-2007-07-11 (snap) New Comment: Below is a _suggested_ fix to zend_object_handlers.c based on snap php5.2-200707111030. I have only tested on Linux using 'make test'. Note that I am not highly familiar with the Zend Engine internals, so I could have overlooked a side effect or a better solution. --- php5.2-theirs/Zend/zend_object_handlers.c 2007-03-23 17:30:59.0 + +++ php5.2-mine/Zend/zend_object_handlers.c 2007-07-11 13:19:43.0 +0100 @@ -800,7 +800,7 @@ /* Ensure that we haven't overridden a private function and end up calling * the overriding public function... */ - if (EG(scope) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) { + if (EG(scope) && is_derived_class(fbc->common.scope, EG(scope)) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) { zend_function *priv_fbc; if (zend_hash_find(&EG(scope)->function_table, lc_method_name, method_len+1, (void **) &priv_fbc)==SUCCESS Previous Comments: ---------------------------- [2007-07-11 13:01:50] robin_fernandes at uk dot ibm dot com Description: The wrong method is invoked if the following conditions are met: 1. A class has a public method that overrides/hides private method from its parent. 2. An unrelated class has a public method of the same name. 3. The overriding method is invoked from within the unrelated class. The unrelated class's method will be called instead of the overriding method. See the testcase below for an example. Reproduce code: --- The testcase is over 20 lines, but can be found here: http://www.nomorepasting.com/getpaste.php?pasteid=1270 Expected result: Called public ChildClass::secret() on an instance of: ChildClass Actual result: -- Called private X::secret() on an instance of: ChildClass -- Edit this bug report at http://bugs.php.net/?id=41961&edit=1
#41961 [Asn]: Search for overridden private methods strays from class hierarchy
ID: 41961 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5CVS-2007-07-11 (snap) Assigned To: dmitry New Comment: Sorry - step 2 in the description should read: "2. An unrelated class has a *private* method of the same name." Previous Comments: [2007-07-11 13:06:30] robin_fernandes at uk dot ibm dot com Below is a _suggested_ fix to zend_object_handlers.c based on snap php5.2-200707111030. I have only tested on Linux using 'make test'. Note that I am not highly familiar with the Zend Engine internals, so I could have overlooked a side effect or a better solution. --- php5.2-theirs/Zend/zend_object_handlers.c 2007-03-23 17:30:59.0 + +++ php5.2-mine/Zend/zend_object_handlers.c 2007-07-11 13:19:43.0 +0100 @@ -800,7 +800,7 @@ /* Ensure that we haven't overridden a private function and end up calling * the overriding public function... */ - if (EG(scope) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) { + if (EG(scope) && is_derived_class(fbc->common.scope, EG(scope)) && fbc->op_array.fn_flags & ZEND_ACC_CHANGED) { zend_function *priv_fbc; if (zend_hash_find(&EG(scope)->function_table, lc_method_name, method_len+1, (void **) &priv_fbc)==SUCCESS ---------------------------- [2007-07-11 13:01:50] robin_fernandes at uk dot ibm dot com Description: The wrong method is invoked if the following conditions are met: 1. A class has a public method that overrides/hides private method from its parent. 2. An unrelated class has a public method of the same name. 3. The overriding method is invoked from within the unrelated class. The unrelated class's method will be called instead of the overriding method. See the testcase below for an example. Reproduce code: --- The testcase is over 20 lines, but can be found here: http://www.nomorepasting.com/getpaste.php?pasteid=1270 Expected result: Called public ChildClass::secret() on an instance of: ChildClass Actual result: -- Called private X::secret() on an instance of: ChildClass -- Edit this bug report at http://bugs.php.net/?id=41961&edit=1
#42009 [NEW]: is_subclass_of: behaviour contradicts is_a.phpt testcase description
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5CVS-2007-07-16 (snap) PHP Bug Type: Scripting Engine problem Bug description: is_subclass_of: behaviour contradicts is_a.phpt testcase description Description: This is either a minor mistake in a testcase description, or a bug in is_subclass_of(). The description of testcase http://lxr.php.net/source/ZendEngine2/tests/is_a.phpt states: "is_a() and is_subclass_of() shouldn't call __autoload". However, the expected output explicitly checks for __autoload() calls *in some cases* (lines 49 and 50). Either the testcase description (and perhaps documentation) should clarify in which circumstances is_subclass_of() does result in an invocation of __autoload(), or is_subclass_of() should be fixed. Below is a simplified testcase illustrating a case where is_subclass_of() does invoke __autoload(). Reproduce code: --- Expected result: bool(false) Actual result: -- AUTOLOAD 'Undef' bool(false) -- Edit bug report at http://bugs.php.net/?id=42009&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42009&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42009&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42009&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42009&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42009&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42009&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42009&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42009&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42009&r=support Expected behavior:http://bugs.php.net/fix.php?id=42009&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42009&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42009&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42009&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42009&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42009&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42009&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42009&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42009&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42009&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42009&r=mysqlcfg
#42311 [Opn]: Intermittent failure of test bug35885.phpt
ID: 42311 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Date/time related Operating System: Windows PHP Version: 5.2.3 New Comment: Below is a suggested patch which modifies the test to allow for a 1 second margin between the timestamps. I have confirmed the resulting test passes consistently on Windows on PHP 5.2.3, but have done no further testing. Index: C:/php5-latest-phpt/ext/date/tests/bug35885.phpt === --- C:/php5-latest-phpt/ext/date/tests/bug35885.phpt(revision 13029) +++ C:/php5-latest-phpt/ext/date/tests/bug35885.phpt(working copy) @@ -4,15 +4,15 @@ Previous Comments: [2007-08-15 13:48:21] robin_fernandes at uk dot ibm dot com Description: Test http://lxr.php.net/source/php-src/ext/date/tests/bug35885.phpt compares two time stamps representing the current time. However, these timestamps are seized in separate statements. The comparison fails intermittently, because the seconds occasionally tick over between the two calls. Below is bug35885.phpt enclosed in a loop to prove that it fails intermittently. It will break out of the loop on failure. Expected time to failure is less than 10 seconds. Reproduce code: --- Expected result: N/A (loop) Actual result: -- bool(true) bool(true) [...] bool(true) bool(false) string(24) "2007-08-15T13:26:05+" string(24) "2007-08-15T13:26:06+" -- Edit this bug report at http://bugs.php.net/?id=42311&edit=1
#42311 [NEW]: Intermittent failure of test bug35885.phpt
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.2.3 PHP Bug Type: Date/time related Bug description: Intermittent failure of test bug35885.phpt Description: Test http://lxr.php.net/source/php-src/ext/date/tests/bug35885.phpt compares two time stamps representing the current time. However, these timestamps are seized in separate statements. The comparison fails intermittently, because the seconds occasionally tick over between the two calls. Below is bug35885.phpt enclosed in a loop to prove that it fails intermittently. It will break out of the loop on failure. Expected time to failure is less than 10 seconds. Reproduce code: --- Expected result: N/A (loop) Actual result: -- bool(true) bool(true) [...] bool(true) bool(false) string(24) "2007-08-15T13:26:05+" string(24) "2007-08-15T13:26:06+" -- Edit bug report at http://bugs.php.net/?id=42311&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42311&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42311&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42311&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42311&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42311&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42311&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42311&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42311&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42311&r=support Expected behavior:http://bugs.php.net/fix.php?id=42311&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42311&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42311&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42311&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42311&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42311&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42311&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42311&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42311&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42311&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42311&r=mysqlcfg
#42641 [NEW]: ob_start(): inconsistent behaviour with undefined callbacks
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5CVS-2007-09-12 (snap) PHP Bug Type: Output Control Bug description: ob_start(): inconsistent behaviour with undefined callbacks Description: ob_start() can initialize multiple output buffers in a single call using a comma delimited list of output callbacks, as follows: ob_start('f,f,f'); where function f() is a defined function. However, behaviour when passing an undefined callback is inconsistent: ob_start('non_existent,f'); returns false and initializes no output buffers, whereas ob_start('non_existent,f,f'); returns true and initializes 2 output buffers with f as a callback. Using arrays, the behaviour is consistent. The following both return false and initialize no output buffers: ob_start(array('non_existent', 'f')); ob_start(array('non_existent', 'f', 'f')); Tested on Windows XP on PHP 5.2.5-dev (cli) (built: Sep 12 2007 04:04:36). Reproduce code: --- 0) { ob_end_flush(); } } var_dump(ob_start(array('non_existent', 'f'))); checkAndClean(); var_dump(ob_start(array('non_existent', 'f', 'f'))); checkAndClean(); var_dump(ob_start('non_existent,f')); checkAndClean(); var_dump(ob_start('non_existent,f,f')); //bug: expecting false with no output buffers. Actually returns true and initialises 2 output buffers. checkAndClean(); ?> Expected result: bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) Actual result: -- bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(true) Array ( [0] => f [1] => f ) -- Edit bug report at http://bugs.php.net/?id=42641&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42641&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42641&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42641&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42641&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42641&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42641&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42641&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42641&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42641&r=support Expected behavior:http://bugs.php.net/fix.php?id=42641&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42641&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42641&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42641&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42641&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42641&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42641&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42641&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42641&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42641&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42641&r=mysqlcfg
#42641 [Fbk->Opn]: Further info
ID: 42641 User updated by: robin_fernandes at uk dot ibm dot com -Summary: ob_start(): inconsistent behaviour with undefined callbacks Reported By: robin_fernandes at uk dot ibm dot com -Status: Feedback +Status: Open Bug Type: Output Control Operating System: Windows PHP Version: 5CVS-2007-09-12 (snap) New Comment: Hi, Thanks for your reply. As documentation isn't always complete/up to date, I looked at the implementation of ob_start() to understand its behaviour. The code in the 5.2 version of php_ob_init() in output.c splits strings on ',' and attempts to process each part seaparately (line 485). For arrays, if a pair does not represent a method, a comment explicitly states "init all array elements recursively" (line 516). The prototype in the 5.2 code currently looks like this: bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]]) The following testcase shows this behaviour in action: http://pastebin.com/f4f15a025 Regarding tuning up the error message display params, I'm currently using: error_reporting = E_ALL | E_STRICT / display_errors = 1 . Would you expect see warnings/notices with my testcase? I'll happily raise a documentation bug to ensure this is covered. Alternatively, perhaps the fact that this behaviour is available is itself a bug? Note that this is raised against php5 (not 6 where the output buffering implementation seems to be a bit different). Previous Comments: [2007-09-12 11:17:04] [EMAIL PROTECTED] Let's start with the prototype for this function: bool ob_start ( [callback $output_callback [, int $chunk_size [, bool $erase]]] ) The first parameter is "callback" type, so it expects either a string (function name) or array (object, method). More information about "callback" pseudo-type: http://www.php.net/callback I don't know where you got the idea that you can pass multiple callbacks in there. It's not said to work like that anywhere in the manual at least. :) Please fix your example script accordingly (and tune up your display_errors / error_reporting levels..). ---------------------------- [2007-09-12 09:15:35] robin_fernandes at uk dot ibm dot com Description: ob_start() can initialize multiple output buffers in a single call using a comma delimited list of output callbacks, as follows: ob_start('f,f,f'); where function f() is a defined function. However, behaviour when passing an undefined callback is inconsistent: ob_start('non_existent,f'); returns false and initializes no output buffers, whereas ob_start('non_existent,f,f'); returns true and initializes 2 output buffers with f as a callback. Using arrays, the behaviour is consistent. The following both return false and initialize no output buffers: ob_start(array('non_existent', 'f')); ob_start(array('non_existent', 'f', 'f')); Tested on Windows XP on PHP 5.2.5-dev (cli) (built: Sep 12 2007 04:04:36). Reproduce code: --- 0) { ob_end_flush(); } } var_dump(ob_start(array('non_existent', 'f'))); checkAndClean(); var_dump(ob_start(array('non_existent', 'f', 'f'))); checkAndClean(); var_dump(ob_start('non_existent,f')); checkAndClean(); var_dump(ob_start('non_existent,f,f')); //bug: expecting false with no output buffers. Actually returns true and initialises 2 output buffers. checkAndClean(); ?> Expected result: bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) Actual result: -- bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(true) Array ( [0] => f [1] => f ) -- Edit this bug report at http://bugs.php.net/?id=42641&edit=1
#42641 [Opn]: ob_start(): inconsistent behaviour with undefined callbacks
ID: 42641 User updated by: robin_fernandes at uk dot ibm dot com -Summary: Further info Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Output Control Operating System: Windows PHP Version: 5CVS-2007-09-12 (snap) New Comment: Accidentally changed the summary - changing it back. Previous Comments: [2007-09-12 14:06:29] robin_fernandes at uk dot ibm dot com Hi, Thanks for your reply. As documentation isn't always complete/up to date, I looked at the implementation of ob_start() to understand its behaviour. The code in the 5.2 version of php_ob_init() in output.c splits strings on ',' and attempts to process each part seaparately (line 485). For arrays, if a pair does not represent a method, a comment explicitly states "init all array elements recursively" (line 516). The prototype in the 5.2 code currently looks like this: bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]]) The following testcase shows this behaviour in action: http://pastebin.com/f4f15a025 Regarding tuning up the error message display params, I'm currently using: error_reporting = E_ALL | E_STRICT / display_errors = 1 . Would you expect see warnings/notices with my testcase? I'll happily raise a documentation bug to ensure this is covered. Alternatively, perhaps the fact that this behaviour is available is itself a bug? Note that this is raised against php5 (not 6 where the output buffering implementation seems to be a bit different). [2007-09-12 11:17:04] [EMAIL PROTECTED] Let's start with the prototype for this function: bool ob_start ( [callback $output_callback [, int $chunk_size [, bool $erase]]] ) The first parameter is "callback" type, so it expects either a string (function name) or array (object, method). More information about "callback" pseudo-type: http://www.php.net/callback I don't know where you got the idea that you can pass multiple callbacks in there. It's not said to work like that anywhere in the manual at least. :) Please fix your example script accordingly (and tune up your display_errors / error_reporting levels..). ---------------------------- [2007-09-12 09:15:35] robin_fernandes at uk dot ibm dot com Description: ob_start() can initialize multiple output buffers in a single call using a comma delimited list of output callbacks, as follows: ob_start('f,f,f'); where function f() is a defined function. However, behaviour when passing an undefined callback is inconsistent: ob_start('non_existent,f'); returns false and initializes no output buffers, whereas ob_start('non_existent,f,f'); returns true and initializes 2 output buffers with f as a callback. Using arrays, the behaviour is consistent. The following both return false and initialize no output buffers: ob_start(array('non_existent', 'f')); ob_start(array('non_existent', 'f', 'f')); Tested on Windows XP on PHP 5.2.5-dev (cli) (built: Sep 12 2007 04:04:36). Reproduce code: --- 0) { ob_end_flush(); } } var_dump(ob_start(array('non_existent', 'f'))); checkAndClean(); var_dump(ob_start(array('non_existent', 'f', 'f'))); checkAndClean(); var_dump(ob_start('non_existent,f')); checkAndClean(); var_dump(ob_start('non_existent,f,f')); //bug: expecting false with no output buffers. Actually returns true and initialises 2 output buffers. checkAndClean(); ?> Expected result: bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) Actual result: -- bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(true) Array ( [0] => f [1] => f ) -- Edit this bug report at http://bugs.php.net/?id=42641&edit=1
#42641 [Opn]: ob_start(): inconsistent behaviour with undefined callbacks
ID: 42641 User updated by: robin_fernandes at uk dot ibm dot com Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Output Control Operating System: Windows PHP Version: 5CVS-2007-09-12 (snap) New Comment: OK. On this subject, I think I'm running into a few other output buffering issues which seem to be fixed in the php6 snaps. Some of these are illustrated by tests in HEAD that fail on php5 snaps, e.g. http://lxr.php.net/source/php-src/tests/output/ob_017.phpt . Should I raise bugs against php5, or is there a plan to backport some output buffering code from HEAD to php5? Previous Comments: [2007-09-13 19:05:24] [EMAIL PROTECTED] This undocumented behaviour does not exist in any way in HEAD any longer. The implementation seemed questionable, as an array as parameter usually indicates a method callback. [2007-09-13 09:22:07] [EMAIL PROTECTED] Yeah, now that I took a closer look I can see there's something like this implemented..I wonder when/why. :) Please don't open documentation issue yet. [2007-09-12 14:06:29] robin_fernandes at uk dot ibm dot com Hi, Thanks for your reply. As documentation isn't always complete/up to date, I looked at the implementation of ob_start() to understand its behaviour. The code in the 5.2 version of php_ob_init() in output.c splits strings on ',' and attempts to process each part seaparately (line 485). For arrays, if a pair does not represent a method, a comment explicitly states "init all array elements recursively" (line 516). The prototype in the 5.2 code currently looks like this: bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]]) The following testcase shows this behaviour in action: http://pastebin.com/f4f15a025 Regarding tuning up the error message display params, I'm currently using: error_reporting = E_ALL | E_STRICT / display_errors = 1 . Would you expect see warnings/notices with my testcase? I'll happily raise a documentation bug to ensure this is covered. Alternatively, perhaps the fact that this behaviour is available is itself a bug? Note that this is raised against php5 (not 6 where the output buffering implementation seems to be a bit different). [2007-09-12 11:17:04] [EMAIL PROTECTED] Let's start with the prototype for this function: bool ob_start ( [callback $output_callback [, int $chunk_size [, bool $erase]]] ) The first parameter is "callback" type, so it expects either a string (function name) or array (object, method). More information about "callback" pseudo-type: http://www.php.net/callback I don't know where you got the idea that you can pass multiple callbacks in there. It's not said to work like that anywhere in the manual at least. :) Please fix your example script accordingly (and tune up your display_errors / error_reporting levels..). ---------------------------- [2007-09-12 09:15:35] robin_fernandes at uk dot ibm dot com Description: ob_start() can initialize multiple output buffers in a single call using a comma delimited list of output callbacks, as follows: ob_start('f,f,f'); where function f() is a defined function. However, behaviour when passing an undefined callback is inconsistent: ob_start('non_existent,f'); returns false and initializes no output buffers, whereas ob_start('non_existent,f,f'); returns true and initializes 2 output buffers with f as a callback. Using arrays, the behaviour is consistent. The following both return false and initialize no output buffers: ob_start(array('non_existent', 'f')); ob_start(array('non_existent', 'f', 'f')); Tested on Windows XP on PHP 5.2.5-dev (cli) (built: Sep 12 2007 04:04:36). Reproduce code: --- 0) { ob_end_flush(); } } var_dump(ob_start(array('non_existent', 'f'))); checkAndClean(); var_dump(ob_start(array('non_existent', 'f', 'f'))); checkAndClean(); var_dump(ob_start('non_existent,f')); checkAndClean(); var_dump(ob_start('non_existent,f,f')); //bug: expecting false with no output buffers. Actually returns true and initialises 2 output buffers. checkAndClean(); ?> Expected result: bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) Actual result: -- bool(false) Array ( ) bool(false) Array ( ) bool(false) Array ( ) bool(true) Array ( [0] => f [1] => f ) -- Edit this bug report at http://bugs.php.net/?id=42641&edit=1
#42852 [NEW]: Inconsistent message when creating default object from empty value
From: robin_fernandes at uk dot ibm dot com Operating system: PHP version: 5CVS-2007-10-04 (snap) PHP Bug Type: Scripting Engine problem Bug description: Inconsistent message when creating default object from empty value Description: This is a minor inconsistency in error reporting. When a stdClass instance is implicitly created, in some cases an E_STRICT is emitted but in other cases not. Reproduce code: --- p = 1; echo "\nAbout to create a default object from empty value again:\n"; $obj2->p[] = 1; echo "\nAbout to create a default object from empty value one more time:\n"; $a = 1; $obj3->p = &$a; ?> Expected result: About to create a default object from empty value: Strict Standards: Creating default object from empty value in %s on line 3 About to create a default object from empty value again: Strict Standards: Creating default object from empty value in %s on line 5 About to create a default object from empty value one more time: Strict Standards: Creating default object from empty value in %s on line 8 Actual result: -- About to create a default object from empty value: Strict Standards: Creating default object from empty value in %s on line 3 About to create a default object from empty value again: About to create a default object from empty value one more time: -- Edit bug report at http://bugs.php.net/?id=42852&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42852&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42852&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42852&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42852&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42852&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42852&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42852&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42852&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42852&r=support Expected behavior:http://bugs.php.net/fix.php?id=42852&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42852&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42852&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42852&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42852&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42852&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42852&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42852&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42852&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42852&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42852&r=mysqlcfg
#42976 [NEW]: ReflectionClass::newInstance[Args]() crashes if ctor takes arg by reference
From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5CVS-2007-10-15 (snap) PHP Bug Type: Reproducible crash Bug description: ReflectionClass::newInstance[Args]() crashes if ctor takes arg by reference Description: In some cases, ReflectionClass::newInstance() and ReflectionClass::newInstanceArgs() can trigger a segmentation fault when the constructor of the reflected class takes arguments by reference. Tested on PHP 5.2.5-dev (cli) (built: Oct 15 2007 12:04:27) on Win XP. Reproduce code: --- newInstance($x); // causes crash var_dump($x); $x = "x.original"; $rc->newInstanceArgs(array($x)); // causes crash var_dump($x); ?> Expected result: string(9) "x.changed" string(9) "x.changed" string(10) "x.original" Actual result: -- string(9) "x.changed" *CRASH* -- Edit bug report at http://bugs.php.net/?id=42976&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42976&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42976&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42976&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42976&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42976&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42976&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42976&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42976&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42976&r=support Expected behavior:http://bugs.php.net/fix.php?id=42976&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42976&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42976&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42976&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42976&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42976&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42976&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42976&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42976&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42976&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42976&r=mysqlcfg