ID:               44501
 Updated by:       [EMAIL PROTECTED]
 Reported By:      david at acz dot org
-Status:           Open
+Status:           Assigned
 Bug Type:         Streams related
 Operating System: SLES 10 x86_64
 PHP Version:      5.2.5
-Assigned To:      
+Assigned To:      iliaa
 New Comment:

Ilia, the fix propably wasn't quite right, and I get this with the
example script:

[EMAIL PROTECTED] ~]$ /home/jani/src/build/php_5_2/sapi/cli/php  t.php

Warning: file_put_contents(compress.zlib:///tmp/hello.txt.gz): failed
to open stream: Inappropriate ioctl for device in /home/jani/t.php on
line 5
bool(false)
int(0)
string(0) ""
                    
/home/jani/src/php-5.2/main/streams/streams.c(390) : Stream of type
'STDIO' 0x9504c4c (path:/tmp/hello.txt.gz) was not closed
[Tue Mar 25 15:30:11 2008]  Script:  't.php'
/home/jani/src/php-5.2/main/streams/streams.c(227) :  Freeing
0x09504C4C (128 bytes), script=t.php
/home/jani/src/php-5.2/ext/zlib/zlib_fopen_wrapper.c(127) : Actual
location (location was relayed)
=== Total 1 memory leaks detected ===



Previous Comments:
------------------------------------------------------------------------

[2008-03-22 03:06:49] david at acz dot org

Description:
------------
When passing LOCK_EX to file_put_contents() using a "compress.zlib"
stream, the function creates a valid gzip file (non-empty) containing
zero un-compressed bytes (gunzip outputs nothing) and returns false.

This was reported in #42468, but wasn't actually fixed.  The function
needs to fail BEFORE it opens (and destroys) the output file.


Reproduce code:
---------------
<?
    $name = "/tmp/hello.txt.gz";
    $file = "compress.zlib://" . $name;

    var_dump(file_put_contents($file, "hello", LOCK_EX));
    var_dump(filesize($name));
    var_dump(file_get_contents($file));
?>


Expected result:
----------------
int(5)
int(31)
string(5) "hello"


Actual result:
--------------
bool(false)
int(26)
string(0) ""


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44501&edit=1

Reply via email to