php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37257 weird Exception using SplTempFileObject
Submitted: 2006-05-01 05:48 UTC Modified: 2006-05-01 19:22 UTC
From: judas dot iscariote at gmail dot com Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.1.3 OS: *
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: judas dot iscariote at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-01 05:48 UTC] judas dot iscariote at gmail dot com
Description:
------------
an incorrect exception is thrown by SplTempFileObject



Reproduce code:
---------------
php -r '$foo = new SplTempFileObject(1024);'

Expected result:
----------------
not sure, since it's not documented, but I think at least not   with "Success" message..

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://temp/maxmemory:1024): failed to open stream: ****Success*****' in Command line code:1
Stack trace:
#0 Command line code(1): SplTempFileObject->__construct(1024)
#1 {main}
  thrown in Command line code on line 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-01 06:13 UTC] judas dot iscariote at gmail dot com
seems to be completely broken. :-(

this :

$foo = new SplTempFileObject();

produces in CLI :

PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://temp): failed to open stream: **Illegal seek**' in Command line code:1
Stack trace:
#0 Command line code(1): SplTempFileObject->__construct()
#1 {main}
  thrown in Command line code on line 1

and in the webserver ( apache) produces :

Fatal error: Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://temp): failed to open stream: *******Not a directory*******' in /srv/www/htdocs/temp.php:3 Stack trace: #0 /srv/www/htdocs/temp.php(3): SplTempFileObject->__construct() #1 {main} thrown in /srv/www/htdocs/temp.php on line 3 

I don't think php://temp (???) wrapper should be detected as a directory, nor I have produced code to generate an "Illegal seek" .. ;-)
 [2006-05-01 16:03 UTC] helly@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.

There was some missing code in ext standard. I was sure to MFH it [...] to bad you figured this out 1 week to late for 5.1.3.
 [2006-05-01 19:22 UTC] judas dot iscariote at gmail dot com
thanks form fixing this Marcus .. ;)

"Errare Humanum Est"..

It now works as php --rc SPLTempFileObject api docs says.

will be nice if you can provide other kind of documentation in the future, this class is very useful.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 21:01:28 2024 UTC