|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-08-14 07:09 UTC] zeev at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 02:00:01 2025 UTC |
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(); ?>