php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78262 Wrong error line (line 0) of errors printed in __toString
Submitted: 2019-07-08 06:07 UTC Modified: 2019-07-10 07:26 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: e dot grinec at gmail dot com Assigned: sjon (profile)
Status: Closed Package: Class/Object related
PHP Version: 7.3.7 OS: Windows 10 x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: e dot grinec at gmail dot com
New email:
PHP Version: OS:

 

 [2019-07-08 06:07 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-08 06:39 UTC] e dot grinec at gmail dot com
-Package: *General Issues +Package: Class/Object related
 [2019-07-08 06:39 UTC] e dot grinec at gmail dot com
changed Package from the "General issues" to the "Class/Object related"
 [2019-07-08 11:09 UTC] sjon@php.net
FYI - this works fine in the upcoming 7.4 version, see https://3v4l.org/FtDLp
 [2019-07-08 12:39 UTC] e dot grinec at gmail dot com
thank you
 [2019-07-10 07:26 UTC] sjon@php.net
-Status: Open +Status: Closed -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: sjon
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC