Bug->Req #78262 [Opn->Csd]: Wrong error line (line 0) of errors printed in __toString
| From: | sjon@php.net | Date: | Wed, 10 Jul 2019 07:26:09 +0000 |
| Subject: | Bug->Req #78262 [Opn->Csd]: Wrong error line (line 0) of errors printed in __toString | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221676@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78262&edit=1
ID: 78262
Updated by: sjon@php.net
Reported by: e dot grinec at gmail dot com
Summary: Wrong error line (line 0) of errors printed in
__toString
-Status: Open
+Status: Closed
-Type: Bug
+Type: Feature/Change Request
Package: Class/Object related
Operating System: Windows 10 x64
PHP Version: 7.3.7
-Assigned To:
+Assigned To: sjon
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2019-07-08 12:39:42] e dot grinec at gmail dot com
thank you
------------------------------------------------------------------------
[2019-07-08 11:09:16] sjon@php.net
FYI - this works fine in the upcoming 7.4 version, see https://3v4l.org/FtDLp
------------------------------------------------------------------------
[2019-07-08 06:39:22] e dot grinec at gmail dot com
changed Package from the "General issues" to the "Class/Object related"
------------------------------------------------------------------------
[2019-07-08 06:07:01] e dot grinec at gmail dot com
Description:
------------
PHP Version 7.3.2
<?php
class Test {
public function __toString()
{
return NotExistsClass::notExistsMethod(); // make here any type of error
}
}
print new Test(); // Fatal error: Method Test::__toString() must not throw an exception, caught
Error: Class 'NotExistsClass' not found in D:\Portable\OSPanel\domains\test.test\test.php
on line 0
Test script:
---------------
<?php
class Test {
public function __toString()
{
return NotExistsClass::notExistsMethod(); // make here any type of error
}
}
print new Test();
Expected result:
----------------
Fatal error: Method Test::__toString() must not throw an exception, caught Error: Class
'NotExistsClass' not found in D:\Portable\OSPanel\domains\test.test\test.php on line 6
Actual result:
--------------
Fatal error: Method Test::__toString() must not throw an exception, caught Error: Class
'NotExistsClass' not found in D:\Portable\OSPanel\domains\test.test\test.php on line 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78262&edit=1