Bug #68910 [Opn->Nab]: Fatal error in case of using multiple namespaces with curly brackets.
| From: | nikic@php.net | Date: | Sun, 25 Jan 2015 15:20:04 +0000 |
| Subject: | Bug #68910 [Opn->Nab]: Fatal error in case of using multiple namespaces with curly brackets. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190214@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68910&edit=1
ID: 68910
Updated by: nikic@php.net
Reported by: yajenyak at yandex dot ru
Summary: Fatal error in case of using multiple namespaces
with curly brackets.
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Fedora 21
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
This has nothing to do with namespaces. Your classes are in the wrong order. You're using the
Handler\MailHandler class before it is defined.
Previous Comments:
------------------------------------------------------------------------
[2015-01-25 15:08:01] yajenyak at yandex dot ru
Description:
------------
Please try to run the following code. As result the following error will be displayed:
"Fatal error: Class 'Monolog\Handler\MailHandler' not found in
/home/user/project/test/index.php on line 6"
If you will try to remove the " extends AbstractProcessingHandler" part the error will not
be displayed.
This error prevents us to combine multiple classes to single file for performance optimization.
Test script:
---------------
<?php
namespace My\Logger {
use Monolog\Handler\MailHandler as BaseMailHandler;
class MailHandler extends BaseMailHandler
{
}
}
namespace Monolog\Handler {
abstract class MailHandler extends AbstractProcessingHandler
{
}
}
namespace Monolog\Handler {
abstract class AbstractProcessingHandler
{
}
}
Expected result:
----------------
No error
Actual result:
--------------
Fatal error: Class 'Monolog\Handler\MailHandler' not found in
/home/user/project/test/index.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68910&edit=1