Bug #64299 [Com]: Global variables not visible when using CLI
Edit report at https://bugs.php.net/bug.php?id=64299&edit=1
ID: 64299
Comment by: anon at anon dot anon
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:
@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?
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)