php.net |  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
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: seld@php.net 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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: seld@php.net
New email:
PHP Version: OS:

 

 [2011-07-11 07:09 UTC] seld@php.net
Description:
------------
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-11 07:21 UTC] salathe@php.net
-Operating System: Windows 7, x64 +Operating System: -Assigned To: +Assigned To: cataphract
 [2011-07-11 07:21 UTC] salathe@php.net
Related to #54384
 [2011-10-29 23:17 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=318566
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] cataphract@php.net
-Status: Assigned +Status: Closed
 [2011-10-29 23:18 UTC] cataphract@php.net
Replaced with 5.3 code.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 23:01:29 2024 UTC