From: minimoose at balpoint dot com
Operating system: Windows XP Professional
PHP version: 5.0.0b4 (beta4)
PHP Bug Type: Zend Engine 2 problem
Bug description: Code declaration order
Description:
------------
The order in which php code (a class) is declared and referenced in the
sourcefile causes a compile error if not properly considered.
In PHP 4, declaring a class after referencing it posed no problem. In PHP
5 it generates a compile error.
Reproduce code:
---------------
<?php
$myinst = new myClass();
echo $myinst->myvar;
class myClass {
public $myvar;
function __construct()
{
$this->myvar = "initial value";
}
}
?>
Expected result:
----------------
"Initial value" should be printed to the output window/page/console.
Actual result:
--------------
<b>Fatal error</b>: Class 'myClass' not found in <b>C:\myClass.php</b> on
line <b>2</b><br />
--
Edit bug report at http://bugs.php.net/?id=27255&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27255&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27255&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27255&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27255&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27255&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27255&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27255&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27255&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27255&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27255&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27255&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27255&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27255&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27255&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27255&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27255&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27255&r=float