Bug #17569 Updated: array_push creates array if var is not set

From: Date: Sun, 02 Jun 2002 23:48:45 +0000
Subject: Bug #17569 Updated: array_push creates array if var is not set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9257@lists.php.net to get a copy of this message
ID: 17569 Updated by: mfischer@php.net Reported By: tim@timcrider.com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.2.1 New Comment: No, it should not. It's up to the user to pass an array to the function. Use is_array() to check if it's actually an array you pass or not. Previous Comments: ------------------------------------------------------------------------ [2002-06-02 19:47:14] tim@timcrider.com Right now if you call array_push and the array parameter is not set, it gives the error Warning: First argument to array_push() needs to be an array in FILE on line NUM array_push should check to see if the variable is set or NULL. Only if it is NULL should it create a new array. If there is already something assigned to the var it should do nothing. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17569&edit=1

« previous php.bugs (#9257) next »