# [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_API.c zend_API.h php-src/ext/standard type.c

- Thread: https://externals.io/message/35075
- Original archive: https://news-web.php.net/php.internals/35075
- Started by Marcus Boerger on 2008-02-01T21:45:37+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #35075 — Marcus Boerger — 2008-02-01T21:45:37+00:00

URL: https://externals.io/message/35075#35075

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

---

## #35079 — Pierre Joye — 2008-02-01T22:05:41+00:00

URL: https://externals.io/message/35075#35079 · In reply to: #35075

2008/2/1 Marcus Boerger <helly@php.net>:
> Crosspost, hopefully silencing this issue for 5.*
>
> AND 6 will have an `E_WARNING` or even an `E_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.
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #35081 — Lukas Kahwe Smith — 2008-02-01T22:15:08+00:00

URL: https://externals.io/message/35075#35081 · In reply to: #35079

> 2008/2/1 Marcus Boerger <helly@php.net>:
> > […]
>
> 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:

1) No fatal errors that are not fatal for the engine
2) 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

---

## #35083 — Cristian Rodriguez — 2008-02-01T22:36:51+00:00

URL: https://externals.io/message/35075#35083 · In reply to: #35075

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


-- 
http://www.cristianrodriguez.net

---

## #35085 — Rasmus Lerdorf — 2008-02-01T23:11:07+00:00

URL: https://externals.io/message/35075#35085 · In reply to: #35083

Cristian Rodriguez wrote:
> 2008/2/1, Marcus Boerger <helly@php.net>:
> > […]
> 
> 
> 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

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

---

## #35086 — Marcus Boerger — 2008-02-01T23:26:39+00:00

URL: https://externals.io/message/35075#35086 · In reply to: #35081

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:

> 

> > […]

> Yes .. I think for PHP we should follow these rules:

> 1) No fatal errors that are not fatal for the engine
> 2) 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



Best regards,
 Marcus

---

## #35087 — Marcus Boerger — 2008-02-01T23:34:37+00:00

URL: https://externals.io/message/35075#35087 · In reply to: #35085

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:
> > […]

> 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

---

## #35090 — Gregory Beaver — 2008-02-02T00:52:02+00:00

URL: https://externals.io/message/35075#35090 · In reply to: #35085

Rasmus Lerdorf wrote:
> Cristian Rodriguez wrote:
> > […]
> 
> 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.

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

---

## #35092 — Pierre Joye — 2008-02-02T01:33:26+00:00

URL: https://externals.io/message/35075#35092 · In reply to: #35090

> Rasmus Lerdorf wrote:
> > […]
>
> 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

---

## #35199 — Richard Lynch — 2008-02-05T22:14:54+00:00

URL: https://externals.io/message/35075#35199 · In reply to: #35092

> 
> > […]
.
.
.
> 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?

---

## #35200 — Pierre Joye — 2008-02-05T22:17:11+00:00

URL: https://externals.io/message/35075#35200 · In reply to: #35199

>
>
> 
> > […]
> .
> .
> .
> > […]
>
> Something is not matching up here...
>
> :-)

That's being open to discussions ;)

-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #35245 — Marcus Boerger — 2008-02-06T12:59:20+00:00

URL: https://externals.io/message/35075#35245 · In reply to: #35200

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:

> 
> > […]

> That's being open to discussions ;)




Best regards,
 Marcus
