Bug #64299 [Nab]: Global variables not visible when using CLI
| From: | andrew dot mof at gmail dot com | Date: | Thu, 28 Feb 2013 16:14:22 +0000 |
| Subject: | Bug #64299 [Nab]: Global variables not visible when using CLI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177466@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64299&edit=1
ID: 64299
User updated by: andrew dot mof at gmail dot com
Reported by: andrew dot mof at gmail dot com
Summary: Global variables not visible when using CLI
Status: Not a bug
Type: Bug
Package: Variables related
Operating System: Ubuntu 12.10
PHP Version: 5.4.12
Block user comment: N
Private report: N
New Comment:
All I can say is that the function cannot see the variable in CLI but can do when its run by apache,
which is why it confused me so much. My functions are being included in a seperate file, does this
affect the global scope in CLI?
Previous Comments:
------------------------------------------------------------------------
[2013-02-28 16:05:33] anon at anon dot anon
@pajoye: register_globals has nothing to do with this; what are you saying?
That said, the test script appears to work perfectly. How could it not?
------------------------------------------------------------------------
[2013-02-26 04:16:17] pajoye@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
There is no bug here. Works just fine.
------------------------------------------------------------------------
[2013-02-25 21:50:34] andrew dot mof at gmail dot com
Description:
------------
99% sure this is a bug. This code works fine when apache runs it but when I run it though CLI it
doesnt see the variable.
That said, this work:
$GLOBALS['jobID'] = 123;
Test script:
---------------
#!/usr/bin/php
<?php
// In my script this function is included in a seperate file
function addLine() {
global $jobID;
echo $jobID;
}
$jobID = 123;
addLine();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64299&edit=1