From: leon at lost dot co dot nz Operating system: Debian Sarge (2.6.12 kernel) PHP version: 5CVS-2005-08-11 (dev) PHP Bug Type: Scripting Engine problem Bug description: Reflection API problems in methods with boolean or null default values
Description: ------------ This problem came up when moving our homebrew 'PHPDoc' type class to PHP5.1. When built with --enable-debug PHP throws up warnings up when the class to be documented ('A' below) contains methods with default values that are either NULL or boolean In the code snippet below we get two warnings, one for each default parameter. Changing the default values to a string or number (even zero) eliminates the warnings. This is a serious problem for us. When documenting some of our bigger classes we have seen lots of 'odd' behaviour, including permanent 100% CPU usage by Apache! It has taken *days* to track down the problem to the snippet below. If there is anything elso I can do to help fix it please let me know... Reproduce code: --------------- $r = new ReflectionClass('A'); $methods = $r->getMethods(); foreach($methods as $method) { $parameters = $method->getParameters(); foreach($parameters as $p) { if($p->isDefaultValueAvailable()) $p->getDefaultValue(); } } class A { function foo($p=null, $q=false) { } } Expected result: ---------------- No output at all -- I've trimed all the output code out. Actual result: -------------- $ php bug2.php Warning: String is not zero-terminated (ZZZZZÌ*) (source: /tmp/php5-200508110030/Zend/zend_variables.h:35) in Unknown on line 0 [Thu Aug 11 13:18:58 2005] Script: 'bug2.php' --------------------------------------- /tmp/php5-200508110030/Zend/zend_variables.h(35) : Block 0x08514F30 status: /tmp/php5-200508110030/Zend/zend_variables.c(36) : Actual location (location was relayed) Beginning: Cached (allocated on Zend/zend_language_scanner.c:4689, 5 bytes) End: OK --------------------------------------- Warning: String is not zero-terminated (ZZZZZZÌ*) (source: /tmp/php5-200508110030/Zend/zend_variables.h:35) in Unknown on line 0 [Thu Aug 11 13:18:58 2005] Script: 'bug2.php' --------------------------------------- /tmp/php5-200508110030/Zend/zend_variables.h(35) : Block 0x085150C8 status: /tmp/php5-200508110030/Zend/zend_variables.c(36) : Actual location (location was relayed) Beginning: Cached (allocated on Zend/zend_language_scanner.c:4689, 6 bytes) End: OK --------------------------------------- -- Edit bug report at http://bugs.php.net/?id=34078&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34078&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34078&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34078&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34078&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34078&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34078&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34078&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34078&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34078&r=support Expected behavior: http://bugs.php.net/fix.php?id=34078&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34078&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34078&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34078&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34078&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34078&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34078&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34078&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34078&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34078&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34078&r=mysqlcfg