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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC