com php-src: Fix test failures from previous commit (I really don't get that issue in phar... if there's a better fix, it's welcome...):
Zend/tests/bug38779_1.phpt ext/phar/stream. c

From: Date: Tue, 30 Jun 2015 05:02:56 +0000
Subject: com php-src: Fix test failures from previous commit (I really don't get that issue in phar... if there's a better fix, it's welcome...):
Zend/tests/bug38779_1.phpt ext/phar/stream. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87640@lists.php.net to get a copy of this message
Commit: dd2e6e866db17e4458a706b729288bfae857fa17 Author: Bob Weinand <bobwei9@hotmail.com> Tue, 30 Jun 2015 07:02:32 +0200 Parents: 99cac5055e8f4cb6644520ba398c1fc418237e4a Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd2e6e866db17e4458a706b729288bfae857fa17 Log: Fix test failures from previous commit (I really don't get that issue in phar... if there's a better fix, it's welcome...) Changed paths: M Zend/tests/bug38779_1.phpt M ext/phar/stream.c Diff: diff --git a/Zend/tests/bug38779_1.phpt b/Zend/tests/bug38779_1.phpt index e2a5b20..1cd25f9 100644 --- a/Zend/tests/bug38779_1.phpt +++ b/Zend/tests/bug38779_1.phpt @@ -20,10 +20,10 @@ class Loader { return $this->position >= strlen($this->data); } function stream_flush() { - @unlink(dirname(__FILE__).."/bug38779.txt"); var_dump("flush!"); } function stream_close() { + @unlink(dirname(__FILE__)."/bug38779.txt"); var_dump("close!"); } } @@ -49,5 +49,4 @@ if (file_exists($filename)) { ?> --EXPECTF-- Parse error: %s error%sin %s on line %d -string(6) "flush!" string(6) "close!" diff --git a/ext/phar/stream..c b/ext/phar/stream.c index fc477f0..9aa3c03 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -346,6 +346,9 @@ phar_stub: */ static int phar_stream_close(php_stream *stream, int close_handle) /* {{{ */ { + /* for some reasons phar needs to be flushed even if there is no write going on */ + phar_stream_flush(stream); + phar_entry_delref((phar_entry_data *)stream->abstract); return 0; @@ -437,7 +440,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun php_stream_seek(data->fp, data->position, SEEK_SET); if (count != php_stream_write(data->fp, buf, count)) { php_stream_wrapper_log_error(stream->wrapper, stream->flags, "phar error: Could not write %d characters to \"%s\" in phar \"%s\"", (int) count, data->internal_file->filename, data->phar->fname); - return -1; + return 0; } data->position = php_stream_tell(data->fp); if (data->position > (zend_off_t)data->internal_file->uncompressed_filesize) {

« previous php.cvs (#87640) next »