|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-08-03 11:06 UTC] 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
Patchesbug62737.phpt (last revision 2012-08-04 15:14 UTC by laruence@php.net)bug62737.patch (last revision 2012-08-04 15:13 UTC by laruence@php.net) ChangeDisableClassHandler.patch (last revision 2012-08-03 16:21 UTC by laruence@php.net) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 12:00:01 2025 UTC |
Hi, by replace create_object function pointer and free function table isn't enough, after apply the patch, I got this, maybe more handlers need to be replaced and cleanup. Fatal error: Uncaught exception 'RuntimeException' with message 'get_class_vars() expects exactly 1 parameter, 2 given' in /Users/reeze/Opensource/php-test/php-src-5.3-dev/xx.php:6 Stack trace: #0 [internal function]: SplFileObject->get_class_vars('/bin/ls', 'r') #1 /Users/reeze/Opensource/php-test/php-src-5.3-dev/xx.php(6): SplFileInfo- >openFile('r') #2 {main} thrown in /Users/reeze/Opensource/php-test/php-src-5.3-dev/xx.php on line 6Actually, I have improved the patch, and I don't know what's your test script? get_class_vars("splFileObject")? you can try with the new patch.