#34124 [Opn->Bgs]: array_push() fails when the array doesn't exist
| From: | tony2001@php.net | Date: | Sat, 13 Aug 2005 13:19:29 +0000 |
| Subject: | #34124 [Opn->Bgs]: array_push() fails when the array doesn't exist | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83532@lists.php.net to get a copy of this message | ||
ID: 34124
Updated by: tony2001@php.net
Reported By: ondrej at sury dot org
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.0.4
New Comment:
Ever tried to set display_errors to On and error_reporting to E_ALL ?
This is what your code outputs.:
Warning: array_push(): First argument should be an array in ..
I don't see any bugs here.
Previous Comments:
------------------------------------------------------------------------
[2005-08-13 15:14:15] ondrej at sury dot org
Description:
------------
From http://bugs.debian.org/289244:
array_push will not create new array when called with arg which is not
array type (or nonexistant).
This could be just documentation error to state, that new array won't
be created inside array_push().
I am not sure that there is easy fix inside PHP, since array parameter
in array_push is reference and not value. So it looks like that it
gets created inside array_push, but discarded (or leaked?) afterwards.
Reproduce code:
---------------
<?php
array_push ($foo, 1, 2, 3);
print ("bar $foo[0] baz\n");
?>
Expected result:
----------------
bar 1 baz
Actual result:
--------------
bar baz
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34124&edit=1