From: phpbug at billix dot franken dot de
Operating system: Linux
PHP version: 4.3.5RC2
PHP Bug Type: Variables related
Bug description: global variable changing type when passed to function by value...
Description:
------------
when I pass a variable of type string to a function (by
value not by reference!) and modify the local parameter,
the type of the global variable changes from string to int
although the local variable is still a string!
./configure --disable-cgi --enable-cli
No changes made to php-ini-dist
This worked as expected in PHP 4.3.5RC1 and earlier.
Reproduce code:
---------------
function foo ( $a )
{
print "foo(a)="; var_dump($a);
print "GLOBALS['x']="; var_dump($GLOBALS["x"]);
$a=sprintf("%02d",$a);
print "GLOBALS['x']="; var_dump($GLOBALS["x"]);
print "foo(a)="; var_dump($a);
}
print "PHP-Version:".phpversion()."\n";
$x="02";
print "x="; var_dump($x);
foo($x);
print "x="; var_dump($x);
Expected result:
----------------
PHP-Version:4.3.5RC1
x=string(2) "02"
foo(a)=string(2) "02"
GLOBALS['x']=string(2) "02"
GLOBALS['x']=string(2) "02"
foo(a)=string(2) "02"
x=string(2) "02"
Actual result:
--------------
PHP-Version:4.3.5RC2
x=string(2) "02"
foo(a)=string(2) "02"
GLOBALS['x']=string(2) "02"
GLOBALS['x']=int(2)
foo(a)=string(2) "02"
x=int(2)
--
Edit bug report at http://bugs.php.net/?id=27278&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27278&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27278&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27278&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27278&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27278&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27278&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27278&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27278&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27278&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27278&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27278&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27278&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27278&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27278&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27278&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27278&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27278&r=float