Bug #64299 [Opn->Nab]: Global variables not visible when using CLI
| From: | pajoye@php.net | Date: | Tue, 26 Feb 2013 04:16:17 +0000 |
| Subject: | Bug #64299 [Opn->Nab]: Global variables not visible when using CLI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177414@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
Updated by: pajoye@php.net
Reported by: andrew dot mof at gmail dot com
Summary: Global variables not visible when using CLI
-Status: Open
+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:
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.
Previous Comments:
------------------------------------------------------------------------
[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