php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38185 variables not set from function
Submitted: 2006-07-22 10:39 UTC Modified: 2006-07-23 12:23 UTC
From: martin dot dreier at web dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.1.4 OS: Mac OS X 10.4.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martin dot dreier at web dot de
New email:
PHP Version: OS:

 

 [2006-07-22 10:39 UTC] martin dot dreier at web dot de
Description:
------------
When trying to set a variable from a function return value, 
this variable is not set. I am using a local Apache 1.3.3 on a 
Mac OS X 10.4.7 Client.

Reproduce code:
---------------
<?php
$abc?= $_SERVER['HTTP_HOST'];
echo $_SERVER['HTTP_HOST'] . "x";
echo "/";
echo $abc . "y";
echo "/";
echo isset($abc) ? "yes" : "no";
echo "/";
$abc = "abc";
echo $abc . "d";
exit;
?>

Expected result:
----------------
127.0.0.1x/127.0.0.1y/yes/abcd

Actual result:
--------------
127.0.0.1x/y/no/abcd

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-22 13:05 UTC] sniper@php.net
Works fine for me. Try adding error_reporting(E_ALL); as first line in your script and try again.
 [2006-07-23 12:05 UTC] martin dot dreier at web dot de
With error_reporting(E_ALL), output is now:

localhostx/
Notice: Undefined variable: abc in /Library/WebServer/
Documents/dCMS/test.php on line 6
y/no/abcd
 [2006-07-23 12:23 UTC] martin dot dreier at web dot de
Well, somehow the caracter '?' got in there, but was displayed 
as space in my editor.

<?php
$abc?= $_SERVER['HTTP_HOST'];
....

Works now. Sorry for the inconvenience.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 01:01:33 2025 UTC