Edit report at http://bugs.php.net/bug.php?id=53936&edit=1
ID: 53936 User updated by: sven at democopei dot de Reported by: sven at democopei dot de Summary: Literal empty array returns NULL. -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Couldn't find anything to help finding the buggy spot. Rewrote my thing without pass-by-reference and it now works nicely. Sorry. Previous Comments: ------------------------------------------------------------------------ [2011-02-07 17:49:52] sven at democopei dot de No, I'm sorry. I don't use any extensions or Zend. As I said, I cannot boil this down to its essence - I have some very large, generated PHP script I'm willing to send you via PM, though. ------------------------------------------------------------------------ [2011-02-07 10:54:54] m...@php.net 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)); ------------------------------------------------------------------------ [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