|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-11 12:50 UTC] tony2001@php.net
[2005-08-11 22:47 UTC] leon at lost dot co dot nz
[2005-08-11 23:18 UTC] tony2001@php.net
[2005-08-11 23:22 UTC] leon at lost dot co dot nz
[2005-08-11 23:33 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
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 ---------------------------------------