Bug #12790: Can't access global vars in a class method
| From: | jean-gael at rouchon dot org | Date: | Thu, 16 Aug 2001 12:35:29 +0000 |
| Subject: | Bug #12790: Can't access global vars in a class method | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-63424@lists.php.net to get a copy of this message | ||
From: jean-gael@rouchon.org
Operating system: solaris7
PHP version: 4.0.6
PHP Bug Type: Class/Object related
Bug description: Can't access global vars in a class method
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.
--
Edit bug report at: http://bugs.php.net/?id=12790&edit=1