|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-12-29 10:52 UTC] sebastian@php.net
Description:
------------
When a namespaced class extends an namespaced abstract class, the signature compatiblity check breaks.
Reproduce code:
---------------
test.php
<?php
require 'joinpoint.php';
require 'pointcut.php';
require 'read.php';
joinpoint.php
<?php
namespace GAP;
class JoinPoint
{
}
pointcut.php
<?php
namespace GAP;
abstract class Pointcut
{
abstract public function evaluate(JoinPoint $joinPoint);
}
read.php
<?php
namespace GAP::Pointcut::Attribute;
use GAP::Joinpoint;
use GAP::Pointcut;
class Read extends Pointcut
{
public function evaluate(JoinPoint $joinPoint)
{
}
}
Expected result:
----------------
No syntax error.
Actual result:
--------------
Fatal error: Declaration of GAP::Pointcut::Attribute::Read::evaluate() must be compatible with that of GAP::Pointcut::evaluate() in /home/sb/read.php on line 12
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 12:00:02 2025 UTC |
I think the issue lies in the following code in zend_compile.c: if (fe->common.type == ZEND_USER_FUNCTION && strchr(proto->common.arg_info[i].class_name, ':') == NULL && (colon = zend_memrchr(fe->common.arg_info[i].class_name, ':', fe->common.arg_info[i].class_name_len)) != NULL && strcmp(colon+1, proto->common.arg_info[i].class_name) == 0) { efree((char*)fe->common.arg_info[i].class_name); fe->common.arg_info[i].class_name = estrndup(proto->common.arg_info[i].class_name, proto->common.arg_info[i].class_name_len); fe->common.arg_info[i].class_name_len = proto->common.arg_info[i].class_name_len; } else { return 0; }