ID:               29885
 Updated by:       [EMAIL PROTECTED]
 Reported By:      nospamplease at veganismus dot ch
 Status:           Open
-Bug Type:         *General Issues
+Bug Type:         Documentation problem
 Operating System: WinXP
 PHP Version:      5.0.1
 New Comment:

PHP5's get_defined_vars() return's $GLOBALS, which is a recursive
array, which will cause count() to crash.

Moving this as a documentation bug.


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

[2004-08-29 23:42:53] nospamplease at veganismus dot ch

Description:
------------
it seems that you cant use any recursive function on get_defined_vars()
in PHP5. 

<?
$arr = get_defined_vars();
echo 'Number of Defined Vars: ';
echo count($arr,COUNT_RECURSIVE);
?>

in PHP4 this will output some integer like "199" as expected.
in PHP5 this doesnt even output any error report. I just get a
"connection closed by server" message or the like. When changing line 3
to 
<?
echo count($arr); // nonrecursive
?>
it outputs something like "7" (which seems to be correct). also if i
use any multi-dimensional array instead of get_defined_vars() the
result will be correct.

Reproduce code:
---------------
<?
$arr = get_defined_vars();
echo 'Number of Defined Vars: ';
echo count($arr,COUNT_RECURSIVE);
?>

Expected result:
----------------
Number of Defined Vars: 199

Actual result:
--------------
The result is nothing (no errormessage by PHP5 or Apache2) so the
acctualy displayed message depends on the browser: 
Modzilla: The document contains no data.
Opera: connection closed by server
M$IE: Page Cannot Be Displayed


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29885&edit=1

Reply via email to