ID:               34078
 Updated by:       [EMAIL PROTECTED]
 Reported By:      leon at lost dot co dot nz
-Status:           Open
+Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: Debian Sarge (2.6.12 kernel)
 PHP Version:      5CVS-2005-08-11 (dev)
-Assigned To:      
+Assigned To:      tony2001
 New Comment:

The fix is ready, but we have to wait for Andrey & Dmitry to finish
merging of Unicode patches.


Previous Comments:
------------------------------------------------------------------------

[2005-08-11 03:37:24] leon at lost dot co dot nz

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 this bug report at http://bugs.php.net/?id=34078&edit=1

Reply via email to