Edit report at https://bugs.php.net/bug.php?id=62737&edit=1
ID: 62737
Updated by: laruence@php.net
Reported by: leight at gmail dot com
Summary: Segfault invoking SplFileInfo->openFile
-Status: Open
+Status: Analyzed
Type: Bug
Package: Reproducible crash
Operating System: Linux / OSX
PHP Version: master-Git-2012-08-03 (Git)
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-08-03 14:12:33] laruence@php.net
I think this is not only splFileObject, many classes may has such issues.
(especially those who preserves their own class entry).
------------------------------------------------------------------------
[2012-08-03 11:06:18] leight at gmail dot com
Description:
------------
When SplFileObject is on the disable_classes list, and SplFileInfo->openFile is
called, PHP crashes because there is no check on whether the SplFileObject object
was actually created or not, before trying to use it.
The offending code is in ext/spl/spl_directory.c in
spl_filesystem_object_create_type
Test script:
---------------
<?php
// Run with -d disable_classes=SplFileObject
$a = new SplFileInfo('/bin/ls');
$a->openFile('r');
Expected result:
----------------
A message stating SplFileObject is disabled.
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62737&edit=1