#30407 [Asn->Csd]: Strange behaviour of default arguments

From: Date: Thu, 10 Feb 2005 11:45:54 +0000
Subject: #30407 [Asn->Csd]: Strange behaviour of default arguments
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73743@lists.php.net to get a copy of this message
ID: 30407 Updated by: dmitry@php.net Reported By: guth at fiifo dot u-psud dot fr -Status: Assigned +Status: Closed Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 5CVS-2004-10-12 (dev) Assigned To: dmitry New Comment: Fixed in CVS HEAD. Previous Comments: ------------------------------------------------------------------------ [2005-02-09 02:04:03] tony2001@php.net Still reproducible with 5.1-dev. Dmitry, could you have a look at it? IMO it should be similar to recently fixed __set/__get bug. ------------------------------------------------------------------------ [2004-10-12 10:43:52] guth at fiifo dot u-psud dot fr Description: ------------ After your asked me to try an other bug with PHP 5.1.0, i tryed to run my unit tests on it. All passes, except the following. I don't know if it's a new PHP 5.1.0 feature, but i don't think that this behaviour is really useful and it can be very confusing too. PHP version : php5-200410111030 Reproduce code: --------------- <?php function haricow($a = 'one') { var_dump($a); $a = 'two'; } haricow(); haricow(); Expected result: ---------------- string(3) "one" string(3) "one" Actual result: -------------- string(3) "one" string(3) "two" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30407&edit=1

« previous php.bugs (#73743) next »