Skip to content

Commit 2adc335

Browse files
committed
Merge branch 'PHP-7.1' of git.php.net:php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:php-src: (134 commits) fix useless assignment avoid needless function call remove useless assignment remove unused assignment rewrite the getcwd part fix leak fix unused assignment remove duplicated symbol Revert 39587c4 8b7f594 Because of 24fdffd add extra test to protected behavior of compact and array string key order fix unintentional bc break with compact('this') behavior Fix some grammatical errors in PHP 7.1 Upgrade Notes Update NEWS Fixed bug #72982 (Memory leak in zend_accel_blacklist_update_regexp() function) Update NEWS and UPGRADING Revert "Revert "Implement RFC Add session_gc() https://wiki.php.net/rfc/session-gc"" Revert "Revert "Merge RFC https://wiki.php.net/rfc/session-create-id"" Revert "Revert "Add tests"" Revert "Fix NEWS" Fix bug #72940 properly. Reduce needless branches ...
2 parents 52cef90 + f1cf26e commit 2adc335

File tree

156 files changed

+3131
-587
lines changed

Some content is hidden

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

156 files changed

+3131
-587
lines changed

NEWS

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,90 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
?? ??? 2016, PHP 7.1.0RC1
3+
?? ??? 2016, PHP 7.1.0RC2
44

5+
- Opcache:
6+
. Fixed bug #72982 (Memory leak in zend_accel_blacklist_update_regexp()
7+
function). (Laruence)
8+
9+
10+
01 Sep 2016, PHP 7.1.0RC1
11+
12+
- Core:
13+
. Fixed bug #72944 (Null pointer deref in zval_delref_p). (Dmitry)
14+
. Fixed bug #72943 (assign_dim on string doesn't reset hval). (Laruence)
15+
. Fixed bug #72598 (Reference is lost after array_slice()) (Nikita)
16+
. Fixed bug #72703 (Out of bounds global memory read in BF_crypt triggered by
17+
password_verify). (Anatol)
18+
. Implement \ArgumentCountError when passing in too few arguments (Davey)
19+
20+
- COM:
21+
. Fixed bug #72922 (COM called from PHP does not return out parameters).
22+
(Anatol)
23+
24+
- Dba:
25+
. Fixed bug #70825 (Cannot fetch multiple values with group in ini file).
26+
(cmb)
27+
28+
- GD:
29+
. Fixed bug #66005 (imagecopy does not support 1bit transparency on truecolor
30+
images). (cmb)
31+
. Fixed bug #72913 (imagecopy() loses single-color transparency on palette
32+
images). (cmb)
33+
. Fixed bug #68716 (possible resource leaks in _php_image_convert()). (cmb)
534

35+
- iconv:
36+
. Fixed bug #72320 (iconv_substr returns false for empty strings). (cmb)
37+
38+
- Intl:
39+
. Fixed bug #65732 (grapheme_*() is not Unicode compliant on CR LF
40+
sequence). (cmb)
41+
42+
- JSON:
43+
. Implemented earlier return when json_encode fails, fixes bugs #68992
44+
(Stacking exceptions thrown by JsonSerializable) and #70275 (On recursion
45+
error, json_encode can eat up all system memory). (Jakub Zelenka)
46+
47+
- mbstring:
48+
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
49+
50+
- Opcache:
51+
. Fixed bug #72949 (Typo in opcache error message). (cmb)
52+
53+
- PDO_DBlib:
54+
. Implemented stringify 'uniqueidentifier' fields.
55+
(Alexander Zhuravlev, Adam Baratz)
56+
57+
- Reflection:
58+
. Reverted prepending \ for class names. (Trowski)
59+
60+
- Session:
61+
. Fixed bug #72940 (SID always return "name=ID", even if session
62+
cookie exist). (Yasuo)
63+
. Implemented session_gc() (Yasuo)
64+
https://wiki.php.net/rfc/session-create-id
65+
. Implemented session_create_id() (Yasuo)
66+
https://wiki.php.net/rfc/session-gc
67+
68+
- SimpleXML:
69+
. Fixed bug #72971 (SimpleXML isset/unset do not respect namespace). (Nikita)
70+
. Fixed bug #72957 (Null coalescing operator doesn't behave as expected with
71+
SimpleXMLElement). (Nikita)
72+
73+
- SOAP:
74+
. Fixed bug #71711 (Soap Server Member variables reference bug). (Nikita)
75+
. Fixed bug #71996 (Using references in arrays doesn't work like expected).
76+
(Nikita)
77+
78+
- Standard:
79+
. Fixed bug #72920 (Accessing a private constant using constant() creates
80+
an exception AND warning). (Laruence)
81+
. Fixed bug #65550 (get_browser() incorrectly parses entries with "+" sign).
82+
(cmb)
83+
. Fixed bug #71882 (Negative ftruncate() on php://memory exhausts memory).
84+
(cmb)
85+
86+
- XML:
87+
. Fixed bug #72714 (_xml_startElementHandler() segmentation fault). (cmb)
688

