|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55175 SplFileInfo throws a LogicException saying it's constructor has to be called
Submitted: 2011-07-11 07:09 UTC Modified: 2011-10-29 23:18 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: Assigned: cataphract (profile)
Status: Closed Package: SPL related
PHP Version: 5.4SVN-2011-07-11 (snap) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
44 - 29 = ?
Subscribe to this entry?

 [2011-07-11 07:09 UTC]
SplFileInfo throws the following exception whenever you extend it:

LogicException: In the constructor of ExtendingClass, parent::__construct() must be called and its exceptions cannot be cleared

Note that, in the example below, defining the constructor explicitly and calling parent::__construct() does not fix the issue.

Test script:
# php -r 'class Foo extends SplFileInfo {} new SplFileInfo("foo"); new Foo("bar

Expected result:
No output

Actual result:
Fatal error: Uncaught exception 'LogicException' with message 'In the constructor of Foo, parent::__construct() must be called and its exceptions cannot be cleared' in Command line code:1
Stack trace:
#0 Command line code(1): Foo->internal_construction_wrapper('bar')
#1 {main}
  thrown in Command line code on line 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-11 07:21 UTC]
-Operating System: Windows 7, x64 +Operating System: -Assigned To: +Assigned To: cataphract
 [2011-07-11 07:21 UTC]
Related to #54384
 [2011-10-29 23:17 UTC]
Automatic comment from SVN on behalf of cataphract
Log: - Reverted changes that required constructor overrides to invoke the parent
  constructor in several SPL classes and applied 5.3 fixes instead.
  Related bugs: #54384, #55175 and #55300
 [2011-10-29 23:18 UTC]
-Status: Assigned +Status: Closed
 [2011-10-29 23:18 UTC]
Replaced with 5.3 code.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 03:03:37 2021 UTC