Skip to content

Commit 36b644f

Browse files
committed
Merge branch 'master' into preload
* master: Fix stray newline that caused this test to fail Fix session tests that fail if error_log is set This test needs to log to stdout Fix error condition Fixed bug #77081 ftruncate() changes seek pointer in c mode Fix and improve test case
2 parents 7a20781 + b91690c commit 36b644f

File tree

8 files changed

+42
-9
lines changed

8 files changed

+42
-9
lines changed

ext/session/tests/bug60860.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include('skipif.inc');
77
--INI--
88
session.save_handler=user
99
display_errors=off
10+
error_log=
1011
--FILE--
1112
<?php
1213

ext/session/tests/bug66481.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Bug #66481: Calls to session_name() segfault when session.name is null.
33
--INI--
44
session.name=
5+
error_log=
56
--SKIPIF--
67
<?php include('skipif.inc'); ?>
78
--FILE--

ext/session/tests/session_set_save_handler_class_014.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Test session_set_save_handler() : calling default handler when save_handler=user
44
session.save_handler=user
55
session.name=PHPSESSID
66
display_errors=off
7+
error_log=
78
--SKIPIF--
89
<?php
910
include('skipif.inc');
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #77081 ftruncate() changes seek pointer in c mode
3+
--FILE--
4+
<?php
5+
6+
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
7+
8+
file_put_contents($filename, 'foo');
9+
$stream = fopen($filename, 'c');
10+
ftruncate($stream, 0);
11+
var_dump(ftell($stream));
12+
fwrite($stream, 'bar');
13+
fclose($stream);
14+
var_dump(file_get_contents($filename));
15+
16+
?>
17+
--CLEAN--
18+
<?php
19+
$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test77081";
20+
unlink($fn);
21+
?>
22+
--EXPECT--
23+
int(0)
24+
string(3) "bar"

ext/xml/tests/bug71592.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ if (!extension_loaded('xml')) die('skip xml extension not available');
66
?>
77
--FILE--
88
<?php
9+
// The tag mismatch at the end of the XML is on purpose, to make sure that the
10+
// parser actually stops after the handler returns FALSE.
911
$xml = <<<XML
1012
<?xml version="1.0" encoding="UTF-8"?>
11-
<!DOCTYPE p [
13+
<!DOCTYPE root [
1214
<!ENTITY pic PUBLIC "image.gif" "http://example.org/image.gif">
1315
]>
1416
<root>
@@ -22,9 +24,9 @@ xml_set_external_entity_ref_handler($parser, function () {
2224
return false;
2325
});
2426
xml_parse($parser, $xml);
25-
var_dump(xml_get_error_code($parser));
27+
var_dump(xml_get_error_code($parser) === XML_ERROR_EXTERNAL_ENTITY_HANDLING);
2628
?>
2729
===DONE===
2830
--EXPECT--
29-
int(21)
31+
bool(true)
3032
===DONE===

main/streams/plain_wrapper.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,26 +858,27 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
858858
return PHP_STREAM_OPTION_RETURN_ERR;
859859
}
860860

861-
LARGE_INTEGER old_sz;
862-
if (!GetFileSizeEx(h, &old_sz)) {
861+
LARGE_INTEGER sz, old_sz;
862+
sz.QuadPart = 0;
863+
864+
if (!SetFilePointerEx(h, sz, &old_sz, FILE_CURRENT)) {
863865
return PHP_STREAM_OPTION_RETURN_ERR;
864866
}
865867

866-
LARGE_INTEGER sz;
867868
#if defined(_WIN64)
868869
sz.HighPart = (new_size >> 32);
869870
sz.LowPart = (new_size & 0xffffffff);
870871
#else
871872
sz.HighPart = 0;
872873
sz.LowPart = new_size;
873874
#endif
874-
if (INVALID_SET_FILE_POINTER == SetFilePointerEx(h, sz, NULL, FILE_BEGIN) && NO_ERROR != GetLastError()) {
875+
if (!SetFilePointerEx(h, sz, NULL, FILE_BEGIN)) {
875876
return PHP_STREAM_OPTION_RETURN_ERR;
876877
}
877878
if (0 == SetEndOfFile(h)) {
878879
return PHP_STREAM_OPTION_RETURN_ERR;
879880
}
880-
if (INVALID_SET_FILE_POINTER == SetFilePointerEx(h, old_sz, NULL, FILE_BEGIN) && NO_ERROR != GetLastError()) {
881+
if (!SetFilePointerEx(h, old_sz, NULL, FILE_BEGIN)) {
881882
return PHP_STREAM_OPTION_RETURN_ERR;
882883
}
883884
return PHP_STREAM_OPTION_RETURN_OK;

sapi/cli/tests/upload_2G.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ fclose($fp);
7878
Done
7979
--EXPECTF--
8080
Test
81-
8281
HTTP/1.1 200 OK
8382
Host: %s
8483
Date: %s

tests/run-test/bug75042-3.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
phpt EXTENSIONS directive with nonexistent shared module
3+
--INI--
4+
error_log=
5+
display_startup_errors=1
6+
display_errors=1
37
--EXTENSIONS--
48
nonexistentsharedmodule
59
--FILE--

0 commit comments

Comments
 (0)