好了, 言归正传, 今天对PHP5.4的Zend引擎做了一个改进, 改进了参数不兼容的报警信息. 具体的来说:
对于如下的例子:
<?php
class Sub implements ArrayAccess {
public function offsetSet() {
}
}
?>在目前大家一定会得到类似如下的错误信息:
PHP Fatal error: Declaration of Sub::offsetSet() must be compatible
with that of ArrayAccess::offsetSet()这里有个问题, 错误信息并没有告诉我们, 正确的参数应该是什么样子, 我们除了去查手册(或者看源代码), 没办法得知.
于是, 在开发组经过提议, 讨论之后, 我今天做了一个改进, 改进之后, 将会得到如下的错误信息:
Fatal error: Declaration of Sub::offsetSet() must be compatible with
ArrayAccess::offsetSet($offset, $value)当然, 这个对用户自定的类也是有效的, 如下:
<?php
class Foo {
}
Abstract Class Base {
abstract public function test(Foo $foo, array $bar,
$option = NULL, $extra = 16777215) ;
}
class Sub extends Base {
public function test(Foo $foo, array $bar) {
}
}
?>将会得到如下的错误信息:
PHP Fatal error: Declaration of Sub::test() must be compatible with
Base::test(Foo $foo, array $bar, $option = NULL, $extra = 16777215)reversion: http://svn.php.net/viewvc?view=revision&revision=317206