Bug #80941 [NEW]: function __construct() don't pass $var to context GLOBAL
From: rg at mejoramos dot com
Operating system: any
PHP version: 8.0.3
Package: Output Control
Bug Type: Bug
Bug description:function __construct() don't pass $var to context GLOBAL
Description:
------------
no't possible pass $VAR to GLOBAL context without used ARRAY $GLOBALS,
please see the code.
Test script:
---------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
function OtherFunction(){
GLOBAL $ManyFunctionsNeedThisVar;
print_r($GLOBALS['a']);
print_r($ManyFunctionsNeedThisVar);
}
class OtherClass{
function __construct(){
$GLOBALS['a'] = 888;
$ManyFunctionsNeedThisVar = 777;
OtherFunction();
}
}
$OtherObject = new OtherClass();
Expected result:
----------------
String concatenated, correct output:
888777
Actual result:
--------------
888
--
Edit bug report at https://bugs.php.net/bug.php?id=80941&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80941&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80941&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80941&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80941&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80941&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80941&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80941&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80941&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80941&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80941&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80941&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80941&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80941&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80941&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80941&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80941&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80941&r=mysqlcfg
Thread (5 messages)
- rg at mejoramos dot com