Skip to content

Commit 3d16522

Browse files
committed
Merge branch 'master' of https://git.php.net/repository/php-src
# By Michael Wallner (18) and others # Via David Soria Parra (8) and others * 'master' of https://git.php.net/repository/php-src: (37 commits) better way to fix PRIu64 availability on windows Revert "EmptyIterator now implements Countable; fixes bug 60577" RFC 6598 reserved ip range starts at 100.64.0.0 fix a very rare case of use of uninitialized value combined with a memleak fix test concurrency fix test concurrency fix test concurrency fix test concurrency fix test concurrency fix build - PRIu64 vs %I64u final bits we need to use the full stream wrapper for filters let the libsqlite3 symbols be exported in dll NEWS/UPGRADING{,.INTERNALS} notes about temp POST stream Exclude bison 3.0 by Mike NEWS for added reserved ip addresses according to RFC 6598 Add RFC 6598 IPs to reserved addresses upload2G note NEWS for #60577 NEWS for bug #64441 ...
2 parents b740bfc + 86dfe7b commit 3d16522

File tree

110 files changed

+1218
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1218
-501
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ PHP NEWS
99
. Made calls from incompatible context issue an E_DEPRECATED warning instead
1010
of E_STRICT (phase 1 of RFC: https://wiki.php.net/rfc/incompat_ctx).
1111
(Gustavo)
12+
. Uploads equal or greater than 2GB in size are now accepted.
13+
(Ralf Lang, Mike)
14+
. Reduced POST data memory usage by 200-300%. Removed INI setting
15+
always_populate_raw_post_data and the $HTTP_RAW_POST_DATA global
16+
variable. (Mike)
1217

1318
- cURL:
1419
. Implemented FR #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir

UPGRADING

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,23 @@ PHP X.Y UPGRADE NOTES
2020
1. Backward Incompatible Changes
2121
========================================
2222

23+
- Core:
24+
Removed $HTTP_RAW_POST_DATA global variable. Restore backwards compatibility
25+
by:
26+
<?php
27+
global $HTTP_RAW_POST_DATA;
28+
if (!isset($HTTP_RAW_POST_DATA)) {
29+
$HTTP_ROW_POST_DATA = file_get_contents("php://input");
30+
}
31+
?>
2332

2433
========================================
2534
2. New Features
2635
========================================
2736

37+
- Core:
38+
The php://input stream is now re-usable and can be used concurrently with
39+
enable_post_data_reading=0.
2840

2941
========================================
3042
2. Changes in SAPI modules
@@ -91,6 +103,8 @@ PHP X.Y UPGRADE NOTES
91103
10. Changes to INI File Handling
92104
========================================
93105

106+
- Core:
107+
Removed always_populate_raw_post_data.
94108

95109
========================================
96110
11. Other Changes

UPGRADING.INTERNALS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ UPGRADE NOTES - PHP X.Y
55
1. Internal API changes
66
a. Addition of do_operation and compare object handlers
77
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
8+
c. POST data handling
89

910
2. Build system changes
1011
a. Unix build system changes
@@ -57,6 +58,15 @@ UPGRADE NOTES - PHP X.Y
5758
The macros behave similarly to the non-FAST variants with copy=1 and
5859
dtor=0, but will try to return the zval without making a copy by utilizing
5960
return_value_ptr.
61+
62+
c. POST data handling
63+
64+
The sapi_request_info's members post_data, post_data_len and raw_post_data as
65+
well as raw_post_data_len have been replaced with a temp PHP stream
66+
request_body.
67+
68+
The recommended way to access raw POST data is to open and use a php://input
69+
stream wrapper. It is safe to be used concurrently and more than once.
6070

6171
========================
6272
2. Build system changes

Zend/acinclude.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
99
# non-working versions, e.g. "3.0 3.2";
1010
# remove "none" when introducing the first incompatible bison version an
1111
# separate any following additions by spaces
12-
bison_version_exclude="none"
12+
bison_version_exclude="3.0"
1313
1414
# for standalone build of Zend Engine
1515
test -z "$SED" && SED=sed

ext/date/lib/parse_date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25002,7 +25002,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
2500225002
TIMELIB_CHECK_NUMBER;
2500325003
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
2500425004
if (sec == TIMELIB_UNSET || length != 2) {
25005-
add_pbf_error(s, "A two second minute could not be found", string, begin);
25005+
add_pbf_error(s, "A two digit second could not be found", string, begin);
2500625006
} else {
2500725007
s->time->s = sec;
2500825008
}

ext/date/lib/parse_date.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
20092009
TIMELIB_CHECK_NUMBER;
20102010
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
20112011
if (sec == TIMELIB_UNSET || length != 2) {
2012-
add_pbf_error(s, "A two second minute could not be found", string, begin);
2012+
add_pbf_error(s, "A two digit second could not be found", string, begin);
20132013
} else {
20142014
s->time->s = sec;
20152015
}

ext/date/tests/bug64157.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
3+
--CREDITS--
4+
Boro Sitnikovski <[email protected]>
5+
--INI--
6+
date.timezone = UTC
7+
--FILE--
8+
<?php
9+
DateTime::createFromFormat('s', '0');
10+
$lastErrors = DateTime::getLastErrors();
11+
print_r($lastErrors['errors'][0]);
12+
?>
13+
--EXPECT--
14+
A two digit second could not be found

ext/filter/logical_filters.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
484484
}
485485
s++;
486486
}
487-
488-
if (*(e - 1) == '.') {
489-
goto bad_url;
490-
}
491487
}
492488