789
18 Aug 2016, PHP 7.1.0beta3
890

@@ -18,6 +100,8 @@ PHP NEWS
18100
. Fixed bug #72681 (PHP Session Data Injection Vulnerability). (Stas)
19101
. Fixed bug #72742 (memory allocator fails to realloc small block to large
20102
one). (Stas)
103+
. Fixed URL rewriter. It would not rewrite '//example.com/' URL
104+
unconditionally. URL rewrite target hosts whitelist is implemented. (Yasuo)
21105

22106
- Bz2:
23107
. Fixed bug #72837 (integer overflow in bzdecompress caused heap
@@ -59,8 +143,10 @@ PHP NEWS
59143
- Reflection:
60144
. Implemented request #38992 (invoke() and invokeArgs() static method calls
61145
should match). (cmb).
62-
. Add ReflectionNamedType::getName() and return leading "?" for nullable types
63-
from ReflectionType::__toString(). (Trowski)
146+
. Add ReflectionNamedType::getName(). This method should be used instead of
147+
ReflectionType::__toString()
148+
. Prepend \ for class names and ? for nullable types returned from
149+
ReflectionType::__toString(). (Trowski)
64150

65151
- Session:
66152
. Implemented RFC: Session ID without hashing. (Yasuo)

TSRM/tsrm_win32.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,12 @@ TSRM_API int shmget(int key, int size, int flags)
672672
}
673673
} else {
674674
if (flags & IPC_EXCL) {
675+
if (shm_handle) {
676+
CloseHandle(shm_handle);
677+
}
678+
if (info_handle) {
679+
CloseHandle(info_handle);
680+
}
675681
return -1;
676682
}
677683
}

UPGRADING

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PHP 7.1 UPGRADE NOTES
6161
. Fixes to random number generators mean that mt_rand() now produces a
6262
different sequence of outputs to previous versions. If you relied on
6363
mt_srand() to produce a deterministic sequence, it can be called using
64-
mt_srand($seed, MT_RAND_PHP) to produce old the sequences.
64+
mt_srand($seed, MT_RAND_PHP) to produce the old sequences.
6565
. URL rewriter has been improved.
6666
. Use dedicated buffer for Session module rewrite and User rewrite.
6767
. Full path URL rewrite is supported. Allowed domain can be specified.
@@ -122,7 +122,7 @@ PHP 7.1 UPGRADE NOTES
122122

123123
- Reflection:
124124
. The behavior of ReflectionMethod::invoke() and ::invokeArgs() has been
125-
aligned, what causes slightly different behavior than before for some
125+
aligned, which causes slightly different behavior than before for some
126126
pathological cases.
127127
. ReflectionType::__toString() will now return the type name with a leading
128128
"?" if it is nullable. To retrieve the type name without leading "?" the new
@@ -236,6 +236,12 @@ PHP 7.1 UPGRADE NOTES
236236
. Added pcntl_signal_get_handler() that returns the current signal handler
237237
for a particular signal.
238238

239+
- Session:
240+
. Added session_gc() that performs session data garbage collection.
241+
https://wiki.php.net/rfc/session-gc
242+
. Added session_create_id() for creating custom session ID.
243+
https://wiki.php.net/rfc/session-create-id
244+
239245
- Standard:
240246
. Added is_iterable() that determines if a value will be accepted by the new
241247
iterable pseudo-type.
@@ -262,7 +268,7 @@ PHP 7.1 UPGRADE NOTES
262268

263269
- DBA:
264270
. Data modification functions (e.g.: dba_insert()) now throw an instance of
265-
Error instead of triggering a catchable fatal error if the key is does not
271+
Error instead of triggering a catchable fatal error if the key does not
266272
contain exactly two elements.
267273

268274
- DOM:

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ changes. See: https://wiki.php.net/phpng-upgrading
8282
a. Unix build system changes
8383

8484
b. Windows build system changes
85+
Static analysis with clang and Cppcheck is supported by passing "clang" or
86+
"cppcheck" keyword to the --with-analyzer configure option.
8587

8688
========================
8789
3. Module changes

Zend/tests/bug38047.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Non-static method A::A_ftk() should not be called statically
4444
2 %sbug38047.php:36 kalus_error_handler()
4545

4646

47-
Fatal error: Uncaught Error: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7
47+
Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7
4848
Stack trace:
4949
#0 %sbug38047.php(36): A::A_ftk()
5050
#1 {main}

Zend/tests/bug55705.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function f(callable $c) {}
66
f();
77
?>
88
--EXPECTF--
9-
Fatal error: Uncaught Error: Too few arguments to function f(), 0 passed in %s on line 3 and exactly 1 expected in %s:2
9+
Fatal error: Uncaught ArgumentCountError: Too few arguments to function f(), 0 passed in %s on line 3 and exactly 1 expected in %s:2
1010
Stack trace:
1111
#0 %s(%d): f()
1212
#1 {main}

