|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30407 Strange behaviour of default arguments
Submitted: 2004-10-12 10:43 UTC Modified: 2005-02-10 12:45 UTC
From: guth at fiifo dot u-psud dot fr Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-10-12 (dev) OS: Linux
Private report: No CVE-ID: None
 [2004-10-12 10:43 UTC] guth at fiifo dot u-psud dot fr
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:

function haricow($a = 'one') {
	$a = 'two';


Expected result:
string(3) "one"
string(3) "one"

Actual result:
string(3) "one"
string(3) "two"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-09 02:04 UTC]
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.
 [2005-02-10 12:45 UTC]
Fixed in CVS HEAD.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:25 2019 UTC