php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37665 Exception messages from stream wrappers should be displayed
Submitted: 2006-06-01 11:57 UTC Modified: 2006-06-05 10:02 UTC
From: flconseil at yahoo dot fr Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.1.4 OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flconseil at yahoo dot fr
New email:
PHP Version: OS:

 

 [2006-06-01 11:57 UTC] flconseil at yahoo dot fr
Description:
------------
When I send an exception from a stream wrapper method, the call fails with a generic warning message from PHP, but the message I sent with my exception is not displayed.

It would be a useful enhancement to add it to the error string.

(Tested in 5.1.2, should be the same in 5.1.4)



Reproduce code:
---------------
Example of an invalid URL :

include('phk://mnt1/toto');



Expected result:
----------------
If the exception->message was also displayed, it would give something like :

PHP Warning: include(phk://mnt1/toto): failed to open stream: Error opening PHK subfile - phk://mnt1/toto: Invalid URL - mnt1: Unknown PHK mount point - "PHK_Stream::stream_open" call failed in ... on line 6



Actual result:
--------------
PHP Warning:  include(phk://mnt1/toto): failed to open stream: "PHK_Stream::stream_open" call failed in ... on line 6

I have no way to tell the user why his URL failed. And, as STREAM_REPORT_ERRORS is unset, I am not allowed to raise any error from my code.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-01 11:58 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2006-06-05 09:49 UTC] flconseil at yahoo dot fr
Sorry, I had a 'catch' part in my code and the exception was trapped before being sent to the calling code.

I still would have ideas for ways to catch exceptions in the stream wrapper code but I need to think more about it before submitting a new enhancement suggestion (for PHP 6). So I prefer to close this case.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 02:00:02 2025 UTC