php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4293 global doesn't work with class references but $GLOBALS do
Submitted: 2000-05-02 10:36 UTC Modified: 2000-05-31 10:21 UTC
From: frip at bigfoot dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Release Candidate 1 OS: AIX 4.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: frip at bigfoot dot com
New email:
PHP Version: OS:

 

 [2000-05-02 10:36 UTC] frip at bigfoot dot com
global $ACTUAL_FORM;

$form = new my_class;
    
$GLOBALS["ACTUAL_FORM"] = &$form;
#$ACTUAL_FORM = &$form;

If we consider both lines equivalent for any other kind of variables, the second one doesn't work for class references.

Here are my compilation options:

Configure command: './configure' '--with-apache=../apache_1.3.12' '--enable-track-vars'
'--prefix=/soft/php-4.0RC1' '--with-yp' '--with-sybase-ct=/soft/sybase'
'--with-ldap=/soft/openldap-1.2.1' '--with-gdbm=/soft/gdbm-1.7.3' '--with-gd=/soft/gd-1.7.3'
'--with-zlib=/soft/zlib-1.1.3' '--enable-sysvshm' '--enable-sysvsem' '--enable-xml'
'--with-mysql=/soft/mysql-3.22.27' '--enable-trans-sid' '--disable-debug'

Greetings

Frip'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-31 10:21 UTC] stas at cvs dot php dot net
Not a bug. This is how it should work.
global $ACTUAL_FORM assigns local variable to be reference to global one.
If you re-assign it with another reference, it loses previous assignment.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 14:01:37 2025 UTC