1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
reverted:
--- php5.orig/ext/standard/tests/file/bug68532.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Bug #68532: convert.base64-encode omits padding bytes
---FILE--
-<?php
-$testString = 'test';
-$stream = fopen('php://memory','r+');
-fwrite($stream, $testString);
-rewind($stream);
-$filter = stream_filter_append($stream, 'convert.base64-encode');
-echo "memoryStream = " . stream_get_contents($stream).PHP_EOL;
-
-
-$fileStream = fopen(__DIR__ . '/base64test.txt','w+');
-fwrite($fileStream , $testString);
-rewind($fileStream );
-$filter = stream_filter_append($fileStream , 'convert.base64-encode');
-echo "fileStream = " . stream_get_contents($fileStream ).PHP_EOL;
-?>
---CLEAN--
-<?php
-unlink(__DIR__ . '/base64test.txt');
-?>
---EXPECT--
-memoryStream = dGVzdA==
-fileStream = dGVzdA==
--- php5.orig/ext/standard/tests/file/stream_rfc2397_007.phpt
+++ php5/ext/standard/tests/file/stream_rfc2397_007.phpt
@@ -95,7 +95,6 @@ int(5)
bool(false)
===GETC===
string(1) "5"
-bool(false)
int(6)
bool(true)
===REWIND===
--- php5.orig/main/streams/memory.c
+++ php5/main/streams/memory.c
@@ -86,19 +86,15 @@ static size_t php_stream_memory_read(php
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
assert(ms != NULL);
- if (ms->fpos == ms->fsize) {
+ if (ms->fpos + count >= ms->fsize) {
+ count = ms->fsize - ms->fpos;
stream->eof = 1;
- count = 0;
- } else {
- if (ms->fpos + count >= ms->fsize) {
- count = ms->fsize - ms->fpos;
- }
- if (count) {
- assert(ms->data!= NULL);
- assert(buf!= NULL);
- memcpy(buf, ms->data+ms->fpos, count);
- ms->fpos += count;
- }
+ }
+ if (count) {
+ assert(ms->data!= NULL);
+ assert(buf!= NULL);
+ memcpy(buf, ms->data+ms->fpos, count);
+ ms->fpos += count;
}
return count;
}
|