Crosspost, hopefully silencing this issue for 5.*
AND 6 will have an E_WARNING
or even an E_ERROR
on this.
helly Fri Feb 1 21:27:55 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/standard type.c
/ZendEngine2 zend_API.c zend_API.h
Log:
[DOC]
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic function
[marcus@frodo PHP_5_3]$ php -a -d error_reporting=8191
make: `sapi/cli/php' is up to date.
Interactive shell
php > class t{ function f() { echo "Funny\n"; } }
php > $c = array("t","f");
php > call_user_func($c);
Strict Standards: call_user_func()
expects parameter 1 to be a valid callback, non-static method t::f() cannot be called statically in php shell code on line 1
Funny
php > var_dump(is_callable($c));
Strict Standards: Non-static method t::f() cannot be called statically in php shell code on line 1
bool(true)
php > t::f();
Strict Standards: Non-static method t::f() should not be called statically in php shell code on line 1
Funny
php
2008/2/1 Marcus Boerger helly@php.net:
Crosspost, hopefully silencing this issue for 5.*
AND 6 will have an
E_WARNING
or even anE_ERROR
on this.
What are the gains?
What are the real reasons behing strictness? I really get annoying by
adding fatal errors all around for no technical reasons. A fatal error
means the engine is getting foo bared and can't do anything sane but
leaving.
2008/2/1 Marcus Boerger helly@php.net:
Crosspost, hopefully silencing this issue for 5.*
AND 6 will have an
E_WARNING
or even anE_ERROR
on this.What are the gains?
What are the real reasons behing strictness? I really get annoying by
adding fatal errors all around for no technical reasons. A fatal error
means the engine is getting foo bared and can't do anything sane but
leaving.
Yes .. I think for PHP we should follow these rules:
- No fatal errors that are not fatal for the engine
- throw
E_STRICT
for anything that makes a CS prof commit suicide
PHP is about solving real world problems and not creating problems
that are not there (making on fatal things fatal is creating a non
existant problem). if people want to do the right thing in terms of CS
they enable E_STRICT
.. and if they want E_STRICT
to be fatal they can
create an error handler that does that for them.
regards,
Lukas
Hello Lukas,
only E_ERROR
is fatal and reserved for when the engine cannot continue
execution.
marcus
Friday, February 1, 2008, 11:15:08 PM, you wrote:
2008/2/1 Marcus Boerger helly@php.net:
Crosspost, hopefully silencing this issue for 5.*
AND 6 will have an
E_WARNING
or even anE_ERROR
on this.What are the gains?
What are the real reasons behing strictness? I really get annoying by
adding fatal errors all around for no technical reasons. A fatal error
means the engine is getting foo bared and can't do anything sane but
leaving.
Yes .. I think for PHP we should follow these rules:
- No fatal errors that are not fatal for the engine
- throw
E_STRICT
for anything that makes a CS prof commit suicide
PHP is about solving real world problems and not creating problems
that are not there (making on fatal things fatal is creating a non
existant problem). if people want to do the right thing in terms of CS
they enableE_STRICT
.. and if they wantE_STRICT
to be fatal they can
create an error handler that does that for them.
regards,
Lukas
Best regards,
Marcus
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic function
Does not compile..
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_register':
php5.3/ext/spl/php_spl.c:423: error: too few arguments to function
'zend_is_callable_ex'
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_unregister':
php5.3/ext/spl/php_spl.c:515: error: too few arguments to function
'zend_is_callable_ex'
make: *** [ext/spl/php_spl.lo] Error 1
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic functionDoes not compile..
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_register':
php5.3/ext/spl/php_spl.c:423: error: too few arguments to function
'zend_is_callable_ex'
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_unregister':
php5.3/ext/spl/php_spl.c:515: error: too few arguments to function
'zend_is_callable_ex'
make: *** [ext/spl/php_spl.lo] Error 1
Did you update your Zend/ directory? It compiles fine here.
I've been working through this one with Marcus a bit, and even though he
fundamentally disagrees with the concept, he still wrote the code. I
can't say I would have done the same in his place. So thanks, Marcus.
-Rasmus
Hello Rasmus,
well, I can compromise. In this case I rather get the messages right than
none at all. What I disagree to, is the severity level. Thus I might come up
with something that turns warnings into exceptions better than how we can do
it today, since that in place would give me what I want too.
marcus
Saturday, February 2, 2008, 12:11:07 AM, you wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic functionDoes not compile..
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_register':
php5.3/ext/spl/php_spl.c:423: error: too few arguments to function
'zend_is_callable_ex'
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_unregister':
php5.3/ext/spl/php_spl.c:515: error: too few arguments to function
'zend_is_callable_ex'
make: *** [ext/spl/php_spl.lo] Error 1
Did you update your Zend/ directory? It compiles fine here.
I've been working through this one with Marcus a bit, and even though he
fundamentally disagrees with the concept, he still wrote the code. I
can't say I would have done the same in his place. So thanks, Marcus.
-Rasmus
Best regards,
Marcus
Rasmus Lerdorf wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic functionDoes not compile..
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_register':
php5.3/ext/spl/php_spl.c:423: error: too few arguments to function
'zend_is_callable_ex'
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_unregister':
php5.3/ext/spl/php_spl.c:515: error: too few arguments to function
'zend_is_callable_ex'
make: *** [ext/spl/php_spl.lo] Error 1Did you update your Zend/ directory? It compiles fine here.
I've been working through this one with Marcus a bit, and even though he
fundamentally disagrees with the concept, he still wrote the code. I
can't say I would have done the same in his place. So thanks, Marcus.
I and everyone in PEAR agrees, this was a very gallant move. For those
who are similarly grateful, Marcus does have a wishlist at
http://pecl.php.net/wishlist.php/helly :)
Greg
Rasmus Lerdorf wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result in a
E_STRICT
. binding a dynamic function as a static callback
. static call of a dynamic function
.is_callable()
on a static binding to a dynamic functionDoes not compile..
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_register':
php5.3/ext/spl/php_spl.c:423: error: too few arguments to function
'zend_is_callable_ex'
php5.3/ext/spl/php_spl.c: In function 'zif_spl_autoload_unregister':
php5.3/ext/spl/php_spl.c:515: error: too few arguments to function
'zend_is_callable_ex'
make: *** [ext/spl/php_spl.lo] Error 1Did you update your Zend/ directory? It compiles fine here.
I've been working through this one with Marcus a bit, and even though he
fundamentally disagrees with the concept, he still wrote the code. I
can't say I would have done the same in his place. So thanks, Marcus.I and everyone in PEAR agrees, this was a very gallant move. For those
who are similarly grateful, Marcus does have a wishlist at
http://pecl.php.net/wishlist.php/helly :)
To rectify a bit the shot, everyone agrees, but that's not the point :)
The initial move was actually wrong, that does not mean that Marcus is
the evil or does nothing good for PHP. That only means that it was a
bad move and should be corrected. We all do such moves once or two.
The problem is fixed now, thanks you.
However that does not answer my questions, what's the gain to make
such errors fatal?
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
Rasmus Lerdorf wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result
in aE_STRICT
.
.
.
However that does not answer my questions, what's the gain to make
such errors fatal?
Something is not matching up here...
:-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
Rasmus Lerdorf wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result
in aE_STRICT
.
.
.
However that does not answer my questions, what's the gain to make
such errors fatal?Something is not matching up here...
:-)
That's being open to discussions ;)
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
Hello Pierre,
internal c-level code is written in a way that it expects $this to be
available and will crash if it is not for the most. Thus we prevent calling
internal dynamic functions as static ones unless they are flagged as such.
Tuesday, February 5, 2008, 11:17:11 PM, you wrote:
Rasmus Lerdorf wrote:
Cristian Rodriguez wrote:
2008/2/1, Marcus Boerger helly@php.net:
- Fix callable/static mess, the following will now all result
in aE_STRICT
.
.
.
However that does not answer my questions, what's the gain to make
such errors fatal?Something is not matching up here...
:-)
That's being open to discussions ;)
Best regards,
Marcus