php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12790 Can't access global vars in a class method
Submitted: 2001-08-16 08:35 UTC Modified: 2001-10-21 20:24 UTC
From: jean-gael at rouchon dot org Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.6 OS: solaris7
Private report: No CVE-ID: None
 [2001-08-16 08:35 UTC] jean-gael at rouchon dot org
Using PHP4.06 on solaris 7 and SiteManager (www.roadsend.com) as framework.

I can't access global vars in a class method when it is defined  in an external file.
Am I doing something wrong, or is this a "new feature" ?
(Think it was working in old PHP versions)

here is the code :
I've defined an array variable in a file (mime.php)
<?php  //mime.php
$mime_types =
array(
      TYPETEXT => 'text', 'text' => TYPETEXT,
      TYPEMULTIPART => 'multipart', 'multipart' => TYPEMULTIPART,
      TYPEMESSAGE => 'message', 'message' => TYPEMESSAGE
      );
?>

And the business part
<?php
require_once("mime.php");
class wmMessageHeaderParts extends SM_module {
[ ... ]

  function moduleThink() {
      global $mime_types, $SM_siteManager;
  	if(isset($mime_types)) echo("-- OK --");
  } //end module think
}
?>
$mime_types doesn't seem to be set.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-21 20:24 UTC] sniper@php.net
Works for me just fine with PHP 4.1.0RC1.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 20:01:31 2024 UTC