Bug #79350 [Com]: Classes with __toString() do not support early binding

From: Date: Sun, 26 Sep 2021 07:27:54 +0000
Subject: Bug #79350 [Com]: Classes with __toString() do not support early binding
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236849@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79350&edit=1

 ID:                 79350
 Comment by:         wxiaoguang at gmail dot com
 Reported by:        bugreports at gmail dot com
 Summary:            Classes with __toString() do not support early
                     binding
 Status:             Analyzed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        master-Git-2020-03-07 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Is it possible to get this bug fixed? It seems breaking the language spec, and trying to bypass the
bug makes code messy.


Previous Comments:
------------------------------------------------------------------------
[2021-07-23 09:30:04] nikic@php.net

Related To: Bug #81224

------------------------------------------------------------------------
[2020-03-12 10:51:14] bugreports at gmail dot com

sounds like a terrible BC break and at least the error message is unhelpful nonsense given that even
one of the zend engine experts pointed at include at the first try :-)

------------------------------------------------------------------------
[2020-03-12 10:29:14] nikic@php.net

Here's a reduced test case:

<?php
  
echo new Test, "\n";

class Test {
    public function __toString() {
        echo "Early bound!";
    }
}

------------------------------------------------------------------------
[2020-03-12 10:22:44] nikic@php.net

No, that's not it. I think the issue is that this code is relying on early binding, and
early-binding on the PelEntry class is now prevented due to implicit addition of Stringable
interface.

------------------------------------------------------------------------
[2020-03-12 10:09:31] nikic@php.net

I think something is going wrong with a recursive require_once.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79350


--
Edit this bug report at https://bugs.php.net/bug.php?id=79350&edit=1


Thread (6 messages)

« previous php.bugs (#236849) next »