#35634 [Opn->Bgs]: Erroneous "Class declarations may not be nested" error raised.
| From: | sniper@php.net | Date: | Sun, 11 Dec 2005 22:20:01 +0000 |
| Subject: | #35634 [Opn->Bgs]: Erroneous "Class declarations may not be nested" error raised. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-90249@lists.php.net to get a copy of this message | ||
ID: 35634
Updated by: sniper@php.net
Reported By: robert at interjinn dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.1.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-12-11 19:15:37] robert at interjinn dot com
Description:
------------
PHP bails out with class declaration nesting error when an error
handler dynamically loads an error handling class during a class
related E_STRICT warning.
Reproduce code:
---------------
test.php
<?php
set_error_handler( 'errorHandler' );
function errorHandler
( $errorNumber, $errorMessage, $fileName, $lineNumber )
{
require_once( 'errorClass.php' );
$error = new ErrorClass();
$error->handleException(
$errorNumber, $errorMessage, $fileName, $lineNumber );
}
require_once( 'testClass.php' );
$test = new TestClass();
?>
-------------------------------------------------
testClass.php
<?php
class TestClass
{
function __construct()
{
}
function TestClass()
{
$this->__construct();
}
}
?>
-------------------------------------------------
errorClass.php
<?php
class ErrorClass
{
function handleException
( $errorNumber, $errorMessage, $fileName, $lineNumber )
{
echo "Error: [$errorNumber] $errorMessage
($fileName:$lineNumber)\n";
}
}
?>
Expected result:
----------------
I expect to properly be able to handle the following E_STRICT in my
custom error class:
<br />
<b>Strict Standards</b>: Redefining already defined constructor for
class TestClass in <b>/home/suds/testClass.php</b> on line <b>9</b><br
/>
Actual result:
--------------
Fatal error: Class declarations may not be nested in
/home/suds/errorClass.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35634&edit=1