Bug #53800 [NEW]: namespace, interfaces and classes
| From: | tommyhp2 at gmail dot com | Date: | Thu, 20 Jan 2011 22:53:13 +0000 |
| Subject: | Bug #53800 [NEW]: namespace, interfaces and classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-158036@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 2008 R2
PHP version: 5.3.5
Package: CGI related
Bug Type: Bug
Bug description:namespace, interfaces and classes
Description:
------------
The script works as expected when not using namespace. I get a fatal error
on my "class SimpleCommand extends Notifier implements ICommand, INotifier"
declaration.
Test script:
---------------
namespace org\puremvc\php\interfaces;
interface ICommand
{
function execute(INotification $notification);
}
interface INotifier
{
function sendNotification($notificationName, $body = null, $type =
null);
}
namespace org\puremvc\php\patterns\observer;
use org\puremvc\php\interfaces\INotifier;
class Notifier implements INotifier
{
public function __construct() { echo __METHOD__; }
public function sendNotification($notificationName, $body = null, $type =
null) { }
}
namespace org\puremvc\php\patterns\command;
use org\puremvc\php\interfaces\ICommand;
use org\puremvc\php\interfaces\INotifier;
use org\puremvc\php\patterns\observer\Notifier;
class SimpleCommand extends Notifier implements ICommand, INotifier
{
public function __construct() { parent::__construct(); echo ' -> '; echo
__METHOD__; }
function execute(INotification $notification) { }
}
echo '<br/>'; new \org\puremvc\php\patterns\observer\Notifier();
echo '<br/>'; new \org\puremvc\php\patterns\command\SimpleCommand();
Expected result:
----------------
org\puremvc\php\patterns\observer\Notifier::__construct
org\puremvc\php\patterns\observer\Notifier::__construct ->
org\puremvc\php\patterns\command\SimpleCommand::__construct
Actual result:
--------------
Fatal error: Declaration of
org\puremvc\php\patterns\command\SimpleCommand::execute() must be
compatible with that of org\puremvc\php\interfaces\ICommand::execute() on
line 21
--
Edit bug report at http://bugs.php.net/bug.php?id=53800&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53800&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53800&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53800&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53800&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53800&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53800&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53800&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53800&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53800&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53800&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53800&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53800&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53800&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53800&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53800&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53800&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53800&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53800&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53800&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53800&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53800&r=mysqlcfg