PHP 4.0 Bug #2036: "Fatal error on line 0" with class definitions
| From: | weyrick at roadsend dot com | Date: | Wed, 11 Aug 1999 20:49:47 +0000 |
| Subject: | PHP 4.0 Bug #2036: "Fatal error on line 0" with class definitions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9761@lists.php.net to get a copy of this message | ||
From: weyrick@roadsend.com
Operating system: Linux saidin 2.3.2 #1 SMP Sun May 16 22:04:16 EDT 1999 i686 unknown
PHP version: 4.0 Beta 2
PHP Bug Type: Scripting Engine problem
Bug description: "Fatal error on line 0" with class definitions
when the following code is run w/ display_errors on and error_reporting 65527 the following error is
generated:
Fatal error: Cannot redeclare class testclass in
/opt/apache2/htdocs/chat/debug/crash.php on line 0
The script stops execution immediately after the first (and only) definition of testClass
<?
class arrayClass {
var $myArray;
function add($key, $val) {
$this->myArray[$key] = $val;
}
function output() {
echo "size of myArray is
".sizeof($this->myArray)."\n\n<br><br>";
foreach($this->myArray as $k => $v) {
echo "$k => $v<br>\n";
}
}
}
/* putting this call here would execute php info correctly */
/* phpinfo(); */
/* execution aborts after compiling this class?? */
class testClass {
var $myArrayClass;
/* constructor ... */
function testClass() {
$this->myArrayClass = new arrayClass;
}
}
/* the script never reaches this point, the server simply returns
document contained no data
*/
phpinfo();
class mainClass {
var $myTestClass;
function newClass() {
$this->myTestClass = new testClass;
return $this->myTestClass->myArrayClass;
}
function output() {
$this->myTestClass->myArrayClass->output();
}
}
$myMainClass = new mainClass;
$arrayTestClass = $myMainClass->newClass();
$arrayTestClass->add("test1","val1");
$arrayTestClass->add("test2","val2");
$myMainClass->output();
?>