|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-11-04 10:59 UTC] git@php.net
[2021-11-04 10:59 UTC] git@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
Description: ------------ The `Stringable` interface available as of 8.0.0, which can be explicitly or implicitly available on a class that implements `__toString()` does not seem to acknowledge that if `__toString()` comes via a trait, then the implicit implementation of `Stringable` does not work Test script: --------------- <?php trait A { public function __toString(): string { return 'ok'; } } class B { use A; } class C { public function __toString(): string { return 'ok'; } } $b = new B(); var_dump($b instanceof Stringable); $c = new C(); var_dump($c instanceof Stringable); Expected result: ---------------- PHP7: bool(false) bool(false) PHP8: bool(true) bool(true) Actual result: -------------- PHP7: bool(false) bool(false) PHP8: bool(false) bool(true)