php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62419 RuntimeException throws fatal error if passing a previous exception to the ctor
Submitted: 2012-06-26 11:26 UTC Modified: 2012-07-20 21:09 UTC
Votes:6
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:6 (100.0%)
Same OS:0 (0.0%)
From: bugs dot php at mohiva dot com Assigned: ab (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5.4.4 OS: Gentoo Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugs dot php at mohiva dot com
New email:
PHP Version: OS:

 

 [2012-06-26 11:26 UTC] bugs dot php at mohiva dot com
Description:
------------
If you pass a previous exception to the constructor of the RuntimeException class, then PHP throws a fatal error without an error message. I have tested those exceptions which are derived from RuntimeException, and they all work fine. The same counts for the base Exception class.



Test script:
---------------
<?php

throw new RuntimeException("Exception message", 0, new Exception());

Expected result:
----------------
Fatal error: Uncaught exception 'RuntimeException' ... on line 3

Actual result:
--------------
Fatal error: in exception.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-30 13:36 UTC] Sjon at hortensius dot net
I cannot reproduce this, it seems to work fine?

http://3v4l.org/IAF3d#v530
 [2012-07-03 08:23 UTC] bugs dot php at mohiva dot com
Hi,

if I execute the code through the cli binary then it works as expected. But if I serve the file through apache/php-fpm/fastcgi then PHP behaves as described in the bug report.

Cheers,
Christian
 [2012-07-03 08:31 UTC] bugs dot php at mohiva dot com
If I disable APC for php-fpm then it works as expected. 

Note: APC is enabled for php-cli and it works as expected.
 [2012-07-08 13:03 UTC] franssen dot roland at gmail dot com
I can produce the same error when throwing a \RuntimeException (without previous exception) in a SPL registered autoload function.

PHP 5.4.4-2
 [2012-07-08 13:05 UTC] franssen dot roland at gmail dot com
APC is enabled but disabled on CLI.
 [2012-07-08 17:56 UTC] franssen dot roland at gmail dot com
<?php
strpos(); // trigger error
throw new \Exception('foo'); // as expected
?>

vs.

<?php
strpos(); // trigger_error
throw new \RuntimeException('foo'); // fatal error
?>
 [2012-07-08 17:57 UTC] franssen dot roland at gmail dot com
Never mind.. the \RuntimeException class just doesn't work with APC enabled.

<?php
throw new \RuntimeException('foo'); // fatal error
 [2012-07-09 08:15 UTC] maarten@php.net
-Package: SPL related +Package: APC
 [2012-07-14 08:24 UTC] franssen dot roland at gmail dot com
Test script works as expected when APC is disabled.
 [2012-07-20 21:09 UTC] ab@php.net
Automatic comment from SVN on behalf of ab
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=326748
Log: added test for bug #62419
 [2012-07-20 21:09 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2012-07-20 21:09 UTC] ab@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 15:01:27 2025 UTC