493489
if (
@@ -718,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
718714
if (flags & FILTER_FLAG_NO_RES_RANGE) {
719715
if (
720716
(ip[0] == 0) ||
717+
(ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
721718
(ip[0] == 128 && ip[1] == 0) ||
722719
(ip[0] == 191 && ip[1] == 255) ||
723720
(ip[0] == 169 && ip[1] == 254) ||

ext/filter/tests/018.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
1515
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
1616
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
1717
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
18+
var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
19+
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
1820
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
1921
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
2022
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
@@ -40,6 +42,8 @@ bool(false)
4042
string(12) "192.0.34.166"
4143
bool(false)
4244
string(9) "192.0.0.1"
45+
bool(false)
46+
bool(false)
4347
string(12) "192.0.34.166"
4448
bool(false)
4549
string(15) "255.255.255.255"

ext/filter/tests/bug64441.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
3+
--SKIPIF--
4+
<?php if (!extension_loaded("filter")) die("skip"); ?>
5+
--FILE--
6+
<?php
7+
var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
8+
var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
9+
--EXPECT--
10+
string(20) "http://example.com./"
11+
string(19) "http://example.com/"

ext/libxml/tests/bug61367-read.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ XML
3232
}
3333
}
3434

35-
var_dump(mkdir('test_bug_61367'));
36-
var_dump(mkdir('test_bug_61367/base'));
37-
var_dump(file_put_contents('test_bug_61367/bad', 'blah'));
38-
var_dump(chdir('test_bug_61367/base'));
35+
var_dump(mkdir('test_bug_61367-read'));
36+
var_dump(mkdir('test_bug_61367-read/base'));
37+
var_dump(file_put_contents('test_bug_61367-read/bad', 'blah'));
38+
var_dump(chdir('test_bug_61367-read/base'));
3939

4040
stream_wrapper_register( 'exploit', 'StreamExploiter' );
4141
$s = fopen( 'exploit://', 'r' );
4242

4343
?>
4444
--CLEAN--
4545
<?php
46-
unlink('test_bug_61367/bad');
47-
rmdir('test_bug_61367/base');
48-
rmdir('test_bug_61367');
46+
unlink('test_bug_61367-read/bad');
47+
rmdir('test_bug_61367-read/base');
48+
rmdir('test_bug_61367-read');
4949
?>
5050
--EXPECTF--
5151
bool(true)
5252
bool(true)
5353
int(4)
5454
bool(true)
5555

56-
Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file:///%s/test_bug_61367/bad" in %s on line %d
56+
Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file:///%s/test_bug_61367-read/bad" in %s on line %d
5757

5858
Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, line: 4 in %s on line %d
5959

ext/libxml/tests/bug61367-write.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ class StreamExploiter {
1919
}
2020
}
2121

22-
var_dump(mkdir('test_bug_61367'));
23-
var_dump(mkdir('test_bug_61367/base'));
24-
var_dump(file_put_contents('test_bug_61367/bad', 'blah'));
25-
var_dump(chdir('test_bug_61367/base'));
22+
var_dump(mkdir('test_bug_61367-write'));
23+
var_dump(mkdir('test_bug_61367-write/base'));
24+
var_dump(file_put_contents('test_bug_61367-write/bad', 'blah'));
25+
var_dump(chdir('test_bug_61367-write/base'));
2626

2727
stream_wrapper_register( 'exploit', 'StreamExploiter' );
2828
$s = fopen( 'exploit://', 'r' );
2929

3030
?>
3131
--CLEAN--
3232
<?php
33-
@unlink('test_bug_61367/bad');
34-
rmdir('test_bug_61367/base');
35-
rmdir('test_bug_61367');
33+
@unlink('test_bug_61367-write/bad');
34+
rmdir('test_bug_61367-write/base');
35+
rmdir('test_bug_61367-write');
3636
?>
3737
--EXPECTF--
3838
bool(true)

ext/mbstring/mb_gpc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
364364
{
365365
const mbfl_encoding *detected;
366366
php_mb_encoding_handler_info_t info;
367+
char *post_data_str = NULL;
367368

368369
MBSTRG(http_input_identify_post) = NULL;
369370

@@ -376,7 +377,10 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
376377
info.num_from_encodings = MBSTRG(http_input_list_size);
377378
info.from_language = MBSTRG(language);
378379

379-
detected = _php_mb_encoding_handler_ex(&info, arg, SG(request_info).post_data TSRMLS_CC);
380+
php_stream_rewind(SG(request_info).request_body);
381+
php_stream_copy_to_mem(SG(request_info).request_body, &post_data_str, PHP_STREAM_COPY_ALL, 0);
382+
detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str TSRMLS_CC);
383+
STR_FREE(post_data_str);
380384

381385
MBSTRG(http_input_identify) = detected;
382386
if (detected) {

ext/phar/tests/031.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ require $pname;
2222
===DONE===
2323
--CLEAN--
2424
<?php
25-
unlink(dirname(__FILE__) . '/files/phar_oo_test.phar.php');
25+
unlink(dirname(__FILE__) . '/files/031.phar.php');
2626
__halt_compiler();
2727
?>
2828
--EXPECTF--
2929
string(25) "<?php echo new new class;"
3030

31-
Parse error: %s in phar://%sphar_oo_test.phar.php/a.php on line %d
31+
Parse error: %s in phar://%s031.phar.php/a.php on line %d

ext/phar/tests/032.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ echo $e->getMessage();
2121
===DONE===
2222
--CLEAN--
2323
<?php
24-
unlink(dirname(__FILE__) . '/files/phar_oo_test.phar.php');
24+
unlink(dirname(__FILE__) . '/files/032.phar.php');
2525
__halt_compiler();
2626
?>
2727
--EXPECTF--
2828

29-
phar "%sphar_oo_test.phar.php" does not have a signature===DONE===
29+
phar "%s032.phar.php" does not have a signature===DONE===

ext/phar/tests/files/phar_oo_test.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
ini_set('date.timezone', 'GMT');
44

5-
$fname = dirname(__FILE__) . '/phar_oo_test.phar.php';
5+
$tname = basename(current(get_included_files()), ".php");
6+
$fname = dirname(__FILE__) . "/$tname.phar.php";
67
$pname = 'phar://' . $fname;
78
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
89

ext/phar/tests/phar_buildfromdirectory1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ phar.require_hash=0
77
phar.readonly=0
88
--FILE--
99
<?php
10-
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory.phar');
10+
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory1.phar');
1111
try {
1212
ini_set('phar.readonly', 1);
1313
$phar->buildFromDirectory(1);
@@ -19,7 +19,7 @@ try {
1919
===DONE===
2020
--CLEAN--
2121
<?php
22-
unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
22+
unlink(dirname(__FILE__) . '/buildfromdirectory1.phar');
2323
__HALT_COMPILER();
2424
?>
2525
--EXPECTF--

ext/phar/tests/phar_buildfromdirectory2-win.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ phar.readonly=0
1111
--FILE--
1212
<?php
1313
try {
14-
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory.phar');
14+
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory2.phar');
1515
$phar->buildFromDirectory(1);
1616
} catch (Exception $e) {
1717
var_dump(get_class($e));
@@ -21,7 +21,7 @@ try {
2121
===DONE===
2222
--CLEAN--
2323
<?php
24-
unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
24+
unlink(dirname(__FILE__) . '/buildfromdirectory2.phar');
2525
__HALT_COMPILER();
2626
?>
2727
--EXPECTF--

ext/phar/tests/phar_buildfromdirectory2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ phar.readonly=0
1111
--FILE--
1212
<?php
1313
try {
14-
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory.phar');
14+
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory2.phar');
1515
$phar->buildFromDirectory(1);
1616
} catch (Exception $e) {
1717
var_dump(get_class($e));
@@ -21,7 +21,7 @@ try {
2121
===DONE===
2222
--CLEAN--
2323
<?php
24-
unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
24+
unlink(dirname(__FILE__) . '/buildfromdirectory2.phar');
2525
__HALT_COMPILER();
2626
?>
2727
--EXPECTF--

ext/phar/tests/phar_buildfromdirectory3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ phar.readonly=0
99
<?php
1010

1111
try {
12-
$phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar');
12+
$phar = new Phar(dirname(__FILE__) . '/buildfromdirectory3.phar');
1313
$phar->buildFromDirectory('files', new stdClass);
1414
} catch (Exception $e) {
1515
var_dump(get_class($e));
@@ -19,7 +19,7 @@ try {
1919
===DONE===
2020
--CLEAN--
2121
<?php
22-
unlink(dirname(__FILE__) . '/buildfromiterator.phar');
22+
unlink(dirname(__FILE__) . '/buildfromdirectory3.phar');
2323
__HALT_COMPILER();
2424
?>
2525
--EXPECTF--

0 commit comments

Comments
 (0)