Marcus Boerger wrote:
Hello Scott,
actually it was a bug. We, sorry I, did not spot this in earlier versions.
Now saying you rely on a bug in PHP 5 to be able to execute PHP 4 code
simply does not work.
Hi Marcus,
How is forcing users to replace call_user_func(array('Classname',
'func')) with eval('Classname::func') a good policy?
When this example code:
<?php
error_reporting(E_NOTICE|E_WARNING|E_ERROR);
class A { function B (){}}
A::B();
?>
functions differently from this code:
<?php
error_reporting(E_NOTICE|E_WARNING|E_ERROR);
class A { function B (){}}
call_user_func(array('A','B'));
?>
And in a minor version increment, this in fact introduces a bug, and
doesn't fix one.
I think the fix may be to simply add retval=0 in
zend_is_callable_check_func() here:
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC)
!= 0) {
retval = 0;
} else {
if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr
TSRMLS_CC)) {
*zobj_ptr_ptr = &EG(This);
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called
statically, assuming $this from compatible context %s", (*ce_ptr)->name,
fptr->common.function_name, Z_OBJCE_P(EG(This))->name);
} else {
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called
statically", (*ce_ptr)->name, fptr->common.function_name);
}
}
basically what is happening is that E_STRICT makes the callback invalid,
which is not technically true - the callback is valid, just not strictly
correct.
I can make a patch next week, if someone doesn't beat me to it. We need
a retval=0 in the inner else clause
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php