Edit report at http://bugs.php.net/bug.php?id=53936&edit=1
ID: 53936 Updated by: m...@php.net Reported by: sven at democopei dot de Summary: Literal empty array returns NULL. -Status: Open +Status: Feedback Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: I cannot reproduce this with the code below. Are you running some extension like APC or Zend Guard that mangles/optimizes the code for you? <?php function &foo_to_array (&$x) { $array_to_return = array(); return $array_to_return; } $x = ""; var_dump(foo_to_array($x)); Previous Comments: ------------------------------------------------------------------------ [2011-02-06 03:33:01] sven at democopei dot de Description: ------------ For some reason I cannot figure out, array() doesn't give me an empty array anymore but NULL. (References are used for good reasons, btw.) Test script: --------------- function &foo_to_array (&$x) { $array_to_return = array (); // Works the first couple of times, then NULLs. // add foo elements to array return $array_to_return; } Introducing some wrapper doesn't help either -- an array is actually created but NULL is returned anyway: function make_array () { return array (); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53936&edit=1