From:             guth at fiifo dot u-psud dot fr
Operating system: Linux
PHP version:      5CVS-2004-10-12 (dev)
PHP Bug Type:     Unknown/Other Function
Bug description:  Strange behaviour of default arguments

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 bug report at http://bugs.php.net/?id=30407&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30407&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30407&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30407&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30407&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30407&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30407&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30407&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30407&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30407&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30407&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30407&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30407&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30407&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30407&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30407&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30407&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30407&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30407&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30407&r=mysqlcfg

Reply via email to