From: myle34 at hotmail dot com
Operating system: Windows XP Home
PHP version: 5.0.0b2 (beta2)
PHP Bug Type: Variables related
Bug description: Global vs. class vs. variable scope w/ include

Description:
------------
This is related to Bug #26173 ([url]http://bugs.php.net/bug.php?id=26173[/url]) but
the reproduce code was wrong.

I am using Windows XP Home and Apache 2.0.47 with PHP beta 2.

This bug is related to function/class/global scopes.

Note that if you merge foo.php and bar.php (foo.php and right after that
bar.php) (ie. without the include_once), this will work as expected!

I haven't tested this with include but I suspect it would have the same
problem.

Reproduce code:
---------------
// foo.php
<?php
class TestOne {
function __construct() { include_once 'bar.php'; }
}
$TestOne = new TestOne();
?>

// bar.php
<?php
// uncommenting this makes it work
// global $foo;
$foo = 'bar';
// uncommenting this does nothing
// global $foo;
function TestTwo() {
global $foo; echo $foo;
}
Tesl'><();
?>

Expected result:
----------------
bar

Actual result:
--------------
No output

--
Edit bug report at [url]http://bugs.php.net/?id=26174&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=26174&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=26174&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=26174&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=26174&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=26174&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=26174&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=26174&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=26174&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=26174&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=26174&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=26174&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=26174&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=26174&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=26174&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=26174&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=26174&r=float[/url]