|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43703 Signature compatibility check broken for namespaces
Submitted: 2007-12-29 10:52 UTC Modified: 2008-01-09 07:58 UTC
From: Assigned: dmitry
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-12-29 (CVS) OS: Irrelevant
Private report: No CVE-ID:
 [2007-12-29 10:52 UTC]
When a namespaced class extends an namespaced abstract class, the signature compatiblity check breaks.

Reproduce code:
require 'joinpoint.php';
require 'pointcut.php';
require 'read.php';

namespace GAP;

class JoinPoint

namespace GAP;

abstract class Pointcut
    abstract public function evaluate(JoinPoint $joinPoint);

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-05 10:07 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) {
	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;
 [2008-01-09 07:58 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 11:01:54 2015 UTC