PHP 4.0 Bug #2589: reference inconsistency
| From: | hholzgra at media-engineering dot de | Date: | Fri, 22 Oct 1999 16:33:59 +0000 |
| Subject: | PHP 4.0 Bug #2589: reference inconsistency | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11837@lists.php.net to get a copy of this message | ||
From: hholzgra@media-engineering.de
Operating system: redhat 6.0
PHP version: 4.0 Beta 2
PHP Bug Type: Scripting Engine problem
Bug description: reference inconsistency
Assigning by reference to a variable passed by reference
to a function works only inside the function but not
outside
<?
function testme(&$ref1,&$ref2)
{
global $top;
$ref1 = $top;
$ref2 = &$top;
print "top:'".$top.
"' ,ref1:'".$ref1.
"' ,ref2:'".$ref2.
"'<br>";
}
$top = "hallo";
$x="x is unchanged";
$y="y is unchanged";
testme($x,$y);
print "top:'".$top."', x:'".$x."',
y:'".$y."'<br>";
?>
prints
top:'hello' ,ref1:'hello' ,ref2:'hello'
top:'hello', x:'hello', y:'y is unchanged'
instead if the expected
top:'hello' ,ref1:'hello' ,ref2:'hello'
top:'hello', x:'hello', y:'hello'
--- 8< --- configure'd with:
./configure --with-mysql --enable-track-vars --with-imap
--- 8< --- php.ini looks like this
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = Off
safe_mode = Off
highlight.string = #DD0000
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg = #FFFFFF
highlight.default = #0000BB
highlight.html = #000000
allow_builtin_links = Off
max_execution_time = 30
memory_limit = 8388608
error_reporting = 7
display_errors = On
log_errors = Off
track_errors = Off
warn_plus_overloading = Off
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
track_vars = Off
[Syslog]
define_syslog_variables = Off
[mail function]
SMTP = localhost
sendmail_from = me@localhost.com
sendmail_path = /usr/lib/sendmail -t
[Debugger]
debugger.host = localhost
debugger.port = 7869
debugger.enabled = False
[SQL]
sql.safe_mode = Off
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
[Session]
session.save_handler = files
session.save_path = /tmp
session.name = PHPSESSID
session.auto_start = 0
session.lifetime = 0
session.serialize_handler = php
session.gc_probability = 10
session.gc_maxlifetime = 1800