Zend/tests/bug70689.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ try {
1919

2020
?>
2121
--EXPECTF--
22-
Fatal error: Uncaught Error: Too few arguments to function foo(), 0 passed in %sbug70689.php on line 12 and exactly 1 expected in %sbug70689.php:3
22+
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 0 passed in %sbug70689.php on line 12 and exactly 1 expected in %sbug70689.php:3
2323
Stack trace:
2424
#0 %sbug70689.php(12): foo()
2525
#1 {main}

Zend/tests/bug72598.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #72598 (Reference is lost after array_slice())
3+
--FILE--
4+
<?php
5+
function ref(&$ref) {
6+
var_dump($ref);
7+
}
8+
9+
new class {
10+
function __construct() {
11+
$args = [&$this];
12+
for ($i = 0; $i < 2; $i++) {
13+
$a = array_slice($args, 0, 1);
14+
call_user_func_array('ref', $a);
15+
}
16+
}
17+
};
18+
?>
19+
--EXPECTF--
20+
Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
21+
object(class@anonymous)#1 (0) {
22+
}
23+
24+
Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
25+
object(class@anonymous)#1 (0) {
26+
}

Zend/tests/bug72598_2.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #72598.2 (Reference is lost after array_slice())
3+
--FILE--
4+
<?php
5+
function ref(&$ref) {
6+
var_dump($ref);
7+
$ref = 1;
8+
}
9+
10+
new class {
11+
function __construct() {
12+
$b = 0;
13+
$args = [&$b];
14+
unset($b);
15+
for ($i = 0; $i < 2; $i++) {
16+
$a = array_slice($args, 0, 1);
17+
call_user_func_array('ref', $a);
18+
}
19+
}
20+
};
21+
?>
22+
--EXPECTF--
23+
Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598_2.php on line 14
24+
int(0)
25+
26+
Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598_2.php on line 14
27+
int(0)

Zend/tests/bug72911.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
3+
--FILE--
4+
<?php
5+
6+
$a = 0;
7+
8+
$b = $a->b->i -= 0;
9+
10+
var_dump($b);
11+
12+
?>
13+
--EXPECTF--
14+
Warning: Attempt to modify property of non-object in %sbug72911.php on line %d
15+
16+
Warning: Attempt to assign property of non-object in %sbug72911.php on line %d
17+
NULL

Zend/tests/bug72943.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #72943 (assign_dim on string doesn't reset hval)
3+
--FILE--
4+
<?php
5+
$array = array("test" => 1);
6+
7+
$a = "lest";
8+
var_dump($array[$a]);
9+
$a[0] = "f";
10+
var_dump($array[$a]);
11+
$a[0] = "t";
12+
var_dump($array[$a]);
13+
?>
14+
--EXPECTF--
15+
Notice: Undefined index: lest in %sbug72943.php on line %d
16+
NULL
17+
18+
Notice: Undefined index: fest in %sbug72943.php on line %d
19+
NULL
20+
int(1)

Zend/tests/bug72944.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #72944 (Null pointer deref in zval_delref_p).
3+
--FILE--
4+
<?php
5+
"a"== e & $A = $A? 0 : 0 ?:0;
6+
echo "OK\n";
7+
?>
8+
--EXPECTF--
9+
Notice: Use of undefined constant e - assumed 'e' in %sbug72944.php on line 2
10+
11+
Notice: Undefined variable: A in %sbug72944.php on line 2
12+
OK

Zend/tests/call_user_func_008.phpt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
call_user_func() behavior with references
3+
--FILE--
4+
<?php
5+
6+
function test(&$ref1, &$ref2) {
7+
$ref1 += 42;
8+
$ref2 -= 42;
9+
return true;
10+
}
11+
12+
$i = $j = 0;
13+
var_dump(call_user_func('test', $i, $j));
14+
var_dump($i, $j);
15+
16+
var_dump(call_user_func_array('test', [$i, $j]));
17+
var_dump($i, $j);
18+
19+
$x =& $i; $y =& $j;
20+
var_dump(call_user_func('test', $i, $j));
21+
var_dump($i, $j);
22+
23+
var_dump(call_user_func_array('test', [$i, $j]));
24+
var_dump($i, $j);
25+
26+
?>
27+
--EXPECTF--
28+
Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
29+
30+
Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
31+
bool(true)
32+
int(0)
33+
int(0)
34+
35+
Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
36+
37+
Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
38+
bool(true)
39+
int(0)
40+
int(0)
41+
42+
Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
43+
44+
Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
45+
bool(true)
46+
int(0)
47+
int(0)
48+
49+
Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
50+
51+
Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
52+
bool(true)
53+
int(0)
54+
int(0)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Call function with correct number of arguments
3+
--FILE--
4+
<?php
5+
function foo() { }
6+
foo();
7+
8+
function bar($foo, $bar) { }
9+
bar(1, 2);
10+
11+
function bat(int $foo, string $bar) { }
12+
bat(123, "foo");
13+
bat("123", "foo");
14+
15+
$fp = fopen(__FILE__, "r");
16+
fclose($fp);
17+
18+
echo "done";
19+
--EXPECT--
20+
done

0 commit comments

Comments
 (0)