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

 ID:                 44501
 Updated by:         fel...@php.net
 Reported by:        david at acz dot org
 Summary:            file_put_contents writes empty file with zlib and
                     LOCK_EX
-Status:             No Feedback
+Status:             Closed
 Type:               Bug
 Package:            Streams related
 Operating System:   SLES 10 x86_64
 PHP Version:        5.2.5
 Assigned To:        iliaa
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2008-09-23 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2008-09-16 00:27:09] il...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.3-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.3-win32-installer-latest.msi

Seems to work fine in 5.3 CVS

------------------------------------------------------------------------
[2008-05-06 14:04:25] andron at kpi dot ua

Hello!
I have the same problem
/var/tmp/portage/dev-lang/php-5.2.6/work/php-5.2.6/main/streams/streams.c(390) 
: Stream of type 'STDIO' 0x8386378 
(path:./storage/706e362fa415aa530247b0c4a372b249) was not closed

What infomation you need too?

------------------------------------------------------------------------
[2008-03-25 13:33:31] j...@php.net

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

[jani@localhost ~]$ /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 ===


------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=44501&edit=1

Reply via email to