|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-10-26 21:23 UTC] arturas dot moskvinas at gmail dot com
Description:
------------
Throwing through Reflection modified Exception (or any other Exception type) object makes php segment fault when file property is set to null.
Reproduce code:
---------------
<?php
$e = new Exception();
$reflection = new ReflectionObject($e);
$property = $reflection->getProperty("file");
$property->setAccessible(true);
$property->setValue($e, null);
throw $e;
?>
Expected result:
----------------
PHP Fatal error: Uncaught exception 'Exception' in null:xx
Actual result:
--------------
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 13 08:00:02 2025 UTC |
I cannot reproduce this using VC9 TS builds on Windows, using 5.3.0 and 5.3.2-dev: C:\php>php -v PHP 5.3.2-dev (cli) (built: Nov 5 2009 15:19:54) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies C:\php>php bug50005.php Fatal error: Uncaught exception 'Exception' in :2 Stack trace: #0 {main} thrown in (null) on line 2Probable strdup or strlen implementation on windows differs from linux. Here is one of possible fix patches (on 5.3.0 release) --- php-5.3.0.orig/main/main.c 2009-06-04 10:41:01.000000000 +0300 +++ php-5.3.0/main/main.c 2009-10-30 17:49:40.000000000 +0200 @@ -865,7 +865,10 @@ } PG(last_error_type) = type; PG(last_error_message) = strdup(buffer); - PG(last_error_file) = strdup(error_filename); + if (error_filename) + { + PG(last_error_file) = strdup(error_filename); + } PG(last_error_lineno) = error_lineno; }