mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 19:20:50 +00:00
Compare commits
208
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1daa19750 | ||
|
|
a0f6c5474e | ||
|
|
d84f56a4a7 | ||
|
|
d99c019535 | ||
|
|
e88dcdcdc8 | ||
|
|
5ffcee9d48 | ||
|
|
1fb7c0a459 | ||
|
|
15236fb83e | ||
|
|
4e198c0064 | ||
|
|
e41867888a | ||
|
|
dfb3a79914 | ||
|
|
1d8ddf6c49 | ||
|
|
1b5268265c | ||
|
|
2d4aa1ef3d | ||
|
|
e6b2a97cac | ||
|
|
5dcb8f2f1c | ||
|
|
ababa22136 | ||
|
|
5a201ddad0 | ||
|
|
3a5b22e3b5 | ||
|
|
d0d9c3a980 | ||
|
|
07cb665515 | ||
|
|
2a334f1655 | ||
|
|
4ebc04ca9d | ||
|
|
e0a14bce77 | ||
|
|
e8d36ce762 | ||
|
|
2dabc4c305 | ||
|
|
46a49be6c8 | ||
|
|
2f4a2a9316 | ||
|
|
1848ccdae2 | ||
|
|
8516434a56 | ||
|
|
658ad4d046 | ||
|
|
c70a938f28 | ||
|
|
0fc65ed133 | ||
|
|
573ad182d2 | ||
|
|
81811dbbfb | ||
|
|
54dbd3eccc | ||
|
|
c6fd37cee3 | ||
|
|
2e9e706a82 | ||
|
|
605ee9c8eb | ||
|
|
a07c1f56aa | ||
|
|
f92a03627a | ||
|
|
37612936a1 | ||
|
|
9560e3ba7a | ||
|
|
cd2afd99b1 | ||
|
|
1f6f9c70cb | ||
|
|
8bb2f406de | ||
|
|
41e11a8e71 | ||
|
|
488e53c18b | ||
|
|
932b735822 | ||
|
|
778902db63 | ||
|
|
dfaa4768d2 | ||
|
|
8f7c529720 | ||
|
|
42b6b8a3ae | ||
|
|
44ade0e875 | ||
|
|
b396fb348b | ||
|
|
ad750c3bb6 | ||
|
|
c45985d266 | ||
|
|
376bbbdf3b | ||
|
|
45ed9b42a5 | ||
|
|
e948188832 | ||
|
|
5ae657b296 | ||
|
|
8daf79215d | ||
|
|
62dce97973 | ||
|
|
296030119c | ||
|
|
247105ae1a | ||
|
|
8e2f219fad | ||
|
|
1b7ee6db88 | ||
|
|
b087bd2404 | ||
|
|
75ac3f1cba | ||
|
|
1ff981d7a6 | ||
|
|
5ff15e2651 | ||
|
|
358721bcf7 | ||
|
|
0487bcfac7 | ||
|
|
bf3e772361 | ||
|
|
d179e34e42 | ||
|
|
571f6a598f | ||
|
|
923a14626c | ||
|
|
3324bb893e | ||
|
|
86e7aa20ad | ||
|
|
063082043a | ||
|
|
5dd1877ca1 | ||
|
|
74de17f2ea | ||
|
|
bb54694f4f | ||
|
|
6b6c2c003c | ||
|
|
5ab7b30cd6 | ||
|
|
844a2dd6ac | ||
|
|
10df94dd0e | ||
|
|
fcd26ffcc3 | ||
|
|
81fffa86b2 | ||
|
|
b2a33ab06b | ||
|
|
1b21b56074 | ||
|
|
8f9f308bb9 | ||
|
|
46d62e5464 | ||
|
|
3877172411 | ||
|
|
f7c43b8c72 | ||
|
|
48d712565c | ||
|
|
ff14b7adad | ||
|
|
499bf91cd0 | ||
|
|
3e8172d27b | ||
|
|
1ae80f8c92 | ||
|
|
5885eecf23 | ||
|
|
f6d7af21a3 | ||
|
|
a0c231c0f5 | ||
|
|
8bda799d6f | ||
|
|
981af26d7b | ||
|
|
2fe2e5b48f | ||
|
|
5c5508698d | ||
|
|
2fa4ca95db | ||
|
|
4609ded082 | ||
|
|
183b853dc6 | ||
|
|
dc108feab8 | ||
|
|
66d9f4d985 | ||
|
|
9d9dffe60a | ||
|
|
1b0a2bb0f5 | ||
|
|
07cb2755be | ||
|
|
81e31eff0b | ||
|
|
4723bd4ffa | ||
|
|
5b8b480d23 | ||
|
|
a06eed0c0e | ||
|
|
2830c3ef52 | ||
|
|
0af3f49312 | ||
|
|
2d087210eb | ||
|
|
fa9bd812fc | ||
|
|
fab2c3ba86 | ||
|
|
5be670265b | ||
|
|
a35379de2e | ||
|
|
2cbc94097e | ||
|
|
06ade15528 | ||
|
|
99645f5352 | ||
|
|
8fd79d3574 | ||
|
|
3b86be23e6 | ||
|
|
6a1bd57df5 | ||
|
|
6bf8ff6d97 | ||
|
|
da786a22af | ||
|
|
9d9fa32fe5 | ||
|
|
12db8b90a7 | ||
|
|
a2604e628f | ||
|
|
b69a98cfb3 | ||
|
|
25bdf9d3e0 | ||
|
|
741daa8605 | ||
|
|
58ab49111e | ||
|
|
34e7d78df7 | ||
|
|
fcfa0a46c3 | ||
|
|
4cc4f9c00a | ||
|
|
ef773bf4d5 | ||
|
|
b6e45b58d7 | ||
|
|
ee75524bff | ||
|
|
6a5f8512ac | ||
|
|
c4677af67e | ||
|
|
9bbe236f6a | ||
|
|
09be6394ad | ||
|
|
4221e000b1 | ||
|
|
6b8ffdbdeb | ||
|
|
dc1107ba5b | ||
|
|
f3a43e85e7 | ||
|
|
8b4da1774f | ||
|
|
c0fac0357c | ||
|
|
fdf6b0fefe | ||
|
|
6f0c3386d4 | ||
|
|
17d64af186 | ||
|
|
cf855ede8a | ||
|
|
07aeb9171d | ||
|
|
4d2560dd6a | ||
|
|
9c3171f019 | ||
|
|
d4b32e82c8 | ||
|
|
5b29af5c78 | ||
|
|
ff577b04c0 | ||
|
|
7355ab8176 | ||
|
|
fce8061ede | ||
|
|
1e0bc6e30f | ||
|
|
4b84a1f9e0 | ||
|
|
d95c53834c | ||
|
|
2bcc419800 | ||
|
|
f8ff8bb767 | ||
|
|
57ad5b3432 | ||
|
|
c6d539ae01 | ||
|
|
99c48a2477 | ||
|
|
826b90a5f0 | ||
|
|
f8792443a2 | ||
|
|
678f5b6068 | ||
|
|
e767ca60a0 | ||
|
|
12bd3cc146 | ||
|
|
0b8c83f593 | ||
|
|
e1f6ab3388 | ||
|
|
9a744c66e7 | ||
|
|
e0ebe56ebf | ||
|
|
c756f82c02 | ||
|
|
1ba88355d7 | ||
|
|
52eebc5afd | ||
|
|
fef5a9e502 | ||
|
|
efe6d96b45 | ||
|
|
f02507469d | ||
|
|
1aeff522b8 | ||
|
|
85a26fef11 | ||
|
|
d5b59b4303 | ||
|
|
68aa1329eb | ||
|
|
6f18d7e2f9 | ||
|
|
877a351ea8 | ||
|
|
27bd16e71f | ||
|
|
874284d1c9 | ||
|
|
c39f5fe94e | ||
|
|
3deb6b555a | ||
|
|
15efb96d4c | ||
|
|
0a59a71947 | ||
|
|
6b99a8be4d | ||
|
|
c1a80e075a | ||
|
|
657a832a77 | ||
|
|
973be68c63 |
No files matched your search
@@ -1,6 +1,105 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2020, PHP 7.4.9
|
||||
01 Oct 2020, PHP 7.4.11
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-`
|
||||
cookies can be sent). (CVE-2020-7070) (Stas)
|
||||
. Fixed bug #79979 (passing value to by-ref param via CUFA crashes). (cmb,
|
||||
Nikita)
|
||||
. Fixed bug #80037 (Typed property must not be accessed before initialization
|
||||
when __get() declared). (Nikita)
|
||||
. Fixed bug #80048 (Bug #69100 has not been fixed for Windows). (cmb)
|
||||
. Fixed bug #80049 (Memleak when coercing integers to string via variadic
|
||||
argument). (Nikita)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
|
||||
(Andy Postnikov)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #64130 (COM obj parameters passed by reference are not updated).
|
||||
(cmb)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #80002 (calc free space for new interned string is wrong).
|
||||
(t-matsuno)
|
||||
. Fixed bug #80046 (FREE for SWITCH_STRING optimized away). (Nikita)
|
||||
. Fixed bug #79825 (opcache.file_cache causes SIGSEGV when custom opcode
|
||||
handlers changed). (SammyK)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12
|
||||
bytes IV). (CVE-2020-7069) (Jakub Zelenka)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #80027 (Terrible performance using $query->fetch on queries with
|
||||
many bind parameters (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
|
||||
. Fixed bug #80077 (getmxrr test bug). (Rainer Jung)
|
||||
. Fixed bug #72941 (Modifying bucket->data by-ref has no effect any longer).
|
||||
(cmb)
|
||||
. Fixed bug #80067 (Omitting the port in bindto setting errors). (cmb)
|
||||
|
||||
03 Sep 2020, PHP 7.4.10
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79884 (PHP_CONFIG_FILE_PATH is meaningless). (cmb)
|
||||
. Fixed bug #77932 (File extensions are case-sensitive). (cmb)
|
||||
. Fixed bug #79806 (realpath() erroneously resolves link to link). (cmb)
|
||||
. Fixed bug #79895 (PHP_CHECK_GCC_ARG does not allow flags with equal sign).
|
||||
(Santiago M. Mola)
|
||||
. Fixed bug #79919 (Stack use-after-scope in define()). (cmb)
|
||||
. Fixed bug #79934 (CRLF-only line in heredoc causes parsing error).
|
||||
(Pieter van den Ham)
|
||||
. Fixed bug #79947 (Memory leak on invalid offset type in compound
|
||||
assignment). (Nikita)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #48585 (com_load_typelib holds reference, fails on second call).
|
||||
(cmb)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #75785 (Many errors from exif_read_data).
|
||||
(Níckolas Daniel da Silva)
|
||||
|
||||
- Gettext:
|
||||
. Fixed bug #70574 (Tests fail due to relying on Linux fallback behavior for
|
||||
gettext()). (Florian Engelhardt)
|
||||
|
||||
- LDAP:
|
||||
. Fixed memory leaks. (ptomulik)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #73060 (php failed with error after temp folder cleaned up).
|
||||
(cmb)
|
||||
. Fixed bug #79917 (File cache segfault with a static variable in inherited
|
||||
method). (Nikita)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #64705 (errorInfo property of PDOException is null when
|
||||
PDO::__construct() fails). (Ahmed Abdou)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #79724 (Return type does not match in ext/session/mod_mm.c).
|
||||
(Nikita)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79930 (array_merge_recursive() crashes when called with array
|
||||
with single reference). (Nikita)
|
||||
. Fixed bug #79944 (getmxrr always returns true on Alpine linux). (Nikita)
|
||||
. Fixed bug #79951 (Memory leak in str_replace of empty string). (Nikita)
|
||||
|
||||
- XML:
|
||||
. Fixed bug #79922 (Crash after multiple calls to xml_parser_free()). (cmb)
|
||||
|
||||
06 Aug 2020, PHP 7.4.9
|
||||
|
||||
- Apache:
|
||||
. Fixed bug #79030 (Upgrade apache2handler's php_apache_sapi_get_request_time
|
||||
@@ -12,6 +111,8 @@ PHP NEWS
|
||||
(cmb)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79877 (getimagesize function silently truncates after a null
|
||||
byte) (cmb)
|
||||
. Fixed bug #79740 (serialize() and unserialize() methods can not be called
|
||||
statically). (Nikita)
|
||||
. Fixed bug #79783 (Segfault in php_str_replace_common). (Nikita)
|
||||
@@ -39,6 +140,13 @@ PHP NEWS
|
||||
- Mbstring:
|
||||
. Fixed bug #79787 (mb_strimwidth does not trim string). (XXiang)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79881 (Memory leak in openssl_pkey_get_public()). (Nikita)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #79797 (Use of freed hash key in the phar_parse_zipfile
|
||||
function). (CVE-2020-7068) (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #79487 (::getStaticProperties() ignores property modifications).
|
||||
(cmb, Nikita)
|
||||
|
||||
@@ -125,6 +125,11 @@ DOM:
|
||||
After: ReflectionMethod::getClosure($object = null)
|
||||
The new signature is also (LSP) compatible with older PHP versions.
|
||||
|
||||
- SAPI:
|
||||
. Starting with 7.4.11, incoming cookie names are not url-decoded. This was never
|
||||
required by the standard, outgoing cookie names aren't encoded and this leads
|
||||
to security issues (CVE-2020-7070).
|
||||
|
||||
- SPL:
|
||||
. Calling get_object_vars() on an ArrayObject instance will now always return
|
||||
the properties of the ArrayObject itself (or a subclass). Previously it
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Assign concat of array and empty string
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = [0];
|
||||
$a .= '';
|
||||
var_dump($a);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
string(5) "Array"
|
||||
@@ -26,7 +26,7 @@ namespace N2 {
|
||||
echo $a->hello(), PHP_EOL;
|
||||
echo $a->foo(), PHP_EOL;
|
||||
try {
|
||||
} catch(namespace \Foo $e)
|
||||
} catch(namespace\Foo $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #79919 (Stack use-after-scope in define())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$b = error_log(0);
|
||||
$b = simplexml_load_string('<xml/>', null, $b);
|
||||
define(0, $b);
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #79934: CRLF-only line in heredoc causes parsing error
|
||||
--DESCRIPTION--
|
||||
This test covers different variations of whitespace-only lines in heredoc strings.
|
||||
These whitespace-only lines should be ignored when stripping indentation.
|
||||
--FILE--
|
||||
<?php
|
||||
// lines with only CRLF should not cause a parse error
|
||||
eval("\$s1 = <<<HEREDOC\r\n a\r\n\r\n b\r\n HEREDOC;");
|
||||
var_dump(addcslashes($s1, "\r\n"));
|
||||
|
||||
// lines with only a LF should not cause a parse error
|
||||
eval("\$s2 = <<<HEREDOC\n a\n\n b\n HEREDOC;");
|
||||
var_dump(addcslashes($s2, "\n"));
|
||||
|
||||
// lines with only a CR should not cause a parse error
|
||||
eval("\$s3 = <<<HEREDOC\r a\r\r b\r HEREDOC;");
|
||||
var_dump(addcslashes($s3, "\r"));
|
||||
|
||||
// lines with only whitespace should not cause a parse error
|
||||
eval("\$s4 = <<<HEREDOC\r a\r\n \r\n b\r HEREDOC;");
|
||||
var_dump(addcslashes($s4, "\n\r"));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "a\r\n\r\nb"
|
||||
string(6) "a\n\nb"
|
||||
string(6) "a\r\rb"
|
||||
string(10) "a\r\n\r\nb"
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #79947: Memory leak on invalid offset type in compound assignment
|
||||
--FILE--
|
||||
<?php
|
||||
$array = [];
|
||||
$key = [];
|
||||
$array[$key] += [$key];
|
||||
var_dump($array);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Illegal offset type in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #79979 (passing value to by-ref param via CUF(A) crashes)
|
||||
--FILE--
|
||||
<?php
|
||||
call_user_func_array("str_replace", ["a", "b", "c", 0]);
|
||||
|
||||
$cufa = "call_user_func_array";
|
||||
$cufa("str_replace", ["a", "b", "c", 0]);
|
||||
|
||||
call_user_func_array($cufa, ["str_replace", ["a", "b", "c", 0]]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
|
||||
|
||||
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
|
||||
|
||||
Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
|
||||
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Bug #80037: Typed property must not be accessed before initialization when __get() declared
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
final class A
|
||||
{
|
||||
public string $a;
|
||||
|
||||
public static function fromArray(array $props): self
|
||||
{
|
||||
$me = new static;
|
||||
foreach ($props as $k => &$v) {
|
||||
$me->{$k} = &$v; # try to remove &
|
||||
}
|
||||
return $me;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
throw new \LogicException("Property '$name' is not defined.");
|
||||
}
|
||||
}
|
||||
|
||||
var_dump(A::fromArray(['a' => 'foo']));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(A)#1 (1) {
|
||||
["a"]=>
|
||||
string(3) "foo"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #80046: FREE for SWITCH_STRING optimized away
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($foo) {
|
||||
switch ($foo . 'Bar') {
|
||||
case 'A':
|
||||
throw new Exception('A');
|
||||
default:
|
||||
throw new Exception('Default');
|
||||
}
|
||||
}
|
||||
try {
|
||||
test('Foo');
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Default
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #80049: Memleak when coercing integers to string via variadic argument
|
||||
--FILE--
|
||||
<?php
|
||||
function coerceToString(string ...$strings) {
|
||||
var_dump($strings);
|
||||
}
|
||||
coerceToString(...[123]);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(3) "123"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
EX(func) can be null during write_property in an edge case
|
||||
--FILE--
|
||||
<?php
|
||||
class a {
|
||||
public static $i = 0;
|
||||
function __destruct() {
|
||||
if (self::$i++ != 0) throw new Exception;
|
||||
$b = new a;
|
||||
echo $b;
|
||||
}
|
||||
}
|
||||
new a;
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Object of class a could not be converted to string in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): a->__destruct()
|
||||
#1 {main}
|
||||
|
||||
Next Exception in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): a->__destruct()
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Exception thrown by __get() during =& assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
private $x;
|
||||
public function &__get($name) {
|
||||
throw new Exception("Foobar");
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
$y = 5;
|
||||
try {
|
||||
$test->x =& $y;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Foobar
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Yield from non-iterable
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
yield from new stdClass;
|
||||
}
|
||||
|
||||
try {
|
||||
gen()->current();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Can use "yield from" only with arrays and Traversables
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Exception from valid() during yield from
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class FooBar implements Iterator {
|
||||
function rewind() {}
|
||||
function current() {}
|
||||
function key() {}
|
||||
function next() {}
|
||||
function valid() {
|
||||
throw new Exception("Exception from valid()");
|
||||
}
|
||||
}
|
||||
|
||||
function gen() {
|
||||
try {
|
||||
// the fact that the yield from result is used is relevant.
|
||||
var_dump(yield from new FooBar);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$x = gen();
|
||||
$x->current();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Exception from valid()
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
String offset error during list() by-ref assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = [0];
|
||||
$v = 'b';
|
||||
$i = 0;
|
||||
list(&$a[$i++]) = $v;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Regression test for incorrect update of pi node users when removing a predecessor block
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test() {
|
||||
for (; $n--; )
|
||||
C;
|
||||
}
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: n in %s on line %d
|
||||
@@ -6,6 +6,7 @@ No warnings should be thrown during heredoc scan-ahead
|
||||
<<<TEST
|
||||
${x}
|
||||
\400
|
||||
${"\400"}
|
||||
${/*}
|
||||
TEST;
|
||||
|
||||
@@ -15,6 +16,8 @@ Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
|
||||
|
||||
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
|
||||
|
||||
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
|
||||
|
||||
Warning: Unterminated comment starting line %d in %s on line %d
|
||||
|
||||
Parse error: syntax error, unexpected end of file in %s on line %d
|
||||
@@ -1086,6 +1086,11 @@ void zend_shutdown(void) /* {{{ */
|
||||
CG(map_ptr_base) = NULL;
|
||||
CG(map_ptr_size) = 0;
|
||||
}
|
||||
if (CG(script_encoding_list)) {
|
||||
free(CG(script_encoding_list));
|
||||
CG(script_encoding_list) = NULL;
|
||||
CG(script_encoding_list_size) = 0;
|
||||
}
|
||||
#endif
|
||||
zend_destroy_rsrc_list_dtors();
|
||||
}
|
||||
|
||||
+4
-41
@@ -4367,7 +4367,7 @@ ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
|
||||
{
|
||||
current->handling = EG(error_handling);
|
||||
current->exception = EG(exception_class);
|
||||
ZVAL_COPY(¤t->user_handler, &EG(user_error_handler));
|
||||
ZVAL_UNDEF(¤t->user_handler);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4375,54 +4375,17 @@ ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling,
|
||||
{
|
||||
if (current) {
|
||||
zend_save_error_handling(current);
|
||||
if (error_handling != EH_NORMAL && Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
|
||||
zval_ptr_dtor(&EG(user_error_handler));
|
||||
ZVAL_UNDEF(&EG(user_error_handler));
|
||||
}
|
||||
}
|
||||
ZEND_ASSERT(error_handling == EH_THROW || exception_class == NULL);
|
||||
EG(error_handling) = error_handling;
|
||||
EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int same_zval(zval *zv1, zval *zv2) /* {{{ */
|
||||
{
|
||||
if (Z_TYPE_P(zv1) != Z_TYPE_P(zv2)) {
|
||||
return 0;
|
||||
}
|
||||
switch (Z_TYPE_P(zv1)) {
|
||||
case IS_UNDEF:
|
||||
case IS_NULL:
|
||||
case IS_FALSE:
|
||||
case IS_TRUE:
|
||||
return 1;
|
||||
case IS_LONG:
|
||||
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
|
||||
case IS_DOUBLE:
|
||||
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
|
||||
case IS_STRING:
|
||||
case IS_ARRAY:
|
||||
case IS_OBJECT:
|
||||
case IS_RESOURCE:
|
||||
return Z_COUNTED_P(zv1) == Z_COUNTED_P(zv2);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
EG(exception_class) = exception_class;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API void zend_restore_error_handling(zend_error_handling *saved) /* {{{ */
|
||||
{
|
||||
EG(error_handling) = saved->handling;
|
||||
EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL;
|
||||
if (Z_TYPE(saved->user_handler) != IS_UNDEF
|
||||
&& !same_zval(&saved->user_handler, &EG(user_error_handler))) {
|
||||
zval_ptr_dtor(&EG(user_error_handler));
|
||||
ZVAL_COPY_VALUE(&EG(user_error_handler), &saved->user_handler);
|
||||
} else if (Z_TYPE(saved->user_handler)) {
|
||||
zval_ptr_dtor(&saved->user_handler);
|
||||
}
|
||||
ZVAL_UNDEF(&saved->user_handler);
|
||||
EG(exception_class) = saved->exception;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -895,9 +895,7 @@ repeat:
|
||||
case IS_OBJECT:
|
||||
if (Z_TYPE(val_free) == IS_UNDEF) {
|
||||
if (Z_OBJ_HT_P(val)->get) {
|
||||
zval rv;
|
||||
val = Z_OBJ_HT_P(val)->get(val, &rv);
|
||||
ZVAL_COPY_VALUE(&val_free, val);
|
||||
val = Z_OBJ_HT_P(val)->get(val, &val_free);
|
||||
goto repeat;
|
||||
} else if (Z_OBJ_HT_P(val)->cast_object) {
|
||||
if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING) == SUCCESS) {
|
||||
|
||||
+5
-4
@@ -1512,6 +1512,7 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(EXECUTE_DATA_D)
|
||||
msg = "Cannot create references to/from string offsets";
|
||||
break;
|
||||
}
|
||||
opline++;
|
||||
}
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE();
|
||||
@@ -2051,8 +2052,6 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_s
|
||||
|
||||
static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
|
||||
{
|
||||
zend_free_op free_op_data1;
|
||||
|
||||
if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
|
||||
if (opline->op2_type == IS_UNUSED) {
|
||||
zend_use_new_element_for_string();
|
||||
@@ -2063,8 +2062,6 @@ static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim
|
||||
} else if (EXPECTED(!Z_ISERROR_P(container))) {
|
||||
zend_use_scalar_as_array();
|
||||
}
|
||||
get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
|
||||
FREE_OP(free_op_data1);
|
||||
}
|
||||
|
||||
static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC)
|
||||
@@ -2876,6 +2873,10 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
ZVAL_ERROR(result);
|
||||
return;
|
||||
}
|
||||
} else if (UNEXPECTED(Z_ISERROR_P(ptr))) {
|
||||
ZVAL_ERROR(result);
|
||||
return;
|
||||
|
||||
@@ -757,6 +757,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
|
||||
for (i=0; i<fci->param_count; i++) {
|
||||
zval *param;
|
||||
zval *arg = &fci->params[i];
|
||||
zend_bool must_wrap = 0;
|
||||
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(func, i + 1)) {
|
||||
if (UNEXPECTED(!Z_ISREF_P(arg))) {
|
||||
@@ -765,12 +766,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
|
||||
ZVAL_NEW_REF(arg, arg);
|
||||
} else if (!ARG_MAY_BE_SENT_BY_REF(func, i + 1)) {
|
||||
/* By-value send is not allowed -- emit a warning,
|
||||
* but still perform the call with a by-value send. */
|
||||
* and perform the call with the value wrapped in a reference. */
|
||||
zend_error(E_WARNING,
|
||||
"Parameter %d to %s%s%s() expected to be a reference, value given", i+1,
|
||||
func->common.scope ? ZSTR_VAL(func->common.scope->name) : "",
|
||||
func->common.scope ? "::" : "",
|
||||
ZSTR_VAL(func->common.function_name));
|
||||
must_wrap = 1;
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
ZEND_CALL_NUM_ARGS(call) = i;
|
||||
zend_vm_stack_free_args(call);
|
||||
@@ -791,7 +793,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
|
||||
}
|
||||
|
||||
param = ZEND_CALL_ARG(call, i+1);
|
||||
ZVAL_COPY(param, arg);
|
||||
if (EXPECTED(!must_wrap)) {
|
||||
ZVAL_COPY(param, arg);
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(arg);
|
||||
ZVAL_NEW_REF(param, arg);
|
||||
}
|
||||
}
|
||||
|
||||
if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
|
||||
|
||||
@@ -728,6 +728,9 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
|
||||
}
|
||||
|
||||
if (iter->funcs->valid(iter) == FAILURE) {
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
goto exception;
|
||||
}
|
||||
/* reached end of iteration */
|
||||
goto failure;
|
||||
}
|
||||
@@ -756,7 +759,7 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
|
||||
return SUCCESS;
|
||||
|
||||
exception:
|
||||
zend_rethrow_exception(generator->execute_data);
|
||||
zend_generator_throw_exception(generator, NULL);
|
||||
|
||||
failure:
|
||||
zval_ptr_dtor(&generator->values);
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
|
||||
{
|
||||
zend_ini_entry *ini_entry;
|
||||
zend_string *duplicate;
|
||||
zend_bool modifiable;
|
||||
uint8_t modifiable;
|
||||
zend_bool modified;
|
||||
|
||||
if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL) {
|
||||
|
||||
@@ -1072,8 +1072,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
|
||||
octal_buf[2] = *(++s);
|
||||
}
|
||||
}
|
||||
if (octal_buf[2] &&
|
||||
(octal_buf[0] > '3')) {
|
||||
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
|
||||
/* 3 octit values must not overflow 0xFF (\377) */
|
||||
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
|
||||
}
|
||||
@@ -1118,6 +1117,7 @@ static const char *next_newline(const char *str, const char *end, size_t *newlin
|
||||
for (; str < end; str++) {
|
||||
if (*str == '\r') {
|
||||
*newline_len = str + 1 < end && *(str + 1) == '\n' ? 2 : 1;
|
||||
return str;
|
||||
} else if (*str == '\n') {
|
||||
*newline_len = 1;
|
||||
return str;
|
||||
|
||||
@@ -809,6 +809,13 @@ exit:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_always_inline zend_bool property_uses_strict_types() {
|
||||
zend_execute_data *execute_data = EG(current_execute_data);
|
||||
return execute_data
|
||||
&& execute_data->func
|
||||
&& ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data));
|
||||
}
|
||||
|
||||
ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
|
||||
{
|
||||
zend_object *zobj;
|
||||
@@ -833,7 +840,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
|
||||
|
||||
if (UNEXPECTED(prop_info)) {
|
||||
ZVAL_COPY_VALUE(&tmp, value);
|
||||
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, EG(current_execute_data) && ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
|
||||
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, property_uses_strict_types()))) {
|
||||
Z_TRY_DELREF_P(value);
|
||||
variable_ptr = &EG(error_zval);
|
||||
goto exit;
|
||||
@@ -842,7 +849,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
|
||||
}
|
||||
|
||||
found:
|
||||
zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EG(current_execute_data) && ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)));
|
||||
zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, property_uses_strict_types());
|
||||
goto exit;
|
||||
}
|
||||
if (Z_PROP_FLAG_P(variable_ptr) == IS_PROP_UNINIT) {
|
||||
@@ -898,7 +905,7 @@ write_std_property:
|
||||
|
||||
if (UNEXPECTED(prop_info)) {
|
||||
ZVAL_COPY_VALUE(&tmp, value);
|
||||
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
|
||||
if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, property_uses_strict_types()))) {
|
||||
zval_ptr_dtor(value);
|
||||
goto exit;
|
||||
}
|
||||
@@ -1051,7 +1058,8 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
|
||||
retval = OBJ_PROP(zobj, property_offset);
|
||||
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
|
||||
if (EXPECTED(!zobj->ce->__get) ||
|
||||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
|
||||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET) ||
|
||||
UNEXPECTED(prop_info && Z_PROP_FLAG_P(retval) == IS_PROP_UNINIT)) {
|
||||
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
|
||||
if (UNEXPECTED(prop_info)) {
|
||||
zend_throw_error(NULL,
|
||||
|
||||
@@ -1871,6 +1871,9 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
|
||||
}
|
||||
} else if (UNEXPECTED(Z_STRLEN_P(op2) == 0)) {
|
||||
if (EXPECTED(result != op1)) {
|
||||
if (result == orig_op1) {
|
||||
i_zval_ptr_dtor(result);
|
||||
}
|
||||
ZVAL_COPY(result, op1);
|
||||
}
|
||||
} else {
|
||||
|
||||
+12
-8
@@ -186,12 +186,13 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_
|
||||
ZSTR_LEN(ret) = len;
|
||||
zend_string_forget_hash_val(ret);
|
||||
return ret;
|
||||
} else {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
}
|
||||
ret = zend_string_alloc(len, persistent);
|
||||
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1);
|
||||
if (!ZSTR_IS_INTERNED(s)) {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -206,12 +207,13 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t
|
||||
ZSTR_LEN(ret) = len;
|
||||
zend_string_forget_hash_val(ret);
|
||||
return ret;
|
||||
} else {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
}
|
||||
ret = zend_string_alloc(len, persistent);
|
||||
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1);
|
||||
if (!ZSTR_IS_INTERNED(s)) {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -226,12 +228,13 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size
|
||||
ZSTR_LEN(ret) = len;
|
||||
zend_string_forget_hash_val(ret);
|
||||
return ret;
|
||||
} else {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
}
|
||||
ret = zend_string_alloc(len, persistent);
|
||||
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1);
|
||||
if (!ZSTR_IS_INTERNED(s)) {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -245,12 +248,13 @@ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s,
|
||||
ZSTR_LEN(ret) = (n * m) + l;
|
||||
zend_string_forget_hash_val(ret);
|
||||
return ret;
|
||||
} else {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
}
|
||||
ret = zend_string_safe_alloc(n, m, l, persistent);
|
||||
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1);
|
||||
if (!ZSTR_IS_INTERNED(s)) {
|
||||
GC_DELREF(s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+19
-2
@@ -596,6 +596,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
}
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
retry_reparse_point:
|
||||
if (save) {
|
||||
pathw = php_win32_ioutil_any_to_w(path);
|
||||
if (!pathw) {
|
||||
@@ -618,7 +619,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
tmp = do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
retry:
|
||||
retry_reparse_tag_cloud:
|
||||
if(save &&
|
||||
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
||||
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||
@@ -679,7 +680,7 @@ retry:
|
||||
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
|
||||
CloseHandle(hLink);
|
||||
(*ll)--;
|
||||
goto retry;
|
||||
goto retry_reparse_tag_cloud;
|
||||
}
|
||||
free_alloca(tmp, use_heap);
|
||||
CloseHandle(hLink);
|
||||
@@ -826,6 +827,22 @@ retry:
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
free(substitutename);
|
||||
|
||||
{
|
||||
DWORD attrs;
|
||||
|
||||
FREE_PATHW()
|
||||
pathw = php_win32_ioutil_any_to_w(path);
|
||||
if (!pathw) {
|
||||
return (size_t)-1;
|
||||
}
|
||||
attrs = GetFileAttributesW(pathw);
|
||||
if (!isVolume && attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||
free_alloca(tmp, use_heap);
|
||||
FREE_PATHW()
|
||||
goto retry_reparse_point;
|
||||
}
|
||||
}
|
||||
|
||||
if(isabsolute == 1) {
|
||||
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
|
||||
/* use_realpath is 0 in the call below coz path is absolute*/
|
||||
|
||||
+19
-2
@@ -1272,6 +1272,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array):
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
ZEND_VM_C_LABEL(assign_dim_op_ret_null):
|
||||
FREE_UNFETCHED_OP_DATA();
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -5127,6 +5128,7 @@ ZEND_VM_C_LABEL(send_array):
|
||||
arg_num = 1;
|
||||
param = ZEND_CALL_ARG(EX(call), 1);
|
||||
ZEND_HASH_FOREACH_VAL(ht, arg) {
|
||||
zend_bool must_wrap = 0;
|
||||
if (skip > 0) {
|
||||
skip--;
|
||||
continue;
|
||||
@@ -5138,6 +5140,7 @@ ZEND_VM_C_LABEL(send_array):
|
||||
/* By-value send is not allowed -- emit a warning,
|
||||
* but still perform the call. */
|
||||
zend_param_must_be_ref(EX(call)->func, arg_num);
|
||||
must_wrap = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -5147,7 +5150,12 @@ ZEND_VM_C_LABEL(send_array):
|
||||
arg = Z_REFVAL_P(arg);
|
||||
}
|
||||
}
|
||||
ZVAL_COPY(param, arg);
|
||||
if (EXPECTED(!must_wrap)) {
|
||||
ZVAL_COPY(param, arg);
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(arg);
|
||||
ZVAL_NEW_REF(param, arg);
|
||||
}
|
||||
ZEND_CALL_NUM_ARGS(EX(call))++;
|
||||
arg_num++;
|
||||
param++;
|
||||
@@ -5159,12 +5167,14 @@ ZEND_VM_C_LABEL(send_array):
|
||||
arg_num = 1;
|
||||
param = ZEND_CALL_ARG(EX(call), 1);
|
||||
ZEND_HASH_FOREACH_VAL(ht, arg) {
|
||||
zend_bool must_wrap = 0;
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
|
||||
if (UNEXPECTED(!Z_ISREF_P(arg))) {
|
||||
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
|
||||
/* By-value send is not allowed -- emit a warning,
|
||||
* but still perform the call. */
|
||||
zend_param_must_be_ref(EX(call)->func, arg_num);
|
||||
must_wrap = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -5174,7 +5184,12 @@ ZEND_VM_C_LABEL(send_array):
|
||||
arg = Z_REFVAL_P(arg);
|
||||
}
|
||||
}
|
||||
ZVAL_COPY(param, arg);
|
||||
if (EXPECTED(!must_wrap)) {
|
||||
ZVAL_COPY(param, arg);
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(arg);
|
||||
ZVAL_NEW_REF(param, arg);
|
||||
}
|
||||
ZEND_CALL_NUM_ARGS(EX(call))++;
|
||||
arg_num++;
|
||||
param++;
|
||||
@@ -5295,6 +5310,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
|
||||
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
|
||||
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
|
||||
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
|
||||
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
|
||||
do {
|
||||
zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
|
||||
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
|
||||
@@ -7891,6 +7907,7 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
|
||||
}
|
||||
} else {
|
||||
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
|
||||
FREE_OP1();
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
|
||||
+29
-2
@@ -2072,6 +2072,7 @@ send_array:
|
||||
arg_num = 1;
|
||||
param = ZEND_CALL_ARG(EX(call), 1);
|
||||
ZEND_HASH_FOREACH_VAL(ht, arg) {
|
||||
zend_bool must_wrap = 0;
|
||||
if (skip > 0) {
|
||||
skip--;
|
||||
continue;
|
||||
@@ -2083,6 +2084,7 @@ send_array:
|
||||
/* By-value send is not allowed -- emit a warning,
|
||||
* but still perform the call. */
|
||||
zend_param_must_be_ref(EX(call)->func, arg_num);
|
||||
must_wrap = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2092,7 +2094,12 @@ send_array:
|
||||
arg = Z_REFVAL_P(arg);
|
||||
}
|
||||
}
|
||||
ZVAL_COPY(param, arg);
|
||||
if (EXPECTED(!must_wrap)) {
|
||||
ZVAL_COPY(param, arg);
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(arg);
|
||||
ZVAL_NEW_REF(param, arg);
|
||||
}
|
||||
ZEND_CALL_NUM_ARGS(EX(call))++;
|
||||
arg_num++;
|
||||
param++;
|
||||
@@ -2104,12 +2111,14 @@ send_array:
|
||||
arg_num = 1;
|
||||
param = ZEND_CALL_ARG(EX(call), 1);
|
||||
ZEND_HASH_FOREACH_VAL(ht, arg) {
|
||||
zend_bool must_wrap = 0;
|
||||
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
|
||||
if (UNEXPECTED(!Z_ISREF_P(arg))) {
|
||||
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
|
||||
/* By-value send is not allowed -- emit a warning,
|
||||
* but still perform the call. */
|
||||
zend_param_must_be_ref(EX(call)->func, arg_num);
|
||||
must_wrap = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2119,7 +2128,12 @@ send_array:
|
||||
arg = Z_REFVAL_P(arg);
|
||||
}
|
||||
}
|
||||
ZVAL_COPY(param, arg);
|
||||
if (EXPECTED(!must_wrap)) {
|
||||
ZVAL_COPY(param, arg);
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(arg);
|
||||
ZVAL_NEW_REF(param, arg);
|
||||
}
|
||||
ZEND_CALL_NUM_ARGS(EX(call))++;
|
||||
arg_num++;
|
||||
param++;
|
||||
@@ -3178,6 +3192,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
|
||||
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
|
||||
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
|
||||
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
|
||||
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
|
||||
do {
|
||||
zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
|
||||
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
|
||||
@@ -4469,6 +4484,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
|
||||
}
|
||||
} else {
|
||||
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
|
||||
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -18525,6 +18541,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
|
||||
}
|
||||
} else {
|
||||
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
|
||||
zval_ptr_dtor_nogc(free_op1);
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -21940,6 +21957,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
|
||||
}
|
||||
} else {
|
||||
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
|
||||
zval_ptr_dtor_nogc(free_op1);
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -22205,6 +22223,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -24494,6 +24513,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -26898,6 +26918,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -28172,6 +28193,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -38105,6 +38127,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
|
||||
}
|
||||
} else {
|
||||
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
|
||||
|
||||
UNDEF_RESULT();
|
||||
HANDLE_EXCEPTION();
|
||||
}
|
||||
@@ -39120,6 +39143,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -42619,6 +42643,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -45599,6 +45624,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
@@ -47701,6 +47727,7 @@ assign_dim_op_new_array:
|
||||
} else {
|
||||
zend_binary_assign_op_dim_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
|
||||
assign_dim_op_ret_null:
|
||||
FREE_UNFETCHED_OP((opline+1)->op1_type, (opline+1)->op1.var);
|
||||
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
|
||||
ZVAL_NULL(EX_VAR(opline->result.var));
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ steps:
|
||||
libldap2-dev \
|
||||
libsodium-dev \
|
||||
libargon2-0-dev \
|
||||
libmm-dev \
|
||||
postgresql \
|
||||
postgresql-contrib \
|
||||
llvm \
|
||||
|
||||
+3
-1
@@ -7,8 +7,10 @@ steps:
|
||||
sudo apt-get update -y | true
|
||||
sudo apt-get install -y gcc-multilib
|
||||
sudo apt-get install -y g++-multilib
|
||||
sudo apt-get purge -y libxml2 libsqlite3-0
|
||||
sudo apt-get purge -y libxml2
|
||||
# TODO: Reenable postgresql + postgresql-contrib packages once they work again.
|
||||
sudo apt-get purge -y libpq5
|
||||
sudo apt-get install -y libc6:i386
|
||||
sudo apt-get install -y bison \
|
||||
re2c \
|
||||
locales \
|
||||
|
||||
@@ -2,8 +2,6 @@ parameters:
|
||||
packages: ''
|
||||
|
||||
steps:
|
||||
- script: brew update
|
||||
displayName: 'Update Homebrew'
|
||||
- script: |
|
||||
brew install pkg-config \
|
||||
autoconf \
|
||||
@@ -25,12 +23,11 @@ steps:
|
||||
zlib \
|
||||
t1lib \
|
||||
gd \
|
||||
libzip \
|
||||
gmp \
|
||||
tidyp \
|
||||
libxml2 \
|
||||
libxslt \
|
||||
postgresql
|
||||
# Make sure we don't get broken libzip 1.7.0
|
||||
brew upgrade libzip
|
||||
brew link icu4c gettext --force
|
||||
displayName: 'Install Build Dependencies'
|
||||
+6
-6
@@ -308,8 +308,8 @@ dnl
|
||||
dnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)
|
||||
dnl
|
||||
AC_DEFUN([PHP_CHECK_GCC_ARG],[
|
||||
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
|
||||
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
|
||||
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z=-,a-z__)
|
||||
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z=-,a-z__), [
|
||||
echo 'void somefunc() { };' > conftest.c
|
||||
cmd='$CC $1 -c conftest.c'
|
||||
if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then
|
||||
@@ -1464,16 +1464,16 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
|
||||
struct cookiedata {
|
||||
__off64_t pos;
|
||||
off64_t pos;
|
||||
};
|
||||
|
||||
__ssize_t reader(void *cookie, char *buffer, size_t size)
|
||||
ssize_t reader(void *cookie, char *buffer, size_t size)
|
||||
{ return size; }
|
||||
__ssize_t writer(void *cookie, const char *buffer, size_t size)
|
||||
ssize_t writer(void *cookie, const char *buffer, size_t size)
|
||||
{ return size; }
|
||||
int closer(void *cookie)
|
||||
{ return 0; }
|
||||
int seeker(void *cookie, __off64_t *position, int whence)
|
||||
int seeker(void *cookie, off64_t *position, int whence)
|
||||
{ ((struct cookiedata*)cookie)->pos = *position; return 0; }
|
||||
|
||||
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[7.4.9-dev],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[7.4.11],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
|
||||
@@ -28,15 +28,18 @@
|
||||
PHP_FUNCTION(unixtojd)
|
||||
{
|
||||
time_t ts = 0;
|
||||
zend_long tl = 0;
|
||||
struct tm *ta, tmbuf;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &tl) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ts) {
|
||||
if (!tl) {
|
||||
ts = time(NULL);
|
||||
} else if (ts < 0) {
|
||||
} else if (tl >= 0) {
|
||||
ts = (time_t) tl;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+21
-12
@@ -61,7 +61,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
&module_name, &module_name_len, &server_name, &server_name_len,
|
||||
&cp, &typelib_name, &typelib_name_len) &&
|
||||
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
|
||||
ZEND_NUM_ARGS(), "sa|ls",
|
||||
ZEND_NUM_ARGS(), "sa/|ls",
|
||||
&module_name, &module_name_len, &server_params, &cp,
|
||||
&typelib_name, &typelib_name_len)) {
|
||||
|
||||
@@ -85,7 +85,9 @@ PHP_FUNCTION(com_create_instance)
|
||||
|
||||
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
|
||||
"Server", sizeof("Server")-1))) {
|
||||
convert_to_string_ex(tmp);
|
||||
if (!try_convert_to_string(tmp)) {
|
||||
return;
|
||||
}
|
||||
server_name = Z_STRVAL_P(tmp);
|
||||
server_name_len = Z_STRLEN_P(tmp);
|
||||
ctx = CLSCTX_REMOTE_SERVER;
|
||||
@@ -93,21 +95,27 @@ PHP_FUNCTION(com_create_instance)
|
||||
|
||||
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
|
||||
"Username", sizeof("Username")-1))) {
|
||||
convert_to_string_ex(tmp);
|
||||
if (!try_convert_to_string(tmp)) {
|
||||
return;
|
||||
}
|
||||
user_name = Z_STRVAL_P(tmp);
|
||||
user_name_len = Z_STRLEN_P(tmp);
|
||||
}
|
||||
|
||||
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
|
||||
"Password", sizeof("Password")-1))) {
|
||||
convert_to_string_ex(tmp);
|
||||
if (!try_convert_to_string(tmp)) {
|
||||
return;
|
||||
}
|
||||
password = Z_STRVAL_P(tmp);
|
||||
password_len = Z_STRLEN_P(tmp);
|
||||
}
|
||||
|
||||
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(server_params),
|
||||
"Domain", sizeof("Domain")-1))) {
|
||||
convert_to_string_ex(tmp);
|
||||
if (!try_convert_to_string(tmp)) {
|
||||
return;
|
||||
}
|
||||
domain_name = Z_STRVAL_P(tmp);
|
||||
domain_name_len = Z_STRLEN_P(tmp);
|
||||
}
|
||||
@@ -221,7 +229,6 @@ PHP_FUNCTION(com_create_instance)
|
||||
|
||||
if (server_name) {
|
||||
if (info.pwszName) efree(info.pwszName);
|
||||
if (authid.User) efree(authid.User);
|
||||
}
|
||||
|
||||
efree(moniker);
|
||||
@@ -248,7 +255,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page, &cached);
|
||||
|
||||
if (TL) {
|
||||
if (COMG(autoreg_on) && !cached) {
|
||||
if (COMG(autoreg_on)) {
|
||||
php_com_import_typelib(TL, mode, obj->code_page);
|
||||
}
|
||||
|
||||
@@ -440,8 +447,9 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||
if (obj->typeinfo) {
|
||||
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
|
||||
if (FAILED(hr)) {
|
||||
HRESULT hr1 = hr;
|
||||
hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (SUCCEEDED(hr) && hr1 != E_NOTIMPL) {
|
||||
/* fall back on IDispatch direct */
|
||||
ITypeInfo_Release(obj->typeinfo);
|
||||
obj->typeinfo = NULL;
|
||||
@@ -588,6 +596,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
|
||||
}
|
||||
}
|
||||
efree(vargs);
|
||||
if (byref_vals) efree(byref_vals);
|
||||
}
|
||||
|
||||
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
|
||||
@@ -719,7 +728,9 @@ PHP_FUNCTION(com_event_sink)
|
||||
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(sink), 1)) != NULL && Z_TYPE_P(tmp) == IS_STRING)
|
||||
dispname = Z_STRVAL_P(tmp);
|
||||
} else if (sink != NULL) {
|
||||
convert_to_string(sink);
|
||||
if (!try_convert_to_string(sink)) {
|
||||
return;
|
||||
}
|
||||
dispname = Z_STRVAL_P(sink);
|
||||
}
|
||||
|
||||
@@ -840,9 +851,7 @@ PHP_FUNCTION(com_load_typelib)
|
||||
php_com_initialize();
|
||||
pTL = php_com_load_typelib_via_cache(name, codepage, &cached);
|
||||
if (pTL) {
|
||||
if (cached) {
|
||||
RETVAL_TRUE;
|
||||
} else if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) {
|
||||
if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) {
|
||||
RETVAL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,9 +251,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
|
||||
}
|
||||
|
||||
if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached)) != NULL) {
|
||||
if (!cached) {
|
||||
php_com_import_typelib(pTL, mode, COMG(code_page));
|
||||
}
|
||||
php_com_import_typelib(pTL, mode, COMG(code_page));
|
||||
ITypeLib_Release(pTL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,11 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
VariantInit(&v);
|
||||
if (!try_convert_to_string(member)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
convert_to_string_ex(member);
|
||||
VariantInit(&v);
|
||||
|
||||
res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1);
|
||||
@@ -66,9 +68,12 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
if (!try_convert_to_string(member)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
VariantInit(&v);
|
||||
|
||||
convert_to_string_ex(member);
|
||||
if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
|
||||
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) {
|
||||
VariantClear(&v);
|
||||
@@ -205,7 +210,9 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
convert_to_string_ex(member);
|
||||
if (!try_convert_to_string(member)) {
|
||||
return 0;
|
||||
}
|
||||
if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid))) {
|
||||
/* TODO: distinguish between property and method! */
|
||||
return 1;
|
||||
|
||||
@@ -108,13 +108,18 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
|
||||
}
|
||||
ZVAL_COPY_VALUE(&args[i-1], offset);
|
||||
|
||||
convert_to_string(&proxy->indices[0]);
|
||||
if (!try_convert_to_string(&proxy->indices[0])) {
|
||||
efree(args);
|
||||
return rv;
|
||||
}
|
||||
VariantInit(&v);
|
||||
|
||||
res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
|
||||
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
|
||||
proxy->dimensions, args, 0);
|
||||
|
||||
efree(args);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
|
||||
VariantClear(&v);
|
||||
@@ -221,7 +226,10 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
|
||||
ZVAL_COPY_VALUE(&args[i-1], offset);
|
||||
ZVAL_COPY_VALUE(&args[i], value);
|
||||
|
||||
convert_to_string(&proxy->indices[0]);
|
||||
if (!try_convert_to_string(&proxy->indices[0])) {
|
||||
efree(args);
|
||||
return;
|
||||
}
|
||||
VariantInit(&v);
|
||||
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
|
||||
Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
|
||||
@@ -390,7 +398,7 @@ static zend_object* saproxy_clone(zval *object)
|
||||
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
|
||||
|
||||
Z_ADDREF_P(cloneproxy->zobj);
|
||||
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
|
||||
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
|
||||
clone_indices(cloneproxy, proxy, proxy->dimensions);
|
||||
|
||||
return &cloneproxy->std;
|
||||
@@ -440,7 +448,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
|
||||
}
|
||||
|
||||
Z_ADDREF_P(proxy->zobj);
|
||||
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
|
||||
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
|
||||
|
||||
if (rel) {
|
||||
clone_indices(proxy, rel, rel->dimensions);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #64130 (COM obj parameters passed by reference are not updated)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
if (PHP_INT_SIZE != 4) die('skip for 32bit platforms only');
|
||||
try {
|
||||
$ie = new com('InternetExplorer.Application');
|
||||
} catch (com_exception $ex) {
|
||||
die("skip {$ex->getMessage()}");
|
||||
}
|
||||
$ie->quit();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ie = new com('InternetExplorer.Application');
|
||||
$x = 0;
|
||||
$y = 0;
|
||||
try {
|
||||
$ie->clientToWindow($x, $y);
|
||||
} catch (com_exception $ex) {}
|
||||
var_dump($x > 0, $y > 0);
|
||||
$ie->quit();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
+20028
-22817
File diff suppressed because it is too large.
Load diff
@@ -1001,7 +1001,7 @@ reltextnumber = 'first'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eig
|
||||
reltexttext = 'next'|'last'|'previous'|'this';
|
||||
reltextunit = 'ms' | 'µs' | (('msec'|'millisecond'|'µsec'|'microsecond'|'usec'|'sec'|'second'|'min'|'minute'|'hour'|'day'|'fortnight'|'forthnight'|'month'|'year') 's'?) | 'weeks' | daytext;
|
||||
|
||||
relnumber = ([+-]*[ \t]*[0-9]+);
|
||||
relnumber = ([+-]*[ \t]*[0-9]{1,13});
|
||||
relative = relnumber space? (reltextunit | 'week' );
|
||||
relativetext = (reltextnumber|reltexttext) space reltextunit;
|
||||
relativetextweek = reltexttext space 'week';
|
||||
|
||||
+436
-399
File diff suppressed because it is too large.
Load diff
@@ -322,9 +322,9 @@ typedef struct _timelib_tzdb {
|
||||
# define timelib_free free
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201803
|
||||
#define TIMELIB_EXTENDED_VERSION 20180301
|
||||
#define TIMELIB_ASCII_VERSION "2018.03"
|
||||
#define TIMELIB_VERSION 201804
|
||||
#define TIMELIB_EXTENDED_VERSION 20180401
|
||||
#define TIMELIB_ASCII_VERSION "2018.04"
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
|
||||
@@ -367,6 +367,14 @@ static timelib_sll do_years(timelib_sll year)
|
||||
timelib_sll eras;
|
||||
|
||||
eras = (year - 1970) / 40000;
|
||||
|
||||
/* Hack to make sure we don't overflow. Right now, we can't easily thrown a
|
||||
* warning in this case, so we'll just return some rubbish. Sucks, but at
|
||||
* least it doesn't show UBSAN warnings anymore */
|
||||
if (eras < -1000000 || eras > 1000000) {
|
||||
return eras > 0 ? LLONG_MAX/10 : LLONG_MIN/10;
|
||||
}
|
||||
|
||||
if (eras != 0) {
|
||||
year = year - (eras * 40000);
|
||||
res += (SECS_PER_ERA * eras * 100);
|
||||
|
||||
+4
-1
@@ -2390,7 +2390,10 @@ static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */
|
||||
o1 = Z_PHPTIMEZONE_P(tz1);
|
||||
o2 = Z_PHPTIMEZONE_P(tz2);
|
||||
|
||||
ZEND_ASSERT(o1->initialized && o2->initialized);
|
||||
if (!o1->initialized || !o2->initialized) {
|
||||
php_error_docref(NULL, E_WARNING, "Trying to compare uninitialized DateTimeZone objects");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (o1->type != o2->type) {
|
||||
php_error_docref(NULL, E_WARNING, "Trying to compare different kinds of DateTimeZone objects");
|
||||
|
||||
@@ -29,6 +29,17 @@ function compare_timezones($timezone1, $timezone2)
|
||||
var_dump($tz1 > $tz2);
|
||||
}
|
||||
|
||||
// Test comparison of uninitialized DateTimeZone objects.
|
||||
class MyDateTimeZone extends DateTimeZone {
|
||||
function __construct() {
|
||||
// parent ctor not called
|
||||
}
|
||||
}
|
||||
|
||||
$tz1 = new MyDateTimeZone();
|
||||
$tz2 = new MyDateTimeZone();
|
||||
var_dump($tz1 == $tz2);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
compare +0200 with +0200
|
||||
@@ -58,3 +69,6 @@ compare Europe/Amsterdam with Europe/Berlin
|
||||
|
||||
Warning: main(): Trying to compare different kinds of DateTimeZone objects in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: main(): Trying to compare uninitialized DateTimeZone objects in %s on line %d
|
||||
bool(false)
|
||||
@@ -6,12 +6,12 @@ Handling of large year values
|
||||
<?php
|
||||
date_default_timezone_set("America/Toronto");
|
||||
|
||||
$t = mktime(0,0,0,1,1,292277026596);
|
||||
$t = mktime(0,0,0,1,1,2922770265);
|
||||
|
||||
var_dump(date("r", $t));
|
||||
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(39) "Fri, 01 Jan 292277026596 00:00:00 -0500"
|
||||
--EXPECTF--
|
||||
string(%d) "%s, 01 Jan 2922770265 00:00:00 -0500"
|
||||
OK
|
||||
+57
-25
@@ -64,7 +64,8 @@ typedef unsigned char uchar;
|
||||
|
||||
#define EFREE_IF(ptr) if (ptr) efree(ptr)
|
||||
|
||||
#define MAX_IFD_NESTING_LEVEL 150
|
||||
#define MAX_IFD_NESTING_LEVEL 10
|
||||
#define MAX_IFD_TAGS 1000
|
||||
|
||||
/* {{{ arginfo */
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
|
||||
@@ -2022,6 +2023,7 @@ typedef struct {
|
||||
int read_thumbnail;
|
||||
int read_all;
|
||||
int ifd_nesting_level;
|
||||
int ifd_count;
|
||||
int num_errors;
|
||||
/* internal */
|
||||
file_section_list file;
|
||||
@@ -2712,6 +2714,7 @@ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
|
||||
/* forward declarations */
|
||||
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag);
|
||||
static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table);
|
||||
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index);
|
||||
|
||||
/* {{{ exif_get_markername
|
||||
Get name of marker */
|
||||
@@ -3210,6 +3213,23 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
|
||||
|
||||
/* It can be that motorola_intel is wrongly mapped, let's try inverting it */
|
||||
if ((2+NumDirEntries*12) > value_len) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Potentially invalid endianess, trying again with different endianness before imminent failure.");
|
||||
|
||||
ImageInfo->motorola_intel = ImageInfo->motorola_intel == 0 ? 1 : 0;
|
||||
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
|
||||
}
|
||||
|
||||
if ((2+NumDirEntries*12) > value_len) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (maker_note->offset_mode) {
|
||||
case MN_OFFSET_MAKER:
|
||||
offset_base = value_ptr;
|
||||
@@ -3240,15 +3260,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
break;
|
||||
}
|
||||
|
||||
if ((2+NumDirEntries*12) > value_len) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
size_t offset = 2 + 12 * de;
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
|
||||
@@ -3275,7 +3286,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
/* {{{ exif_process_IFD_TAG
|
||||
* Process one of the nested IFDs directories. */
|
||||
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
|
||||
static int exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
|
||||
{
|
||||
size_t length;
|
||||
unsigned int tag, format, components;
|
||||
@@ -3288,13 +3299,6 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
int dump_free;
|
||||
#endif /* EXIF_DEBUG */
|
||||
|
||||
/* Protect against corrupt headers */
|
||||
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
|
||||
return FALSE;
|
||||
}
|
||||
ImageInfo->ifd_nesting_level++;
|
||||
|
||||
tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
|
||||
format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
|
||||
components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
|
||||
@@ -3614,6 +3618,24 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
|
||||
{
|
||||
int result;
|
||||
/* Protect against corrupt headers */
|
||||
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum IFD tag count reached");
|
||||
return FALSE;
|
||||
}
|
||||
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
|
||||
return FALSE;
|
||||
}
|
||||
ImageInfo->ifd_nesting_level++;
|
||||
result = exif_process_IFD_TAG_impl(ImageInfo, dir_entry, offset_base, IFDlength, displacement, section_index, ReadNextIFD, tag_table);
|
||||
ImageInfo->ifd_nesting_level--;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* {{{ exif_process_IFD_in_JPEG
|
||||
* Process one of the nested IFDs directories. */
|
||||
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag)
|
||||
@@ -4047,7 +4069,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
|
||||
|
||||
/* {{{ exif_process_IFD_in_TIFF
|
||||
* Parse the TIFF header; */
|
||||
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
|
||||
static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_offset, int section_index)
|
||||
{
|
||||
int i, sn, num_entries, sub_section_index = 0;
|
||||
unsigned char *dir_entry;
|
||||
@@ -4055,10 +4077,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
|
||||
int entry_tag , entry_type;
|
||||
tag_table_type tag_table = exif_get_tag_table(section_index);
|
||||
|
||||
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
|
||||
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -4202,7 +4220,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s @x%04X", exif_get_sectionname(sub_section_index), entry_offset);
|
||||
#endif
|
||||
ImageInfo->ifd_nesting_level++;
|
||||
exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index);
|
||||
if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) {
|
||||
if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
|
||||
@@ -4246,7 +4263,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next_offset);
|
||||
#endif
|
||||
ImageInfo->ifd_nesting_level++;
|
||||
exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL);
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
|
||||
@@ -4283,6 +4299,21 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
|
||||
{
|
||||
int result;
|
||||
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
|
||||
return FALSE;
|
||||
}
|
||||
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
|
||||
return FALSE;
|
||||
}
|
||||
ImageInfo->ifd_nesting_level++;
|
||||
result = exif_process_IFD_in_TIFF_impl(ImageInfo, dir_offset, section_index);
|
||||
ImageInfo->ifd_nesting_level--;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* {{{ exif_scan_FILE_header
|
||||
* Parse the marker stream until SOS or EOI is seen; */
|
||||
static int exif_scan_FILE_header(image_info_type *ImageInfo)
|
||||
@@ -4438,6 +4469,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
|
||||
|
||||
|
||||
ImageInfo->ifd_nesting_level = 0;
|
||||
ImageInfo->ifd_count = 0;
|
||||
ImageInfo->num_errors = 0;
|
||||
|
||||
/* Scan the headers */
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75785 fix corrupt EXIF header issues; Related to mixed endianness. (Thank you @Richard Matzinger for providing the test photo)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$mixedEndiannessFile = dirname(__FILE__).'/P1000506.JPG';
|
||||
$tags = exif_read_data($mixedEndiannessFile, 'EXIF', true, false);
|
||||
|
||||
echo $tags['GPS']['GPSLatitude'][0] . PHP_EOL;
|
||||
echo $tags['GPS']['GPSLongitude'][0] . PHP_EOL;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
38/1
|
||||
122/1
|
||||
===DONE===
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Should not cause OOM
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(@exif_read_data(__DIR__ . '/nesting_level_oom.tiff'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
Binary file not shown.
+8
-4
@@ -1463,6 +1463,8 @@ void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
int cx, cy;
|
||||
int px, py;
|
||||
int fline;
|
||||
const int xuppper = (x > INT_MAX - f->w) ? INT_MAX : x + f->w;
|
||||
const int yuppper = (y > INT_MAX - f->h) ? INT_MAX : y + f->h;
|
||||
cx = 0;
|
||||
cy = 0;
|
||||
#ifdef CHARSET_EBCDIC
|
||||
@@ -1472,8 +1474,8 @@ void gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
return;
|
||||
}
|
||||
fline = (c - f->offset) * f->h * f->w;
|
||||
for (py = y; (py < (y + f->h)); py++) {
|
||||
for (px = x; (px < (x + f->w)); px++) {
|
||||
for (py = y; py < yuppper; py++) {
|
||||
for (px = x; px < xuppper; px++) {
|
||||
if (f->data[fline + cy * f->w + cx]) {
|
||||
gdImageSetPixel(im, px, py, color);
|
||||
}
|
||||
@@ -1489,6 +1491,8 @@ void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
int cx, cy;
|
||||
int px, py;
|
||||
int fline;
|
||||
const int xuppper = (x > INT_MAX - f->h) ? INT_MAX : x + f->h;
|
||||
const int ylower = (y < INT_MIN + f->w) ? INT_MIN : y - f->w;
|
||||
cx = 0;
|
||||
cy = 0;
|
||||
#ifdef CHARSET_EBCDIC
|
||||
@@ -1498,8 +1502,8 @@ void gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
return;
|
||||
}
|
||||
fline = (c - f->offset) * f->h * f->w;
|
||||
for (py = y; py > (y - f->w); py--) {
|
||||
for (px = x; px < (x + f->h); px++) {
|
||||
for (py = y; py > ylower; py--) {
|
||||
for (px = x; px < xuppper; px++) {
|
||||
if (f->data[fline + cy * f->w + cx]) {
|
||||
gdImageSetPixel(im, px, py, color);
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+97
-103
@@ -166,15 +166,17 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
|
||||
}
|
||||
} else if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PAGEDRESULTS) == 0) {
|
||||
int lestimated, rc;
|
||||
struct berval lcookie;
|
||||
struct berval lcookie = { 0L, NULL };
|
||||
zval value;
|
||||
|
||||
if (ctrl->ldctl_value.bv_len) {
|
||||
/* ldap_parse_pageresponse_control() allocates lcookie.bv_val */
|
||||
rc = ldap_parse_pageresponse_control(ld, ctrl, &lestimated, &lcookie);
|
||||
} else {
|
||||
/* ldap_parse_pageresponse_control will crash if value is empty */
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
array_init(&value);
|
||||
add_assoc_long(&value, "size", lestimated);
|
||||
@@ -183,6 +185,10 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
|
||||
} else {
|
||||
add_assoc_null(array, "value");
|
||||
}
|
||||
|
||||
if (lcookie.bv_val) {
|
||||
ldap_memfree(lcookie.bv_val);
|
||||
}
|
||||
} else if ((strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PRE_READ) == 0) || (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_POST_READ) == 0)) {
|
||||
BerElement *ber;
|
||||
struct berval bv;
|
||||
@@ -301,27 +307,23 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
control_iscritical = 0;
|
||||
}
|
||||
|
||||
struct berval *control_value = NULL;
|
||||
BerElement *ber = NULL;
|
||||
struct berval control_value = { 0L, NULL };
|
||||
int control_value_alloc = 0;
|
||||
|
||||
if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "value", sizeof("value") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(val) != IS_ARRAY) {
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if (control_value == NULL) {
|
||||
tmpstring = zval_get_string(val);
|
||||
if (EG(exception)) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
tmpstring = zval_get_string(val);
|
||||
if (EG(exception)) {
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
control_value->bv_val = ZSTR_VAL(tmpstring);
|
||||
control_value->bv_len = ZSTR_LEN(tmpstring);
|
||||
goto failure;
|
||||
}
|
||||
control_value.bv_val = ZSTR_VAL(tmpstring);
|
||||
control_value.bv_len = ZSTR_LEN(tmpstring);
|
||||
} else if (strcmp(ZSTR_VAL(control_oid), LDAP_CONTROL_PAGEDRESULTS) == 0) {
|
||||
zval* tmp;
|
||||
int pagesize = 1;
|
||||
struct berval cookie = { 0, NULL };
|
||||
struct berval cookie = { 0L, NULL };
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "size", sizeof("size") - 1)) != NULL) {
|
||||
pagesize = zval_get_long(tmp);
|
||||
}
|
||||
@@ -334,15 +336,11 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
cookie.bv_val = ZSTR_VAL(tmpstring);
|
||||
cookie.bv_len = ZSTR_LEN(tmpstring);
|
||||
}
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if (control_value == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
rc = ldap_create_page_control_value(ld, pagesize, &cookie, control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create paged result control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
/* ldap_create_page_control_value() allocates memory for control_value.bv_val */
|
||||
control_value_alloc = 1;
|
||||
rc = ldap_create_page_control_value(ld, pagesize, &cookie, &control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create paged result control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
} else if (strcmp(ZSTR_VAL(control_oid), LDAP_CONTROL_ASSERT) == 0) {
|
||||
zval* tmp;
|
||||
@@ -356,19 +354,15 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if (control_value == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
/* ldap_create_assertion_control_value does not reset ld_errno, we need to do it ourselves
|
||||
See http://www.openldap.org/its/index.cgi/Incoming?id=8674 */
|
||||
int success = LDAP_SUCCESS;
|
||||
ldap_set_option(ld, LDAP_OPT_RESULT_CODE, &success);
|
||||
rc = ldap_create_assertion_control_value(ld, ZSTR_VAL(assert), control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create assert control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
/* ldap_create_assertion_control_value does not reset ld_errno, we need to do it ourselves
|
||||
See http://www.openldap.org/its/index.cgi/Incoming?id=8674 */
|
||||
int success = LDAP_SUCCESS;
|
||||
ldap_set_option(ld, LDAP_OPT_RESULT_CODE, &success);
|
||||
/* ldap_create_assertion_control_value() allocates memory for control_value.bv_val */
|
||||
control_value_alloc = 1;
|
||||
rc = ldap_create_assertion_control_value(ld, ZSTR_VAL(assert), &control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create assert control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
zend_string_release(assert);
|
||||
}
|
||||
@@ -378,9 +372,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Filter missing from control value array");
|
||||
} else {
|
||||
BerElement *vrber = ber_alloc_t(LBER_USE_DER);
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if ((control_value == NULL) || (vrber == NULL)) {
|
||||
ber = ber_alloc_t(LBER_USE_DER);
|
||||
if (ber == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
@@ -389,14 +382,11 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
if (ldap_put_vrFilter(vrber, ZSTR_VAL(tmpstring)) == -1) {
|
||||
ber_free(vrber, 1);
|
||||
if (ldap_put_vrFilter(ber, ZSTR_VAL(tmpstring)) == -1) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create control value: Bad ValuesReturnFilter: %s", ZSTR_VAL(tmpstring));
|
||||
} else {
|
||||
if (ber_flatten2(vrber, control_value, 0) == -1) {
|
||||
rc = -1;
|
||||
}
|
||||
} else if (ber_flatten2(ber, &control_value, control_value_alloc) == -1) {
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,10 +396,9 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Attributes list missing from control value array");
|
||||
} else {
|
||||
BerElement *ber = ber_alloc_t(LBER_USE_DER);
|
||||
ber = ber_alloc_t(LBER_USE_DER);
|
||||
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if ((control_value == NULL) || (ber == NULL)) {
|
||||
if (ber == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
@@ -445,7 +434,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
php_error_docref(NULL, E_WARNING, "Failed to encode attribute list");
|
||||
} else {
|
||||
int err;
|
||||
err = ber_flatten2(ber, control_value, 0);
|
||||
err = ber_flatten2(ber, &control_value, control_value_alloc);
|
||||
if (err < 0) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to encode control value (%d)", err);
|
||||
@@ -504,15 +493,11 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
}
|
||||
}
|
||||
sort_keys[num_keys] = NULL;
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if (control_value == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
rc = ldap_create_sort_control_value(ld, sort_keys, control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create sort control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
/* ldap_create_sort_control_value() allocates memory for control_value.bv_val */
|
||||
control_value_alloc = 1;
|
||||
rc = ldap_create_sort_control_value(ld, sort_keys, &control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create sort control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
} else if (strcmp(ZSTR_VAL(control_oid), LDAP_CONTROL_VLVREQUEST) == 0) {
|
||||
zval* tmp;
|
||||
@@ -574,15 +559,11 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
vlvInfo.ldvlv_context = NULL;
|
||||
}
|
||||
|
||||
control_value = ber_memalloc(sizeof * control_value);
|
||||
if (control_value == NULL) {
|
||||
rc = -1;
|
||||
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
|
||||
} else {
|
||||
rc = ldap_create_vlv_control_value(ld, &vlvInfo, control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create VLV control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
/* ldap_create_vlv_control_value() allocates memory for control_value.bv_val */
|
||||
control_value_alloc = 1;
|
||||
rc = ldap_create_vlv_control_value(ld, &vlvInfo, &control_value);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Failed to create VLV control value: %s (%d)", ldap_err2string(rc), rc);
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "Control OID %s does not expect an array as value", ZSTR_VAL(control_oid));
|
||||
@@ -591,7 +572,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
}
|
||||
|
||||
if (rc == LDAP_SUCCESS) {
|
||||
rc = ldap_control_create(ZSTR_VAL(control_oid), control_iscritical, control_value, 1, ctrl);
|
||||
rc = ldap_control_create(ZSTR_VAL(control_oid), control_iscritical, &control_value, 1, ctrl);
|
||||
}
|
||||
|
||||
failure:
|
||||
@@ -613,9 +594,11 @@ failure:
|
||||
}
|
||||
efree(tmpstrings2);
|
||||
}
|
||||
if (control_value != NULL) {
|
||||
ber_memfree(control_value);
|
||||
control_value = NULL;
|
||||
if (control_value.bv_val != NULL && control_value_alloc != 0) {
|
||||
ber_memfree(control_value.bv_val);
|
||||
}
|
||||
if (ber != NULL) {
|
||||
ber_free(ber, 1);
|
||||
}
|
||||
if (ldap_attrs != NULL) {
|
||||
efree(ldap_attrs);
|
||||
@@ -1463,7 +1446,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||
zend_string *ldap_filter = NULL, *ldap_base_dn = NULL;
|
||||
char **ldap_attrs = NULL;
|
||||
ldap_linkdata *ld = NULL;
|
||||
LDAPMessage *ldap_res;
|
||||
LDAPMessage *ldap_res = NULL;
|
||||
LDAPControl **lserverctrls = NULL;
|
||||
int ldap_attrsonly = 0, ldap_sizelimit = -1, ldap_timelimit = -1, ldap_deref = -1;
|
||||
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
|
||||
@@ -1663,6 +1646,11 @@ cleanup_parallel:
|
||||
&& errno != LDAP_REFERRAL
|
||||
#endif
|
||||
) {
|
||||
/* ldap_res should be freed regardless of return value of ldap_search_ext_s()
|
||||
* see: https://linux.die.net/man/3/ldap_search_ext_s */
|
||||
if (ldap_res != NULL) {
|
||||
ldap_msgfree(ldap_res);
|
||||
}
|
||||
php_error_docref(NULL, E_WARNING, "Search: %s", ldap_err2string(errno));
|
||||
ret = 0;
|
||||
} else {
|
||||
@@ -3984,7 +3972,7 @@ PHP_FUNCTION(ldap_control_paged_result)
|
||||
zval *link;
|
||||
char *cookie = NULL;
|
||||
size_t cookie_len = 0;
|
||||
struct berval lcookie = { 0, NULL };
|
||||
struct berval lcookie = { 0L, NULL };
|
||||
ldap_linkdata *ld;
|
||||
LDAP *ldap;
|
||||
BerElement *ber = NULL;
|
||||
@@ -4275,38 +4263,31 @@ PHP_FUNCTION(ldap_exop)
|
||||
PHP_FUNCTION(ldap_exop_passwd)
|
||||
{
|
||||
zval *link, *serverctrls;
|
||||
struct berval luser, loldpw, lnewpw, lgenpasswd;
|
||||
LDAPControl **lserverctrls = NULL, **requestctrls = NULL;
|
||||
LDAPControl *ctrl, **ctrlp;
|
||||
LDAPMessage* ldap_res;
|
||||
struct berval luser = { 0L, NULL };
|
||||
struct berval loldpw = { 0L, NULL };
|
||||
struct berval lnewpw = { 0L, NULL };
|
||||
struct berval lgenpasswd = { 0L, NULL };
|
||||
LDAPControl *ctrl, **lserverctrls = NULL, *requestctrls[2] = { NULL, NULL };
|
||||
LDAPMessage* ldap_res = NULL;
|
||||
ldap_linkdata *ld;
|
||||
int rc, myargcount = ZEND_NUM_ARGS(), msgid, err;
|
||||
char* errmsg;
|
||||
|
||||
luser.bv_len = 0;
|
||||
loldpw.bv_len = 0;
|
||||
lnewpw.bv_len = 0;
|
||||
char* errmsg = NULL;
|
||||
|
||||
if (zend_parse_parameters(myargcount, "r|sssz/", &link, &luser.bv_val, &luser.bv_len, &loldpw.bv_val, &loldpw.bv_len, &lnewpw.bv_val, &lnewpw.bv_len, &serverctrls) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
switch (myargcount) {
|
||||
case 5:
|
||||
requestctrls = safe_emalloc(2, sizeof(*requestctrls), 0);
|
||||
*requestctrls = NULL;
|
||||
ctrlp = requestctrls;
|
||||
|
||||
/* ldap_create_passwordpolicy_control() allocates ctrl */
|
||||
if (ldap_create_passwordpolicy_control(ld->link, &ctrl) == LDAP_SUCCESS) {
|
||||
*ctrlp = ctrl;
|
||||
++ctrlp;
|
||||
requestctrls[0] = ctrl;
|
||||
}
|
||||
|
||||
*ctrlp = NULL;
|
||||
}
|
||||
|
||||
/* asynchronous call to get result and controls */
|
||||
@@ -4316,35 +4297,43 @@ PHP_FUNCTION(ldap_exop_passwd)
|
||||
requestctrls,
|
||||
NULL, &msgid);
|
||||
|
||||
if (requestctrls != NULL) {
|
||||
efree(requestctrls);
|
||||
if (requestctrls[0] != NULL) {
|
||||
ldap_control_free(requestctrls[0]);
|
||||
}
|
||||
|
||||
if (rc != LDAP_SUCCESS ) {
|
||||
php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc);
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
|
||||
if ((rc < 0) || !ldap_res) {
|
||||
rc = _get_lderrno(ld->link);
|
||||
php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc);
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = ldap_parse_passwd(ld->link, ldap_res, &lgenpasswd);
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc);
|
||||
ldap_msgfree(ldap_res);
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = ldap_parse_result(ld->link, ldap_res, &err, NULL, &errmsg, NULL, (myargcount > 4 ? &lserverctrls : NULL), 1);
|
||||
rc = ldap_parse_result(ld->link, ldap_res, &err, NULL, &errmsg, NULL, (myargcount > 4 ? &lserverctrls : NULL), 0);
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
php_error_docref(NULL, E_WARNING, "Passwd modify extended operation failed: %s (%d)", ldap_err2string(rc), rc);
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (myargcount > 4) {
|
||||
_php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0);
|
||||
}
|
||||
|
||||
/* return */
|
||||
if (lnewpw.bv_len == 0) {
|
||||
if (lgenpasswd.bv_len == 0) {
|
||||
RETVAL_EMPTY_STRING();
|
||||
@@ -4358,11 +4347,16 @@ PHP_FUNCTION(ldap_exop_passwd)
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
if (myargcount > 4) {
|
||||
_php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0);
|
||||
cleanup:
|
||||
if (lgenpasswd.bv_val != NULL) {
|
||||
ldap_memfree(lgenpasswd.bv_val);
|
||||
}
|
||||
if (ldap_res != NULL) {
|
||||
ldap_msgfree(ldap_res);
|
||||
}
|
||||
if (errmsg != NULL) {
|
||||
ldap_memfree(errmsg);
|
||||
}
|
||||
|
||||
ldap_memfree(lgenpasswd.bv_val);
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
libxml_disable_entity_loader()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('libxml') || !extension_loaded('dom') || defined('PHP_WINDOWS_VERSION_MAJOR')) die('skip'); ?>
|
||||
<?php if (!extension_loaded('libxml') || !extension_loaded('dom')) die('skip'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -11,7 +11,8 @@ $xml = <<<EOT
|
||||
<foo>&xxe;</foo>
|
||||
EOT;
|
||||
|
||||
$xml = str_replace('XXE_URI', __DIR__ . '/libxml_disable_entity_loader_payload.txt', $xml);
|
||||
$dir = str_replace('\\', '/', __DIR__);
|
||||
$xml = str_replace('XXE_URI', $dir . '/libxml_disable_entity_loader_payload.txt', $xml);
|
||||
|
||||
function parseXML($xml) {
|
||||
$doc = new DOMDocument();
|
||||
|
||||
@@ -1714,16 +1714,13 @@ static int mysqli_options_get_option_zval_type(int option)
|
||||
#ifdef MYSQL_OPT_COMPRESS
|
||||
case MYSQL_OPT_COMPRESS:
|
||||
#endif /* mysqlnd @ PHP 5.3.2 */
|
||||
#ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT
|
||||
REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif /* MySQL 5.1.1., mysqlnd @ PHP 5.3.3 */
|
||||
#if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND)
|
||||
case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
|
||||
#endif
|
||||
return IS_LONG;
|
||||
|
||||
#ifdef MYSQL_SHARED_MEMORY_BASE_NAME
|
||||
case MYSQL_SHARED_MEMORY_BASE_NAME:
|
||||
case MYSQL_SHARED_MEMORY_BASE_NAME:
|
||||
#endif /* MySQL 4.1.0 */
|
||||
#ifdef MYSQL_SET_CLIENT_IP
|
||||
case MYSQL_SET_CLIENT_IP:
|
||||
|
||||
@@ -921,7 +921,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
|
||||
if (b->len == 0) {
|
||||
continue;
|
||||
}
|
||||
if (b->flags & ZEND_BB_REACHABLE) {
|
||||
if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
|
||||
if (b->flags & ZEND_BB_UNREACHABLE_FREE) {
|
||||
/* Only keep the FREE for the loop var */
|
||||
ZEND_ASSERT(op_array->opcodes[b->start].opcode == ZEND_FREE
|
||||
|| op_array->opcodes[b->start].opcode == ZEND_FE_FREE);
|
||||
len += b->len = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
opline = op_array->opcodes + b->start + b->len - 1;
|
||||
if (opline->opcode == ZEND_JMP) {
|
||||
zend_basic_block *next = b + 1;
|
||||
@@ -959,7 +967,7 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
|
||||
|
||||
/* Copy code of reachable blocks into a single buffer */
|
||||
for (b = blocks; b < end; b++) {
|
||||
if (b->flags & ZEND_BB_REACHABLE) {
|
||||
if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
|
||||
memcpy(opline, op_array->opcodes + b->start, b->len * sizeof(zend_op));
|
||||
b->start = opline - new_opcodes;
|
||||
opline += b->len;
|
||||
@@ -1083,7 +1091,7 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
|
||||
/* rebuild map (just for printing) */
|
||||
memset(cfg->map, -1, sizeof(int) * op_array->last);
|
||||
for (n = 0; n < cfg->blocks_count; n++) {
|
||||
if (cfg->blocks[n].flags & ZEND_BB_REACHABLE) {
|
||||
if (cfg->blocks[n].flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
|
||||
cfg->map[cfg->blocks[n].start] = n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
case ZEND_ASSIGN_OBJ_OP:
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1);
|
||||
}
|
||||
if (opline->op2_type == IS_CONST) {
|
||||
LITERAL_INFO(opline->op2.constant, LITERAL_PROPERTY, 1);
|
||||
}
|
||||
|
||||
@@ -575,9 +575,8 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
|
||||
}
|
||||
|
||||
/* Build CFG, Step 4, Mark Reachable Basic Blocks */
|
||||
zend_mark_reachable_blocks(op_array, cfg, 0);
|
||||
|
||||
cfg->flags |= flags;
|
||||
zend_mark_reachable_blocks(op_array, cfg, 0);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1388,7 +1388,7 @@ void zend_ssa_remove_predecessor(zend_ssa *ssa, int from, int to) /* {{{ */
|
||||
for (phi = next_ssa_block->phis; phi; phi = phi->next) {
|
||||
if (phi->pi >= 0) {
|
||||
if (phi->pi == from) {
|
||||
zend_ssa_remove_uses_of_var(ssa, phi->ssa_var);
|
||||
zend_ssa_rename_var_uses(ssa, phi->ssa_var, phi->sources[0], /* update_types */ 0);
|
||||
zend_ssa_remove_phi(ssa, phi);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -501,7 +501,7 @@ zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str)
|
||||
} while (pos != STRTAB_INVALID_POS);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(ZCSG(interned_strings).end - ZCSG(interned_strings).top < STRTAB_STR_SIZE(str))) {
|
||||
if (UNEXPECTED((char*)ZCSG(interned_strings).end - (char*)ZCSG(interned_strings).top < STRTAB_STR_SIZE(str))) {
|
||||
/* no memory, return the same non-interned string */
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Interned string buffer overflow");
|
||||
return str;
|
||||
@@ -2655,6 +2655,9 @@ static void accel_gen_system_id(void)
|
||||
{
|
||||
PHP_MD5_CTX context;
|
||||
unsigned char digest[16];
|
||||
zend_module_entry *module;
|
||||
zend_extension *extension;
|
||||
zend_llist_position pos;
|
||||
|
||||
PHP_MD5Init(&context);
|
||||
PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
|
||||
@@ -2665,6 +2668,23 @@ static void accel_gen_system_id(void)
|
||||
PHP_MD5Update(&context, __DATE__, sizeof(__DATE__)-1);
|
||||
PHP_MD5Update(&context, __TIME__, sizeof(__TIME__)-1);
|
||||
}
|
||||
/* Modules may have changed after restart which can cause dangling pointers from
|
||||
* custom opcode handlers in the second-level cache files
|
||||
*/
|
||||
ZEND_HASH_FOREACH_PTR(&module_registry, module) {
|
||||
PHP_MD5Update(&context, module->name, strlen(module->name));
|
||||
if (module->version != NULL) {
|
||||
PHP_MD5Update(&context, module->version, strlen(module->version));
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
extension = (zend_extension *) zend_llist_get_first_ex(&zend_extensions, &pos);
|
||||
while (extension) {
|
||||
PHP_MD5Update(&context, extension->name, strlen(extension->name));
|
||||
if (extension->version != NULL) {
|
||||
PHP_MD5Update(&context, extension->version, strlen(extension->version));
|
||||
}
|
||||
extension = (zend_extension *) zend_llist_get_next_ex(&zend_extensions, &pos);
|
||||
}
|
||||
PHP_MD5Final(digest, &context);
|
||||
php_hash_bin2hex(accel_system_id, digest, sizeof digest);
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@
|
||||
|
||||
#define ACCEL_FILEMAP_NAME "ZendOPcache.SharedMemoryArea"
|
||||
#define ACCEL_MUTEX_NAME "ZendOPcache.SharedMemoryMutex"
|
||||
#define ACCEL_FILEMAP_BASE_DEFAULT 0x01000000
|
||||
#define ACCEL_FILEMAP_BASE "ZendOPcache.MemoryBase"
|
||||
#define ACCEL_EVENT_SOURCE "Zend OPcache"
|
||||
|
||||
/* address of mapping base and address of execute_ex */
|
||||
#define ACCEL_BASE_POINTER_SIZE (2 * sizeof(void*))
|
||||
|
||||
static HANDLE memfile = NULL, memory_mutex = NULL;
|
||||
static void *mapping_base;
|
||||
|
||||
@@ -75,22 +76,6 @@ static char *create_name_with_username(char *name)
|
||||
return newname;
|
||||
}
|
||||
|
||||
static char *get_mmap_base_file(void)
|
||||
{
|
||||
static char windir[MAXPATHLEN+ 32 + 3 + sizeof("\\\\@") + 1 + 32 + 21];
|
||||
int l;
|
||||
|
||||
GetTempPath(MAXPATHLEN, windir);
|
||||
l = strlen(windir);
|
||||
if ('\\' == windir[l-1]) {
|
||||
l--;
|
||||
}
|
||||
|
||||
snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%.32s@%.20s@%.32s", ACCEL_FILEMAP_BASE, accel_uname_id, sapi_module.name, accel_system_id);
|
||||
|
||||
return windir;
|
||||
}
|
||||
|
||||
void zend_shared_alloc_create_lock(void)
|
||||
{
|
||||
memory_mutex = CreateMutex(NULL, FALSE, create_name_with_username(ACCEL_MUTEX_NAME));
|
||||
@@ -119,39 +104,20 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
|
||||
{
|
||||
int err;
|
||||
void *wanted_mapping_base;
|
||||
char *mmap_base_file = get_mmap_base_file();
|
||||
FILE *fp = fopen(mmap_base_file, "r");
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
void *execute_ex_base;
|
||||
int execute_ex_moved;
|
||||
|
||||
if (!fp) {
|
||||
err = GetLastError();
|
||||
zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err);
|
||||
zend_win_error_message(ACCEL_LOG_FATAL, "Unable to open base address file", err);
|
||||
*error_in="fopen";
|
||||
return ALLOC_FAILURE;
|
||||
}
|
||||
if (!fscanf(fp, "%p", &wanted_mapping_base)) {
|
||||
mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, ACCEL_BASE_POINTER_SIZE, NULL);
|
||||
if (mapping_base == NULL) {
|
||||
err = GetLastError();
|
||||
zend_win_error_message(ACCEL_LOG_FATAL, "Unable to read base address", err);
|
||||
*error_in="read mapping base";
|
||||
fclose(fp);
|
||||
return ALLOC_FAILURE;
|
||||
}
|
||||
if (!fscanf(fp, "%p", &execute_ex_base)) {
|
||||
err = GetLastError();
|
||||
zend_win_error_message(ACCEL_LOG_FATAL, "Unable to read execute_ex base address", err);
|
||||
*error_in="read execute_ex base";
|
||||
fclose(fp);
|
||||
return ALLOC_FAILURE;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
if (0 > win32_utime(mmap_base_file, NULL)) {
|
||||
err = GetLastError();
|
||||
zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err);
|
||||
}
|
||||
wanted_mapping_base = ((void**)mapping_base)[0];
|
||||
execute_ex_base = ((void**)mapping_base)[1];
|
||||
UnmapViewOfFile(mapping_base);
|
||||
|
||||
execute_ex_moved = (void *)execute_ex != execute_ex_base;
|
||||
|
||||
@@ -207,7 +173,7 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
|
||||
}
|
||||
return ALLOC_FAIL_MAPPING;
|
||||
}
|
||||
smm_shared_globals = (zend_smm_shared_globals *) mapping_base;
|
||||
smm_shared_globals = (zend_smm_shared_globals *) ((char*)mapping_base + ACCEL_BASE_POINTER_SIZE);
|
||||
|
||||
return SUCCESSFULLY_REATTACHED;
|
||||
}
|
||||
@@ -325,23 +291,12 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
|
||||
*error_in = "MapViewOfFile";
|
||||
return ALLOC_FAILURE;
|
||||
} else {
|
||||
char *mmap_base_file = get_mmap_base_file();
|
||||
void *execute_ex_base = (void *)execute_ex;
|
||||
FILE *fp = fopen(mmap_base_file, "w");
|
||||
if (!fp) {
|
||||
err = GetLastError();
|
||||
zend_shared_alloc_unlock_win32();
|
||||
zend_win_error_message(ACCEL_LOG_WARNING, mmap_base_file, err);
|
||||
zend_win_error_message(ACCEL_LOG_FATAL, "Unable to write base address", err);
|
||||
return ALLOC_FAILURE;
|
||||
}
|
||||
fprintf(fp, "%p\n", mapping_base);
|
||||
fprintf(fp, "%p\n", execute_ex_base);
|
||||
fclose(fp);
|
||||
((void**)mapping_base)[0] = mapping_base;
|
||||
((void**)mapping_base)[1] = (void*)execute_ex;
|
||||
}
|
||||
|
||||
shared_segment->pos = 0;
|
||||
shared_segment->size = requested_size;
|
||||
shared_segment->pos = ACCEL_BASE_POINTER_SIZE;
|
||||
shared_segment->size = requested_size - ACCEL_BASE_POINTER_SIZE;
|
||||
|
||||
zend_shared_alloc_unlock_win32();
|
||||
|
||||
|
||||
@@ -403,7 +403,13 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||
zend_file_cache_metainfo *info,
|
||||
void *buf)
|
||||
{
|
||||
if (op_array->static_variables && !IS_SERIALIZED(op_array->static_variables)) {
|
||||
/* Check whether this op_array has already been serialized. */
|
||||
if (IS_SERIALIZED(op_array->opcodes)) {
|
||||
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
|
||||
return;
|
||||
}
|
||||
|
||||
if (op_array->static_variables) {
|
||||
HashTable *ht;
|
||||
|
||||
SERIALIZE_PTR(op_array->static_variables);
|
||||
@@ -412,7 +418,14 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||
zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval);
|
||||
}
|
||||
|
||||
if (op_array->scope && !IS_SERIALIZED(op_array->opcodes)) {
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
if (op_array->fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
ZEND_MAP_PTR_INIT(op_array->run_time_cache, NULL);
|
||||
} else {
|
||||
SERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache));
|
||||
}
|
||||
|
||||
if (op_array->scope) {
|
||||
if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) {
|
||||
op_array->refcount = (uint32_t*)(intptr_t)-1;
|
||||
SERIALIZE_PTR(op_array->literals);
|
||||
@@ -431,7 +444,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||
zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array->opcodes);
|
||||
}
|
||||
|
||||
if (op_array->literals && !IS_SERIALIZED(op_array->literals)) {
|
||||
if (op_array->literals) {
|
||||
zval *p, *end;
|
||||
|
||||
SERIALIZE_PTR(op_array->literals);
|
||||
@@ -444,7 +457,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||
}
|
||||
}
|
||||
|
||||
if (!IS_SERIALIZED(op_array->opcodes)) {
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
|
||||
#if !ZEND_USE_ABS_CONST_ADDR
|
||||
@@ -552,13 +565,6 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||
SERIALIZE_STR(op_array->doc_comment);
|
||||
SERIALIZE_PTR(op_array->try_catch_array);
|
||||
SERIALIZE_PTR(op_array->prototype);
|
||||
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
if (op_array->fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
ZEND_MAP_PTR_INIT(op_array->run_time_cache, NULL);
|
||||
} else {
|
||||
SERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,7 +949,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
vec[0].iov_base = &info;
|
||||
vec[0].iov_base = (void *)&info;
|
||||
vec[0].iov_len = sizeof(info);
|
||||
vec[1].iov_base = buf;
|
||||
vec[1].iov_len = script->size;
|
||||
@@ -1107,7 +1113,13 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||
zend_persistent_script *script,
|
||||
void *buf)
|
||||
{
|
||||
if (op_array->static_variables && !IS_UNSERIALIZED(op_array->static_variables)) {
|
||||
/* Check whether this op_array has already been unserialized. */
|
||||
if (IS_UNSERIALIZED(op_array->opcodes)) {
|
||||
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
|
||||
return;
|
||||
}
|
||||
|
||||
if (op_array->static_variables) {
|
||||
HashTable *ht;
|
||||
|
||||
UNSERIALIZE_PTR(op_array->static_variables);
|
||||
@@ -1116,6 +1128,26 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||
script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR);
|
||||
}
|
||||
|
||||
if (op_array->fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
if (op_array->static_variables) {
|
||||
ZEND_MAP_PTR_NEW(op_array->static_variables_ptr);
|
||||
} else {
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
}
|
||||
ZEND_MAP_PTR_NEW(op_array->run_time_cache);
|
||||
} else {
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
if (ZEND_MAP_PTR(op_array->run_time_cache)) {
|
||||
if (script->corrupted) {
|
||||
/* Not in SHM: Use serialized arena pointer. */
|
||||
UNSERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache));
|
||||
} else {
|
||||
/* In SHM: Allocate new pointer. */
|
||||
ZEND_MAP_PTR_NEW(op_array->run_time_cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (op_array->refcount) {
|
||||
op_array->refcount = NULL;
|
||||
UNSERIALIZE_PTR(op_array->literals);
|
||||
@@ -1132,7 +1164,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||
return;
|
||||
}
|
||||
|
||||
if (op_array->literals && !IS_UNSERIALIZED(op_array->literals)) {
|
||||
if (op_array->literals) {
|
||||
zval *p, *end;
|
||||
|
||||
UNSERIALIZE_PTR(op_array->literals);
|
||||
@@ -1144,7 +1176,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||
}
|
||||
}
|
||||
|
||||
if (!IS_UNSERIALIZED(op_array->opcodes)) {
|
||||
{
|
||||
zend_op *opline, *end;
|
||||
|
||||
UNSERIALIZE_PTR(op_array->opcodes);
|
||||
@@ -1244,26 +1276,6 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||
UNSERIALIZE_STR(op_array->doc_comment);
|
||||
UNSERIALIZE_PTR(op_array->try_catch_array);
|
||||
UNSERIALIZE_PTR(op_array->prototype);
|
||||
|
||||
if (op_array->fn_flags & ZEND_ACC_IMMUTABLE) {
|
||||
if (op_array->static_variables) {
|
||||
ZEND_MAP_PTR_NEW(op_array->static_variables_ptr);
|
||||
} else {
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
}
|
||||
ZEND_MAP_PTR_NEW(op_array->run_time_cache);
|
||||
} else {
|
||||
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
|
||||
if (ZEND_MAP_PTR(op_array->run_time_cache)) {
|
||||
if (script->corrupted) {
|
||||
/* Not in SHM: Use serialized arena pointer. */
|
||||
UNSERIALIZE_PTR(ZEND_MAP_PTR(op_array->run_time_cache));
|
||||
} else {
|
||||
/* In SHM: Allocate new pointer. */
|
||||
ZEND_MAP_PTR_NEW(op_array->run_time_cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3860,10 +3860,6 @@ static EVP_PKEY * php_openssl_evp_from_zval(
|
||||
if (!what) {
|
||||
TMP_CLEAN;
|
||||
}
|
||||
if (resourceval) {
|
||||
*resourceval = res;
|
||||
Z_ADDREF_P(val);
|
||||
}
|
||||
if (res->type == le_x509) {
|
||||
/* extract key from cert, depending on public_key param */
|
||||
cert = (X509*)what;
|
||||
@@ -3887,6 +3883,10 @@ static EVP_PKEY * php_openssl_evp_from_zval(
|
||||
zval_ptr_dtor_str(&tmp);
|
||||
}
|
||||
/* got the key - return it */
|
||||
if (resourceval) {
|
||||
*resourceval = res;
|
||||
Z_ADDREF_P(val);
|
||||
}
|
||||
return (EVP_PKEY*)what;
|
||||
}
|
||||
} else {
|
||||
@@ -6521,11 +6521,6 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
|
||||
{
|
||||
char *iv_new;
|
||||
|
||||
/* Best case scenario, user behaved */
|
||||
if (*piv_len == iv_required_len) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (mode->is_aead) {
|
||||
if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_ivlen_flag, *piv_len, NULL) != 1) {
|
||||
php_error_docref(NULL, E_WARNING, "Setting of IV length for AEAD mode failed");
|
||||
@@ -6534,6 +6529,11 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Best case scenario, user behaved */
|
||||
if (*piv_len == iv_required_len) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
iv_new = ecalloc(1, iv_required_len + 1);
|
||||
|
||||
if (*piv_len == 0) {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Bug #79881: Memory leak in openssl_pkey_get_public()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$cert = "-----BEGIN CERTIFICATE-----
|
||||
MIIE4jCCAsqgAwIBAgIHBZCisfbbfTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQG
|
||||
EwJHQjEPMA0GA1UECAwGTG9uZG9uMRcwFQYDVQQKDA5Hb29nbGUgVUsgTHRkLjEh
|
||||
MB8GA1UECwwYQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5MSMwIQYDVQQDDBpNZXJn
|
||||
ZSBEZWxheSBJbnRlcm1lZGlhdGUgMTAeFw0xOTA4MjExNjAyMDhaFw0yMjEwMTMw
|
||||
NTQ0MjdaMHUxCzAJBgNVBAYTAkdCMQ8wDQYDVQQHDAZMb25kb24xOjA4BgNVBAoM
|
||||
MUdvb2dsZSBDZXJ0aWZpY2F0ZSBUcmFuc3BhcmVuY3kgKFByZWNlcnQgU2lnbmlu
|
||||
ZykxGTAXBgNVBAUTEDE1NjY0MDMzMjg0MDAyNTMwggEiMA0GCSqGSIb3DQEBAQUA
|
||||
A4IBDwAwggEKAoIBAQDdr1pIlcp/wH42Yb/kxiyx06DKKUO3vZj1Zx7W0kGOPlfP
|
||||
KroFcSLbCxnrzm1iENVbflBcbeGY1hF3c5cDxs/6bh88Y/5gA1rhP0q1c02Y9yPN
|
||||
Yo+pi6vfJK41CwsMHTie0U01Ghynzy/683+5tpigp2MccsrPFi5Sk7WMgR78Y6dt
|
||||
oEH9KZtdbuBlUzyEjnDzR5F7UB3YtrYVOKeYlsYEDmgLZKSMtP9M7/XIc8kUqT1L
|
||||
VDcB/kk46plGV0b93P+HSPdQcqAUIoqa/zmDnR8XZZGShg1OyJPhB75xCahMr6wL
|
||||
aXyEFtOwgjDnUZIb5DgpUVwHBq4Xw3QYYmtjk7eVAgMBAAGjbTBrMBgGA1UdJQEB
|
||||
/wQOMAwGCisGAQQB1nkCBAQwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTp
|
||||
PAThgC/ChBMtJnCe8v0az6r+xjAdBgNVHQ4EFgQUq3H778kIPz+bmq6to3MFNtGz
|
||||
qeQwDQYJKoZIhvcNAQEFBQADggIBACYc4ubDw8J7g+AYIS42K2RH/AZ5pf9KAZ+C
|
||||
OyFkZ5/LV3gNn1CAKFDOyjrGNA6r2yyHZ8TqyKguZqpFLVf1Vn7ll8u38hp7mBFO
|
||||
/bZGnCdZTtW8Ae8zNQXuFbXoItCk6unGPQsp7/5mHD8nsrqO512zEHuPA+b3v/ZR
|
||||
tSwkaJZM3W4LhHWiplEoA0F9CCnBKB1W00LDMZTLa4CRdGJlrjwchG0No+ItGrXZ
|
||||
cc+wLMic6UZ1QrXcvo9efj6/bjLHTee39u4SlIcuL20x97993HZyqP5ZSi+QkKfr
|
||||
Af441uJNHOFmoClCo6Wb2quNn6F6GvhYxkYcy/CgVP+VOfUBPIF8Ta2KrcI46fAL
|
||||
Qq6d/SK0GtjlRZME8h48tocBCGvtcZwmZnOQDLd3M51rmfXKB/6y70PjJqiX9ExR
|
||||
CJzpfafv1OaOqtWre6UofQsEx+jP+P7iGqQo+W9XrufnE7IDso+Za98G5cUIj61a
|
||||
U6sTKt8w+Ovkxr3UyC/QHdYYJ7nYQfrJ2ml9aAzs1ZlNS8YS0XXpzmpaZhSuhbfM
|
||||
F6F0Drg3+os4hVFiimUOjspZ4Su2EpsG86hdqJ/HHxTPPfgVlbBP0mexaRco3KVv
|
||||
pgJ4B+Hh5oOOh9TkR+D3ZKzjc6G2+4nhflYjI AD7B080Jshk6TcII1twXD9qBkvm
|
||||
9J3nrHWc
|
||||
-----END CERTIFICATE-----";
|
||||
|
||||
$mem1 = memory_get_usage();
|
||||
$read = openssl_x509_read($cert);
|
||||
$key = openssl_pkey_get_public($read);
|
||||
unset($read, $key);
|
||||
$mem2 = memory_get_usage();
|
||||
var_dump($mem1 == $mem2);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,5 +1,26 @@
|
||||
<?php
|
||||
$php_openssl_cipher_tests = array(
|
||||
'aes-128-ccm' => array(
|
||||
array(
|
||||
'key' => '404142434445464748494a4b4c4d4e4f',
|
||||
'iv' => '1011121314151617',
|
||||
'aad' => '000102030405060708090a0b0c0d0e0f',
|
||||
'tag' => '1fc64fbfaccd',
|
||||
'pt' => '202122232425262728292a2b2c2d2e2f',
|
||||
'ct' => 'd2a1f0e051ea5f62081a7792073d593d',
|
||||
),
|
||||
array(
|
||||
'key' => '404142434445464748494a4b4c4d4e4f',
|
||||
'iv' => '101112131415161718191a1b',
|
||||
'aad' => '000102030405060708090a0b0c0d0e0f' .
|
||||
'10111213',
|
||||
'tag' => '484392fbc1b09951',
|
||||
'pt' => '202122232425262728292a2b2c2d2e2f' .
|
||||
'3031323334353637',
|
||||
'ct' => 'e3b201a9f5b71a7a9b1ceaeccd97e70b' .
|
||||
'6176aad9a4428aa5',
|
||||
),
|
||||
),
|
||||
'aes-256-ccm' => array(
|
||||
array(
|
||||
'key' => '1bde3251d41a8b5ea013c195ae128b21' .
|
||||
|
||||
@@ -10,14 +10,16 @@ if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/cipher_tests.inc";
|
||||
$method = 'aes-256-ccm';
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
$methods = ['aes-128-ccm', 'aes-256-ccm'];
|
||||
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "TEST $idx\n";
|
||||
$pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $test['tag'], $test['aad']);
|
||||
var_dump($test['pt'] === $pt);
|
||||
foreach ($methods as $method) {
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "$method - TEST $idx\n";
|
||||
$pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $test['tag'], $test['aad']);
|
||||
var_dump($test['pt'] === $pt);
|
||||
}
|
||||
}
|
||||
|
||||
// no IV
|
||||
@@ -32,7 +34,11 @@ var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
TEST 0
|
||||
aes-128-ccm - TEST 0
|
||||
bool(true)
|
||||
aes-128-ccm - TEST 1
|
||||
bool(true)
|
||||
aes-256-ccm - TEST 0
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_decrypt(): Setting of IV length for AEAD mode failed in %s on line %d
|
||||
|
||||
@@ -10,15 +10,17 @@ if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/cipher_tests.inc";
|
||||
$method = 'aes-256-ccm';
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
$methods = ['aes-128-ccm', 'aes-256-ccm'];
|
||||
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "TEST $idx\n";
|
||||
$ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $tag, $test['aad'], strlen($test['tag']));
|
||||
var_dump($test['ct'] === $ct);
|
||||
var_dump($test['tag'] === $tag);
|
||||
foreach ($methods as $method) {
|
||||
$tests = openssl_get_cipher_tests($method);
|
||||
foreach ($tests as $idx => $test) {
|
||||
echo "$method - TEST $idx\n";
|
||||
$ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
|
||||
$test['iv'], $tag, $test['aad'], strlen($test['tag']));
|
||||
var_dump($test['ct'] === $ct);
|
||||
var_dump($test['tag'] === $tag);
|
||||
}
|
||||
}
|
||||
|
||||
// Empty IV error
|
||||
@@ -32,7 +34,13 @@ var_dump(strlen($tag));
|
||||
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 16), $tag, '', 1024));
|
||||
?>
|
||||
--EXPECTF--
|
||||
TEST 0
|
||||
aes-128-ccm - TEST 0
|
||||
bool(true)
|
||||
bool(true)
|
||||
aes-128-ccm - TEST 1
|
||||
bool(true)
|
||||
bool(true)
|
||||
aes-256-ccm - TEST 0
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ if (!extension_loaded('pcntl')) {
|
||||
if (!function_exists('pcntl_setpriority')) {
|
||||
die('skip pcntl_setpriority doesn\'t exist');
|
||||
}
|
||||
if (!function_exists('posix_getuid') || posix_getuid() !== 0) {
|
||||
die('skip this functions needs to run with superuser');
|
||||
if (@pcntl_setpriority(-5) === false && pcntl_get_last_error() == PCNTL_EACCES) {
|
||||
die('skip this function needs to run with CAP_SYS_NICE privileges');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -6,7 +6,7 @@ if (!extension_loaded("pcntl")) die("skip");
|
||||
if (!extension_loaded("posix")) die("skip posix extension not available");
|
||||
if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available");
|
||||
if (!defined("CLONE_NEWUSER")) die("skip flag unavailable");
|
||||
if (pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM) {
|
||||
if (@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM) {
|
||||
die("skip Insufficient previleges to use CLONE_NEWUSER");
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,11 @@ if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
|
||||
if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
|
||||
if (posix_getuid() !== 0 &&
|
||||
(!defined("CLONE_NEWUSER") ||
|
||||
(pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
|
||||
die("skip Insufficient previleges to run test");
|
||||
(@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
|
||||
die("skip Insufficient privileges for CLONE_NEWUSER");
|
||||
}
|
||||
if (@pcntl_unshare(CLONE_NEWPID) == false && pcntl_get_last_error() == PCNTL_EPERM) {
|
||||
die("skip Insufficient privileges for CLONE_NEWPID");
|
||||
}
|
||||
|
||||
--FILE--
|
||||
|
||||
@@ -37,6 +37,33 @@
|
||||
|
||||
static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value);
|
||||
|
||||
void pdo_throw_exception(unsigned int driver_errcode, char *driver_errmsg, pdo_error_type *pdo_error)
|
||||
{
|
||||
zval error_info,pdo_exception;
|
||||
char *pdo_exception_message;
|
||||
|
||||
object_init_ex(&pdo_exception, php_pdo_get_exception());
|
||||
array_init(&error_info);
|
||||
|
||||
add_next_index_string(&error_info, *pdo_error);
|
||||
add_next_index_long(&error_info, driver_errcode);
|
||||
add_next_index_string(&error_info, driver_errmsg);
|
||||
|
||||
spprintf(&pdo_exception_message, 0,"SQLSTATE[%s] [%d] %s",*pdo_error, driver_errcode, driver_errmsg);
|
||||
zend_update_property(php_pdo_get_exception(), &pdo_exception, "errorInfo", sizeof("errorInfo")-1, &error_info);
|
||||
zend_update_property_long(php_pdo_get_exception(), &pdo_exception, "code", sizeof("code")-1, driver_errcode);
|
||||
zend_update_property_string(
|
||||
php_pdo_get_exception(),
|
||||
&pdo_exception,
|
||||
"message",
|
||||
sizeof("message")-1,
|
||||
pdo_exception_message
|
||||
);
|
||||
efree(pdo_exception_message);
|
||||
zval_ptr_dtor(&error_info);
|
||||
zend_throw_exception_object(&pdo_exception);
|
||||
}
|
||||
|
||||
void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp) /* {{{ */
|
||||
{
|
||||
pdo_error_type *pdo_err = &dbh->error_code;
|
||||
|
||||
@@ -163,6 +163,10 @@ static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_typ
|
||||
struct pdo_bound_param_data *param;
|
||||
HashTable *ht;
|
||||
|
||||
if (stmt->dbh->skip_param_evt & (1 << event_type)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!stmt->methods->param_hook) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -468,9 +468,12 @@ struct _pdo_dbh_t {
|
||||
/* when set, convert int/floats to strings */
|
||||
unsigned stringify:1;
|
||||
|
||||
/* bitmap for pdo_param_event(s) to skip in dispatch_param_event */
|
||||
unsigned skip_param_evt:7;
|
||||
|
||||
/* the sum of the number of bits here and the bit fields preceding should
|
||||
* equal 32 */
|
||||
unsigned _reserved_flags:21;
|
||||
unsigned _reserved_flags:14;
|
||||
|
||||
/* data source string used to open this handle */
|
||||
const char *data_source;
|
||||
@@ -691,4 +694,5 @@ PDO_API void php_pdo_dbh_delref(pdo_dbh_t *dbh);
|
||||
PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt);
|
||||
|
||||
|
||||
PDO_API void pdo_throw_exception(unsigned int driver_errcode, char *driver_errmsg, pdo_error_type *pdo_error);
|
||||
#endif /* PHP_PDO_DRIVER_H */
|
||||
@@ -103,8 +103,7 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
|
||||
|
||||
if (!dbh->methods) {
|
||||
PDO_DBG_INF("Throwing exception");
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode, "SQLSTATE[%s] [%d] %s",
|
||||
*pdo_err, einfo->errcode, einfo->errmsg);
|
||||
pdo_throw_exception(einfo->errcode, einfo->errmsg, pdo_err);
|
||||
}
|
||||
|
||||
PDO_DBG_RETURN(einfo->errcode);
|
||||
@@ -620,6 +619,13 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
|
||||
|
||||
dbh->driver_data = H;
|
||||
|
||||
dbh->skip_param_evt =
|
||||
1 << PDO_PARAM_EVT_FREE |
|
||||
1 << PDO_PARAM_EVT_EXEC_POST |
|
||||
1 << PDO_PARAM_EVT_FETCH_PRE |
|
||||
1 << PDO_PARAM_EVT_FETCH_POST |
|
||||
1 << PDO_PARAM_EVT_NORMALIZE;
|
||||
|
||||
#ifndef PDO_USE_MYSQLND
|
||||
H->max_buffer_size = 1024*1024;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #64705 errorInfo property of PDOException is null when PDO::__construct() fails
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_mysql')) print 'skip not loaded';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dsn = 'mysql:host=DonotExistsHost;dbname=test;user=foo;password=wrongpass';
|
||||
try {
|
||||
$pdo = new \PDO($dsn, null, null);
|
||||
} catch (\PDOException $e) {
|
||||
var_dump(!empty($e->errorInfo) && is_array($e->errorInfo));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -688,6 +688,11 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ *
|
||||
H = pecalloc(1, sizeof(*H), dbh->is_persistent);
|
||||
dbh->driver_data = H;
|
||||
|
||||
dbh->skip_param_evt =
|
||||
1 << PDO_PARAM_EVT_FETCH_PRE |
|
||||
1 << PDO_PARAM_EVT_FETCH_POST |
|
||||
1 << PDO_PARAM_EVT_NORMALIZE;
|
||||
|
||||
H->prefetch = PDO_OCI_PREFETCH_DEFAULT;
|
||||
|
||||
/* allocate an environment */
|
||||
|
||||
@@ -96,8 +96,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *
|
||||
}
|
||||
|
||||
if (!dbh->methods) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode, "SQLSTATE[%s] [%d] %s",
|
||||
*pdo_err, einfo->errcode, einfo->errmsg);
|
||||
pdo_throw_exception(einfo->errcode, einfo->errmsg, pdo_err);
|
||||
}
|
||||
|
||||
return errcode;
|
||||
@@ -1197,6 +1196,11 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
|
||||
H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent);
|
||||
dbh->driver_data = H;
|
||||
|
||||
dbh->skip_param_evt =
|
||||
1 << PDO_PARAM_EVT_EXEC_POST |
|
||||
1 << PDO_PARAM_EVT_FETCH_PRE |
|
||||
1 << PDO_PARAM_EVT_FETCH_POST;
|
||||
|
||||
H->einfo.errcode = 0;
|
||||
H->einfo.errmsg = NULL;
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (param->is_param) {
|
||||
} else if (param->is_param && event_type == PDO_PARAM_EVT_NORMALIZE) {
|
||||
/* We need to manually convert to a pg native boolean value */
|
||||
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL &&
|
||||
((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) {
|
||||
|
||||
Loaded 100 of 183 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user