ID:               39597
 Updated by:       [EMAIL PROTECTED]
 Reported By:      marcus3v at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Windows 9x/XP
 PHP Version:      5.2.0
 New Comment:

>I have posted here because it appears that this extension >( ActivePHP
) have been a little "abandoned".

That doesn't mean you should report this issue twice.
Abandoned means abandoned. You can try to contact the author directly
and if that doesn't help - we can't help you, sorry.


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 22:45:56] marcus3v at hotmail dot com

Description:
------------
Dear Sirs,

It seems that there is a serious Variable Scope bug when PHP ( v5.2 )
Scripts are executed in the ActivePHP Environment. The problem is as
follows:

# 1 -- when a Variable is declared in Global Scope Statements without
explicit use of the "$GLOBALS" Array, it not really becomes Global and
can't be seen within Functions through the "global" Keyword nor
"$GLOBALS";
# 2 -- conversely, a Variable declared with explicit use of "$GLOBALS"
in Global Scope Statements can be seen within Functions, but isn't
visible for the own Global Scope Statements ( it's required use of
"$GLOBALS"... This also occurs when the declaration is done within a
Function -- through "$GLOBALS" ).

I have employed a "php5activescript.dll" version 5.2.0.0 ( 53.314bytes.
It's that one distributed with the "pecl-5.2.0-Win32.zip" package ) on
Windows 9x and XP.

# Obs.: since this is a PECL issue, it should be posted on the PECL Bug
Tracking System. It was also posted there... I have posted here because
it appears that this extension ( ActivePHP ) have been a little
"abandoned": on "pecl.php.net", the link to the latest package is
broken; the only actual source for the compiled DLL is
"pecl4win.php.net"... Thus, by the way of the uncertainty, I have
posted here ( maybe you have some direct and special contact with the
extension's developer... ).

Reproduce code:
---------------
function varsGlbTest()
{
global $varGlb0, $varGlb1;
/*######*/ $WScript->Echo("varsGlbTest() -- varGlb0= '".$varGlb0."'");
/*######*/ $WScript->Echo("varsGlbTest() -- \$GLOBALS['varGlb0']=
'".$GLOBALS["varGlb0"]."'");
/*######*/ $WScript->Echo("varsGlbTest() -- varGlb1= '".$varGlb1."'");
$GLOBALS["varGlb2"]="[varGlb2]";
global $varGlb2;
/*######*/ $WScript->Echo("varsGlbTest() -- varGlb2= '".$varGlb2."'");
}


$varGlb0="[varGlb0]";
$GLOBALS["varGlb1"]="[varGlb1]";
/*######*/ $WScript->Echo("[global] -- varGlb0= '".$varGlb0."'");
/*######*/ $WScript->Echo("[global] -- varGlb1= '".$varGlb1."'");
/*######*/ $WScript->Echo("[global] -- \$GLOBALS['varGlb1']=
'".$GLOBALS["varGlb1"]."'");
varsGlbTest();
/*######*/ $WScript->Echo("[global] -- varGlb2= '".$varGlb2."'");
/*######*/ $WScript->Echo("[global] -- \$GLOBALS['varGlb2']=
'".$GLOBALS["varGlb2"]."'");

Expected result:
----------------
The output should be the following:

# [global] -- varGlb0= '[varGlb0]'
# [global] -- varGlb1= '[varGlb1]'
# [global] -- $GLOBALS['varGlb1']= '[varGlb1]'
# varsGlbTest() -- varGlb0= '[varGlb0]'
# varsGlbTest() -- $GLOBALS['varGlb0']= '[varGlb0]'
# varsGlbTest() -- varGlb1= '[varGlb1]'
# varsGlbTest() -- varGlb2= '[varGlb2]'
# [global] -- varGlb2= '[varGlb2]'
# [global] -- $GLOBALS['varGlb2']= '[varGlb2]'

Actual result:
--------------
The observed output is the following:

# [global] -- varGlb0= '[varGlb0]'
# [global] -- varGlb1= '' ( "varGlb1" is NULL ( it was not yet assigned
) )
# [global] -- $GLOBALS['varGlb1']= '[varGlb1]' ( ?!... )
# varsGlbTest() -- varGlb0= '' ( "varGlb0" is NULL ( has been it
assigned to NULL?... ) )
# varsGlbTest() -- $GLOBALS['varGlb0']= '' ( [idem] )
# varsGlbTest() -- varGlb1= '[varGlb1]'
# varsGlbTest() -- varGlb2= '[varGlb2]'
# [global] -- varGlb2= '' ( "varGlb2" is NULL ( it was not yet assigned
) )
# [global] -- $GLOBALS['varGlb2']= '[varGlb2]' ( ?!... )


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39597&edit=1

Reply via email to