mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 03:00:49 +00:00
Compare commits
95
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
251b1fe177 | ||
|
|
78c2deb356 | ||
|
|
de777c8fd2 | ||
|
|
e00cc56596 | ||
|
|
25b6c0ced0 | ||
|
|
4e198c0064 | ||
|
|
dfb3a79914 | ||
|
|
2d4aa1ef3d | ||
|
|
5dcb8f2f1c | ||
|
|
07cb665515 | ||
|
|
e8d36ce762 | ||
|
|
46a49be6c8 | ||
|
|
1848ccdae2 | ||
|
|
c70a938f28 | ||
|
|
573ad182d2 | ||
|
|
54dbd3eccc | ||
|
|
2e9e706a82 | ||
|
|
a07c1f56aa | ||
|
|
cd2afd99b1 | ||
|
|
488e53c18b | ||
|
|
778902db63 | ||
|
|
44ade0e875 | ||
|
|
ad750c3bb6 | ||
|
|
376bbbdf3b | ||
|
|
e948188832 | ||
|
|
62dce97973 | ||
|
|
1b7ee6db88 | ||
|
|
75ac3f1cba | ||
|
|
5ff15e2651 | ||
|
|
d179e34e42 | ||
|
|
3324bb893e | ||
|
|
063082043a | ||
|
|
74de17f2ea | ||
|
|
844a2dd6ac | ||
|
|
fcd26ffcc3 | ||
|
|
b2a33ab06b | ||
|
|
46d62e5464 | ||
|
|
f7c43b8c72 | ||
|
|
ff14b7adad | ||
|
|
1ae80f8c92 | ||
|
|
f6d7af21a3 | ||
|
|
2fe2e5b48f | ||
|
|
2fa4ca95db | ||
|
|
dc108feab8 | ||
|
|
9d9dffe60a | ||
|
|
07cb2755be | ||
|
|
4723bd4ffa | ||
|
|
a06eed0c0e | ||
|
|
0af3f49312 | ||
|
|
5be670265b | ||
|
|
06ade15528 | ||
|
|
6a1bd57df5 | ||
|
|
da786a22af | ||
|
|
12db8b90a7 | ||
|
|
c4677af67e | ||
|
|
4221e000b1 | ||
|
|
6b8ffdbdeb | ||
|
|
f3a43e85e7 | ||
|
|
fdf6b0fefe | ||
|
|
17d64af186 | ||
|
|
07aeb9171d | ||
|
|
5b29af5c78 | ||
|
|
ff577b04c0 | ||
|
|
7355ab8176 | ||
|
|
1e0bc6e30f | ||
|
|
d95c53834c | ||
|
|
57ad5b3432 | ||
|
|
99c48a2477 | ||
|
|
e767ca60a0 | ||
|
|
0b8c83f593 | ||
|
|
9a744c66e7 | ||
|
|
c756f82c02 | ||
|
|
efe6d96b45 | ||
|
|
1aeff522b8 | ||
|
|
d5b59b4303 | ||
|
|
6f18d7e2f9 | ||
|
|
874284d1c9 | ||
|
|
c39f5fe94e | ||
|
|
15efb96d4c | ||
|
|
6b99a8be4d | ||
|
|
2c0a6977dd | ||
|
|
b2e3fd1e69 | ||
|
|
2c57378bd3 | ||
|
|
ce149b0cb8 | ||
|
|
f0b2c2cb98 | ||
|
|
56dec3cc73 | ||
|
|
150504e6b1 | ||
|
|
a72c53a070 | ||
|
|
23ef0a1285 | ||
|
|
3d5de7d746 | ||
|
|
e6160e99d8 | ||
|
|
e54f18ae0f | ||
|
|
c68d48de9e | ||
|
|
9588c8474e | ||
|
|
f23bd48892 |
No files matched your search
@@ -1,12 +1,100 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.3.21
|
||||
01 Oct 2020, PHP 7.3.23
|
||||
|
||||
- Core:
|
||||
. 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)
|
||||
. Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-`
|
||||
cookies can be sent). (CVE-2020-7070) (Stas)
|
||||
|
||||
- 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 #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.3.22
|
||||
|
||||
- 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)
|
||||
|
||||
- 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)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #64705 (errorInfo property of PDOException is null when
|
||||
PDO::__construct() fails). (Ahmed Abdou)
|
||||
|
||||
- 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.3.21
|
||||
|
||||
- Apache:
|
||||
. Fixed bug #79030 (Upgrade apache2handler's php_apache_sapi_get_request_time
|
||||
to return usec). (Herbert256)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79877 (getimagesize function silently truncates after a null
|
||||
byte) (cmb)
|
||||
. Fixed bug #79778 (Assertion failure if dumping closure with unresolved
|
||||
static variable). (Nikita)
|
||||
. Fixed bug #79792 (HT iterators not removed if empty array is destroyed).
|
||||
@@ -14,7 +102,9 @@ PHP NEWS
|
||||
|
||||
- COM:
|
||||
. Fixed bug #63208 (BSTR to PHP string conversion not binary safe). (cmb)
|
||||
|
||||
. Fixed bug #63527 (DCOM does not work with Username, Password parameter).
|
||||
(cmb)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #79741 (curl_setopt CURLOPT_POSTFIELDS asserts on object with
|
||||
declared properties). (Nikita)
|
||||
@@ -25,10 +115,20 @@ PHP NEWS
|
||||
- FTP:
|
||||
. Fixed bug #55857 (ftp_size on large files). (cmb)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #79787 (mb_strimwidth does not trim string). (XXiang)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #79797 (Use of freed hash key in the phar_parse_zipfile
|
||||
function). (CVE-2020-7068) (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70362 (Can't copy() large 'data://' with open_basedir). (cmb)
|
||||
. Fixed bug #79817 (str_replace() does not handle INDIRECT elements). (Nikita)
|
||||
. Fixed bug #78008 (dns_check_record() always return true on Alpine).
|
||||
(Andy Postnikov)
|
||||
|
||||
?? ??? ????, PHP 7.3.20
|
||||
09 Jul 2020, PHP 7.3.20
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79650 (php-win.exe 100% cpu lockup). (cmb)
|
||||
|
||||
@@ -151,6 +151,11 @@ Reflection:
|
||||
. Reflection export to string now uses `int` and `bool` instead of `integer`
|
||||
and `boolean`.
|
||||
|
||||
SAPI:
|
||||
. Starting with 7.3.24, 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:
|
||||
. If an SPL autoloader throws an exception, following autoloaders will not be
|
||||
executed. Previously all autoloaders were executed and exceptions were
|
||||
|
||||
@@ -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,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,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
|
||||
@@ -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
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "3.3.21-dev"
|
||||
#define ZEND_VERSION "3.3.23"
|
||||
|
||||
#define ZEND_ENGINE_3
|
||||
|
||||
|
||||
+4
-41
@@ -4230,7 +4230,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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4238,54 +4238,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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -882,9 +882,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) {
|
||||
|
||||
@@ -1329,6 +1329,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();
|
||||
|
||||
@@ -709,6 +709,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;
|
||||
}
|
||||
@@ -737,7 +740,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
@@ -334,7 +334,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) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 1.0.1 */
|
||||
/* Generated by re2c 1.3 */
|
||||
#line 1 "Zend/zend_language_scanner.l"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -1069,8 +1069,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);
|
||||
}
|
||||
@@ -1115,6 +1114,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;
|
||||
|
||||
@@ -1066,8 +1066,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);
|
||||
}
|
||||
@@ -1112,6 +1111,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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* Generated by re2c 1.0.1 */
|
||||
#line 3 "Zend/zend_language_scanner_defs.h"
|
||||
/* Generated by re2c 1.3 */
|
||||
|
||||
enum YYCONDTYPE {
|
||||
yycST_IN_SCRIPTING,
|
||||
|
||||
@@ -1836,6 +1836,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 ZEND_FILE_LINE_CC);
|
||||
}
|
||||
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
@@ -845,6 +845,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) {
|
||||
@@ -867,7 +868,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)
|
||||
@@ -928,7 +929,7 @@ retry:
|
||||
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
|
||||
CloseHandle(hLink);
|
||||
(*ll)--;
|
||||
goto retry;
|
||||
goto retry_reparse_tag_cloud;
|
||||
}
|
||||
free_alloca(tmp, use_heap);
|
||||
CloseHandle(hLink);
|
||||
@@ -1075,6 +1076,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*/
|
||||
|
||||
@@ -4819,6 +4819,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_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
|
||||
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
|
||||
@@ -7371,6 +7372,7 @@ ZEND_VM_HANDLER(142, 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();
|
||||
}
|
||||
|
||||
@@ -2375,6 +2375,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_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
|
||||
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
|
||||
@@ -3707,6 +3708,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();
|
||||
}
|
||||
@@ -18346,6 +18348,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();
|
||||
}
|
||||
@@ -21672,6 +21675,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();
|
||||
}
|
||||
@@ -37896,6 +37900,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();
|
||||
}
|
||||
|
||||
+2
-2
@@ -329,8 +329,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
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=21
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=23
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -133,7 +133,7 @@ PHP_FUNCTION(com_create_instance)
|
||||
info.pwszName = php_com_string_to_olestring(server_name, server_name_len, obj->code_page);
|
||||
|
||||
if (user_name) {
|
||||
authid.User = php_com_string_to_olestring(user_name, -1, obj->code_page);
|
||||
authid.User = (OLECHAR*)user_name;
|
||||
authid.UserLength = (ULONG)user_name_len;
|
||||
|
||||
if (password) {
|
||||
@@ -221,7 +221,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 +247,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 +439,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;
|
||||
@@ -589,6 +589,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;
|
||||
@@ -838,9 +839,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,9 +252,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
|
||||
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);
|
||||
@@ -387,7 +389,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;
|
||||
@@ -437,7 +439,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);
|
||||
|
||||
@@ -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
@@ -66,7 +66,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)
|
||||
@@ -1940,6 +1941,7 @@ typedef struct {
|
||||
int read_thumbnail;
|
||||
int read_all;
|
||||
int ifd_nesting_level;
|
||||
int ifd_count;
|
||||
/* internal */
|
||||
file_section_list file;
|
||||
} image_info_type;
|
||||
@@ -2674,6 +2676,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 */
|
||||
@@ -3173,6 +3176,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;
|
||||
@@ -3203,15 +3223,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,
|
||||
@@ -3238,7 +3249,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;
|
||||
@@ -3251,13 +3262,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);
|
||||
@@ -3577,6 +3581,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)
|
||||
@@ -4010,7 +4032,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;
|
||||
@@ -4019,10 +4041,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
|
||||
@@ -4166,7 +4184,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
|
||||
@@ -4210,7 +4227,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);
|
||||
@@ -4247,6 +4263,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)
|
||||
@@ -4402,6 +4433,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
|
||||
|
||||
|
||||
ImageInfo->ifd_nesting_level = 0;
|
||||
ImageInfo->ifd_count = 0;
|
||||
|
||||
/* Scan the headers */
|
||||
ret = exif_scan_FILE_header(ImageInfo);
|
||||
|
||||
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.
+133
-109
@@ -167,15 +167,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);
|
||||
@@ -184,6 +186,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;
|
||||
@@ -283,7 +289,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
int control_iscritical = 0, rc = LDAP_SUCCESS;
|
||||
char** ldap_attrs = NULL;
|
||||
LDAPSortKey** sort_keys = NULL;
|
||||
zend_string *tmpstring = NULL;
|
||||
zend_string *tmpstring = NULL, **tmpstrings1 = NULL, **tmpstrings2 = NULL;
|
||||
size_t num_tmpstrings1 = 0, num_tmpstrings2 = 0;
|
||||
|
||||
if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "oid", sizeof("oid") - 1)) == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Control must have an oid key");
|
||||
@@ -301,27 +308,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 +337,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 +355,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 +373,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,15 +383,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;
|
||||
}
|
||||
ber_free(vrber, 1);
|
||||
} else if (ber_flatten2(ber, &control_value, control_value_alloc) == -1) {
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,10 +397,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 {
|
||||
@@ -419,6 +408,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
|
||||
num_attribs = zend_hash_num_elements(Z_ARRVAL_P(tmp));
|
||||
ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0);
|
||||
tmpstrings1 = safe_emalloc(num_attribs, sizeof(zend_string*), 0);
|
||||
num_tmpstrings1 = 0;
|
||||
|
||||
for (i = 0; i<num_attribs; i++) {
|
||||
if ((attr = zend_hash_index_find(Z_ARRVAL_P(tmp), i)) == NULL) {
|
||||
@@ -427,12 +418,13 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
goto failure;
|
||||
}
|
||||
|
||||
tmpstring = zval_get_string(attr);
|
||||
tmpstrings1[num_tmpstrings1] = zval_get_string(attr);
|
||||
if (EG(exception)) {
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
ldap_attrs[i] = ZSTR_VAL(tmpstring);
|
||||
ldap_attrs[i] = ZSTR_VAL(tmpstrings1[num_tmpstrings1]);
|
||||
++num_tmpstrings1;
|
||||
}
|
||||
ldap_attrs[num_attribs] = NULL;
|
||||
|
||||
@@ -443,7 +435,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);
|
||||
@@ -457,6 +449,10 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
|
||||
num_keys = zend_hash_num_elements(Z_ARRVAL_P(val));
|
||||
sort_keys = safe_emalloc((num_keys+1), sizeof(LDAPSortKey*), 0);
|
||||
tmpstrings1 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
|
||||
tmpstrings2 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
|
||||
num_tmpstrings1 = 0;
|
||||
num_tmpstrings2 = 0;
|
||||
|
||||
for (i = 0; i<num_keys; i++) {
|
||||
if ((sortkey = zend_hash_index_find(Z_ARRVAL_P(val), i)) == NULL) {
|
||||
@@ -471,20 +467,22 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
|
||||
goto failure;
|
||||
}
|
||||
sort_keys[i] = emalloc(sizeof(LDAPSortKey));
|
||||
tmpstring = zval_get_string(tmp);
|
||||
tmpstrings1[num_tmpstrings1] = zval_get_string(tmp);
|
||||
if (EG(exception)) {
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
sort_keys[i]->attributeType = ZSTR_VAL(tmpstring);
|
||||
sort_keys[i]->attributeType = ZSTR_VAL(tmpstrings1[num_tmpstrings1]);
|
||||
++num_tmpstrings1;
|
||||
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(sortkey), "oid", sizeof("oid") - 1)) != NULL) {
|
||||
tmpstring = zval_get_string(tmp);
|
||||
tmpstrings2[num_tmpstrings2] = zval_get_string(tmp);
|
||||
if (EG(exception)) {
|
||||
rc = -1;
|
||||
goto failure;
|
||||
}
|
||||
sort_keys[i]->orderingRule = ZSTR_VAL(tmpstring);
|
||||
sort_keys[i]->orderingRule = ZSTR_VAL(tmpstrings2[num_tmpstrings2]);
|
||||
++num_tmpstrings2;
|
||||
} else {
|
||||
sort_keys[i]->orderingRule = NULL;
|
||||
}
|
||||
@@ -496,15 +494,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;
|
||||
@@ -566,15 +560,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));
|
||||
@@ -583,7 +573,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:
|
||||
@@ -591,9 +581,25 @@ failure:
|
||||
if (tmpstring != NULL) {
|
||||
zend_string_release(tmpstring);
|
||||
}
|
||||
if (control_value != NULL) {
|
||||
ber_memfree(control_value);
|
||||
control_value = NULL;
|
||||
if (tmpstrings1 != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < num_tmpstrings1; ++i) {
|
||||
zend_string_release(tmpstrings1[i]);
|
||||
}
|
||||
efree(tmpstrings1);
|
||||
}
|
||||
if (tmpstrings2 != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < num_tmpstrings2; ++i) {
|
||||
zend_string_release(tmpstrings2[i]);
|
||||
}
|
||||
efree(tmpstrings2);
|
||||
}
|
||||
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);
|
||||
@@ -1465,7 +1471,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;
|
||||
@@ -1665,6 +1671,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 {
|
||||
@@ -3438,6 +3449,7 @@ PHP_FUNCTION(ldap_parse_result)
|
||||
/* Reverse -> fall through */
|
||||
switch (myargcount) {
|
||||
case 7:
|
||||
zval_ptr_dtor(serverctrls);
|
||||
_php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0);
|
||||
case 6:
|
||||
zval_ptr_dtor(referrals);
|
||||
@@ -3992,7 +4004,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;
|
||||
@@ -4287,38 +4299,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 */
|
||||
@@ -4327,31 +4332,45 @@ PHP_FUNCTION(ldap_exop_passwd)
|
||||
lnewpw.bv_len > 0 ? &lnewpw : NULL,
|
||||
requestctrls,
|
||||
NULL, &msgid);
|
||||
|
||||
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) {
|
||||
zval_ptr_dtor(serverctrls);
|
||||
_php_ldap_controls_to_array(ld->link, lserverctrls, serverctrls, 0);
|
||||
}
|
||||
|
||||
/* return */
|
||||
if (lnewpw.bv_len == 0) {
|
||||
if (lgenpasswd.bv_len == 0) {
|
||||
RETVAL_EMPTY_STRING();
|
||||
@@ -4365,11 +4384,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
|
||||
|
||||
@@ -1734,13 +1734,17 @@ mbfl_strimwidth(
|
||||
mbfl_convert_filter_flush(encoder);
|
||||
if (pc.status != 0 && mkwidth > 0) {
|
||||
pc.width += mkwidth;
|
||||
while (n > 0) {
|
||||
if ((*encoder->filter_function)(*p++, encoder) < 0) {
|
||||
break;
|
||||
if (n > 0) {
|
||||
while (n > 0) {
|
||||
if ((*encoder->filter_function)(*p++, encoder) < 0) {
|
||||
break;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
n--;
|
||||
mbfl_convert_filter_flush(encoder);
|
||||
} else if (pc.outwidth > pc.width) {
|
||||
pc.status++;
|
||||
}
|
||||
mbfl_convert_filter_flush(encoder);
|
||||
if (pc.status != 1) {
|
||||
pc.status = 10;
|
||||
pc.device.pos = pc.endpos;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #79787 mb_strimwidth does not trim string
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo mb_strimwidth("一二三", 0, 4, '.', 'UTF-8')."\n";
|
||||
echo mb_strimwidth("一二三", 0, 5, '.', 'UTF-8')."\n";
|
||||
echo mb_strimwidth("一二三", 0, 6, '.', 'UTF-8')."\n";
|
||||
echo mb_strimwidth("abcdef", 0, 4, '.', 'UTF-8')."\n";
|
||||
echo mb_strimwidth("abcdef", 0, 5, '.', 'UTF-8')."\n";
|
||||
echo mb_strimwidth("abcdef", 0, 6, '.', 'UTF-8')."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
一.
|
||||
一二.
|
||||
一二三
|
||||
abc.
|
||||
abcd.
|
||||
abcdef
|
||||
@@ -1729,16 +1729,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:
|
||||
|
||||
@@ -223,6 +223,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
|
||||
case ZEND_POST_INC_OBJ:
|
||||
case ZEND_POST_DEC_OBJ:
|
||||
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -487,7 +487,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;
|
||||
@@ -2692,6 +2692,9 @@ static void accel_gen_system_id(void)
|
||||
unsigned char digest[16], c;
|
||||
char *md5str = ZCG(system_id);
|
||||
int i;
|
||||
zend_module_entry *module;
|
||||
zend_extension *extension;
|
||||
zend_llist_position pos;
|
||||
|
||||
PHP_MD5Init(&context);
|
||||
PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
|
||||
@@ -2702,6 +2705,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);
|
||||
for (i = 0; i < 16; i++) {
|
||||
c = digest[i] >> 4;
|
||||
|
||||
@@ -31,10 +31,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;
|
||||
|
||||
@@ -93,28 +94,6 @@ static char *create_name_with_username(char *name)
|
||||
return newname;
|
||||
}
|
||||
|
||||
static char *get_mmap_base_file(void)
|
||||
{
|
||||
static char windir[MAXPATHLEN+UNLEN + 3 + sizeof("\\\\@") + 1 + 32 + 21];
|
||||
char *uname;
|
||||
int l;
|
||||
|
||||
uname = php_win32_get_username();
|
||||
if (!uname) {
|
||||
return NULL;
|
||||
}
|
||||
GetTempPath(MAXPATHLEN, windir);
|
||||
l = strlen(windir);
|
||||
if ('\\' == windir[l-1]) {
|
||||
l--;
|
||||
}
|
||||
snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%s@%.20s@%.32s", ACCEL_FILEMAP_BASE, uname, sapi_module.name, ZCG(system_id));
|
||||
|
||||
free(uname);
|
||||
|
||||
return windir;
|
||||
}
|
||||
|
||||
void zend_shared_alloc_create_lock(void)
|
||||
{
|
||||
memory_mutex = CreateMutex(NULL, FALSE, create_name_with_username(ACCEL_MUTEX_NAME));
|
||||
@@ -143,39 +122,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;
|
||||
|
||||
@@ -231,7 +191,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;
|
||||
}
|
||||
@@ -349,23 +309,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();
|
||||
|
||||
|
||||
@@ -870,7 +870,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
|
||||
info.checksum = zend_adler32(info.checksum, (unsigned char*)ZSTR_VAL((zend_string*)ZCG(mem)), info.str_size);
|
||||
|
||||
#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;
|
||||
|
||||
@@ -6441,11 +6441,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");
|
||||
@@ -6454,6 +6449,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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -36,6 +36,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,6 +694,7 @@ 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 */
|
||||
/*
|
||||
* Local variables:
|
||||
|
||||
@@ -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);
|
||||
@@ -618,6 +617,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)
|
||||
@@ -674,6 +674,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 */
|
||||
|
||||
@@ -101,8 +101,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;
|
||||
@@ -1199,6 +1198,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)) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #64705 errorInfo property of PDOException is null when PDO::__construct() fails
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_pgsql')) print 'skip not loaded';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dsn = 'pgsql: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)
|
||||
@@ -76,8 +76,7 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li
|
||||
}
|
||||
|
||||
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 einfo->errcode;
|
||||
@@ -798,6 +797,9 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{
|
||||
H->einfo.errmsg = NULL;
|
||||
dbh->driver_data = H;
|
||||
|
||||
/* skip all but this one param event */
|
||||
dbh->skip_param_evt = 0x7F ^ (1 << PDO_PARAM_EVT_EXEC_PRE);
|
||||
|
||||
filename = make_filename_safe(dbh->data_source);
|
||||
|
||||
if (!filename) {
|
||||
|
||||
@@ -282,7 +282,7 @@ static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno)
|
||||
|
||||
str = sqlite3_column_name(S->stmt, colno);
|
||||
stmt->columns[colno].name = zend_string_init(str, strlen(str), 0);
|
||||
stmt->columns[colno].maxlen = 0xffffffff;
|
||||
stmt->columns[colno].maxlen = SIZE_MAX;
|
||||
stmt->columns[colno].precision = 0;
|
||||
|
||||
switch (sqlite3_column_type(S->stmt, colno)) {
|
||||
|
||||
@@ -24,7 +24,7 @@ array(6) {
|
||||
["name"]=>
|
||||
string(1) "1"
|
||||
["len"]=>
|
||||
int(4294967295)
|
||||
int(-1)
|
||||
["precision"]=>
|
||||
int(0)
|
||||
["pdo_type"]=>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #64705 errorInfo property of PDOException is null when PDO::__construct() fails
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dsn = 'sqlite:./bug64705NonExistingDir/bug64705NonExistingDb';
|
||||
try {
|
||||
$pdo = new \PDO($dsn, null, null);
|
||||
} catch (\PDOException $e) {
|
||||
var_dump(!empty($e->errorInfo) && is_array($e->errorInfo));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -9,6 +9,7 @@ if (!extension_loaded("phar") || !extension_loaded("zlib")) die("skip");
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
|
||||
die('skip windows only test');
|
||||
}
|
||||
if (file_exists('A:')) die('skip drive A: exists');
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #79797 (Use of freed hash key in the phar_parse_zipfile function)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('phar')) die('skip phar extension not available');
|
||||
?>
|
||||
--INI--
|
||||
phar.cache_list={PWD}/bug79797.phar
|
||||
--FILE--
|
||||
<?php
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
+1
-1
@@ -705,7 +705,7 @@ foundit:
|
||||
efree(actual_alias);
|
||||
}
|
||||
|
||||
zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len, mydata);
|
||||
zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), mydata->alias, mydata->alias_len, mydata);
|
||||
} else {
|
||||
phar_archive_data *fd_ptr;
|
||||
|
||||
|
||||
@@ -29,10 +29,12 @@ $_SESSION["Blah"] = "Hello World!";
|
||||
$_SESSION["Foo"] = FALSE;
|
||||
$_SESSION["Guff"] = 1234567890;
|
||||
var_dump($_SESSION);
|
||||
$oldsession = $_SESSION;
|
||||
|
||||
var_dump(session_write_close());
|
||||
session_start();
|
||||
var_dump($_SESSION);
|
||||
// the session may have been GC'd or not; we accept either outcome
|
||||
var_dump($_SESSION === $oldsession || $_SESSION === []);
|
||||
var_dump(session_destroy());
|
||||
session_start();
|
||||
var_dump($_SESSION);
|
||||
@@ -51,14 +53,7 @@ array(3) {
|
||||
int(1234567890)
|
||||
}
|
||||
bool(true)
|
||||
array(3) {
|
||||
["Blah"]=>
|
||||
string(12) "Hello World!"
|
||||
["Foo"]=>
|
||||
bool(false)
|
||||
["Guff"]=>
|
||||
int(1234567890)
|
||||
}
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(0) {
|
||||
}
|
||||
|
||||
+15
-2
@@ -1375,11 +1375,24 @@ static char *get_http_header_value(char *headers, char *type)
|
||||
|
||||
/* match */
|
||||
tmp = pos + typelen;
|
||||
|
||||
/* strip leading whitespace */
|
||||
while (*tmp == ' ' || *tmp == '\t') {
|
||||
tmp++;
|
||||
}
|
||||
|
||||
eol = strchr(tmp, '\n');
|
||||
if (eol == NULL) {
|
||||
eol = headers + headerslen;
|
||||
} else if (eol > tmp && *(eol-1) == '\r') {
|
||||
eol--;
|
||||
} else if (eol > tmp) {
|
||||
if (*(eol-1) == '\r') {
|
||||
eol--;
|
||||
}
|
||||
|
||||
/* strip trailing whitespace */
|
||||
while (eol > tmp && (*(eol-1) == ' ' || *(eol-1) == '\t')) {
|
||||
eol--;
|
||||
}
|
||||
}
|
||||
return estrndup(tmp, eol - tmp);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2059,7 +2059,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
|
||||
our fault code with their own handling... Figure this out later
|
||||
*/
|
||||
if (use_http_error_status) {
|
||||
sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
|
||||
sapi_add_header("HTTP/1.1 500 Internal Server Error", sizeof("HTTP/1.1 500 Internal Server Error")-1, 1);
|
||||
}
|
||||
if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
|
||||
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
--TEST--
|
||||
Bug #47021 SoapClient (SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked")
|
||||
--INI--
|
||||
soap.wsdl_cache_enabled=0
|
||||
--SKIPIF--
|
||||
<?php
|
||||
|
||||
require 'skipif.inc';
|
||||
|
||||
require __DIR__.'/../../standard/tests/http/server.inc'; http_server_skipif('tcp://127.0.0.1:12342');
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__.'/../../standard/tests/http/server.inc';
|
||||
|
||||
function chunk_body($body, $n)
|
||||
{
|
||||
$chunks = str_split($body, $n);
|
||||
$chunks[] = '';
|
||||
|
||||
foreach ($chunks as $k => $v) {
|
||||
$chunks[$k] = sprintf("%08x\r\n%s\r\n", strlen($v), $v);
|
||||
}
|
||||
|
||||
return join('', $chunks);
|
||||
}
|
||||
|
||||
$wsdl = file_get_contents(__DIR__.'/server030.wsdl');
|
||||
|
||||
$soap = <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getItemsResponse><getItemsReturn SOAP-ENC:arrayType="ns1:Item[10]" xsi:type="ns1:ItemArray"><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text0</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text1</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text2</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text3</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text4</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text5</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text6</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text7</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text8</text></item><item xsi:type="ns1:Item"><text xsi:type="xsd:string">text9</text></item></getItemsReturn></ns1:getItemsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
EOF;
|
||||
|
||||
$responses = [
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n".
|
||||
"Content-Type: text/xml;charset=utf-8\r\n".
|
||||
"Transfer-Encoding: \t chunked\t \r\n".
|
||||
"Connection: close\r\n".
|
||||
"\r\n".
|
||||
chunk_body($wsdl, 64),
|
||||
"data://text/plain,HTTP/1.1 200 OK\r\n".
|
||||
"Content-Type: text/xml;charset=utf-8\r\n".
|
||||
"Transfer-Encoding: \t chunked\t \r\n".
|
||||
"Connection: close\r\n".
|
||||
"\r\n".
|
||||
chunk_body($soap, 156),
|
||||
];
|
||||
|
||||
|
||||
$pid = http_server('tcp://127.0.0.1:12342', $responses);
|
||||
|
||||
$options = [
|
||||
'trace' => true,
|
||||
'location' => 'http://127.0.0.1:12342/',
|
||||
];
|
||||
|
||||
class BugSoapClient extends SoapClient
|
||||
{
|
||||
public function __doRequest($request, $location, $action, $version, $one_way = null)
|
||||
{
|
||||
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
|
||||
|
||||
var_dump(strlen($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
$client = new BugSoapClient('http://127.0.0.1:12342/', $options);
|
||||
|
||||
var_dump(count($client->getItems()));
|
||||
|
||||
http_server_kill($pid);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1291)
|
||||
int(10)
|
||||
@@ -197,14 +197,13 @@ PHP_FUNCTION(socket_sendmsg)
|
||||
res = sendmsg(php_sock->bsd_socket, msghdr, (int)flags);
|
||||
|
||||
if (res != -1) {
|
||||
zend_llist_destroy(allocations);
|
||||
efree(allocations);
|
||||
|
||||
RETURN_LONG((zend_long)res);
|
||||
RETVAL_LONG((zend_long)res);
|
||||
} else {
|
||||
PHP_SOCKET_ERROR(php_sock, "error in sendmsg", errno);
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
allocations_dispose(&allocations);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(socket_recvmsg)
|
||||
@@ -254,7 +253,6 @@ PHP_FUNCTION(socket_recvmsg)
|
||||
|
||||
/* we don;t need msghdr anymore; free it */
|
||||
msghdr = NULL;
|
||||
allocations_dispose(&allocations);
|
||||
|
||||
zval_ptr_dtor(zmsg);
|
||||
if (!err.has_error) {
|
||||
@@ -265,14 +263,15 @@ PHP_FUNCTION(socket_recvmsg)
|
||||
/* no need to destroy/free zres -- it's NULL in this circumstance */
|
||||
assert(zres == NULL);
|
||||
}
|
||||
RETVAL_LONG((zend_long)res);
|
||||
} else {
|
||||
SOCKETS_G(last_error) = errno;
|
||||
php_error_docref(NULL, E_WARNING, "error in recvmsg [%d]: %s",
|
||||
errno, sockets_strerror(errno));
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG((zend_long)res);
|
||||
allocations_dispose(&allocations);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(socket_cmsg_space)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Error during socket_sendmsg() or socket_recvmsg()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
socket_sendmsg($socket, [], -1);
|
||||
$message = ['controllen' => 1];
|
||||
socket_recvmsg($socket, $message, -1);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: socket_sendmsg(): error in sendmsg [%d]: %a in %s on line %d
|
||||
|
||||
Warning: socket_recvmsg(): error in recvmsg [%d]: %a in %s on line %d
|
||||
@@ -2885,6 +2885,7 @@ PHP_FUNCTION(sodium_crypto_kx_keypair)
|
||||
zend_throw_exception(sodium_exception_ce, "internal error", 0);
|
||||
return;
|
||||
}
|
||||
ZSTR_VAL(keypair)[crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES] = 0;
|
||||
RETURN_STR(keypair);
|
||||
}
|
||||
|
||||
|
||||
@@ -3615,7 +3615,7 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
Z_TRY_ADDREF_P(src_entry);
|
||||
Z_TRY_ADDREF_P(src_zval);
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(dest_zval), src_zval);
|
||||
}
|
||||
zval_ptr_dtor(&tmp);
|
||||
|
||||
+15
-19
@@ -349,10 +349,8 @@ static void _php_dns_free_res(struct __res_state *res) { /* {{{ */
|
||||
Check DNS records corresponding to a given Internet host name or IP address */
|
||||
PHP_FUNCTION(dns_check_record)
|
||||
{
|
||||
#ifndef MAXPACKET
|
||||
#define MAXPACKET 8192 /* max packet size used internally by BIND */
|
||||
#endif
|
||||
u_char ans[MAXPACKET];
|
||||
HEADER *hp;
|
||||
querybuf answer;
|
||||
char *hostname, *rectype = NULL;
|
||||
size_t hostname_len, rectype_len = 0;
|
||||
int type = T_MX, i;
|
||||
@@ -410,14 +408,14 @@ PHP_FUNCTION(dns_check_record)
|
||||
res_init();
|
||||
#endif
|
||||
|
||||
RETVAL_TRUE;
|
||||
i = php_dns_search(handle, hostname, C_IN, type, ans, sizeof(ans));
|
||||
i = php_dns_search(handle, hostname, C_IN, type, answer.qb2, sizeof answer);
|
||||
php_dns_free_handle(handle);
|
||||
|
||||
if (i < 0) {
|
||||
RETVAL_FALSE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_dns_free_handle(handle);
|
||||
hp = (HEADER *)&answer;
|
||||
RETURN_BOOL(ntohs(hp->ancount) != 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1033,7 +1031,7 @@ PHP_FUNCTION(dns_get_mx)
|
||||
zval *mx_list, *weight_list = NULL;
|
||||
int count, qdc;
|
||||
u_short type, weight;
|
||||
u_char ans[MAXPACKET];
|
||||
querybuf answer;
|
||||
char buf[MAXHOSTNAMELEN];
|
||||
HEADER *hp;
|
||||
u_char *cp, *end;
|
||||
@@ -1076,16 +1074,14 @@ PHP_FUNCTION(dns_get_mx)
|
||||
res_init();
|
||||
#endif
|
||||
|
||||
i = php_dns_search(handle, hostname, C_IN, DNS_T_MX, (u_char *)&ans, sizeof(ans));
|
||||
i = php_dns_search(handle, hostname, C_IN, DNS_T_MX, answer.qb2, sizeof answer);
|
||||
if (i < 0) {
|
||||
php_dns_free_handle(handle);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (i > (int)sizeof(ans)) {
|
||||
i = sizeof(ans);
|
||||
}
|
||||
hp = (HEADER *)&ans;
|
||||
cp = (u_char *)&ans + HFIXEDSZ;
|
||||
end = (u_char *)&ans +i;
|
||||
hp = (HEADER *)&answer;
|
||||
cp = answer.qb2 + HFIXEDSZ;
|
||||
end = answer.qb2 + i;
|
||||
for (qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) {
|
||||
if ((i = dn_skipname(cp, end)) < 0 ) {
|
||||
php_dns_free_handle(handle);
|
||||
@@ -1107,7 +1103,7 @@ PHP_FUNCTION(dns_get_mx)
|
||||
continue;
|
||||
}
|
||||
GETSHORT(weight, cp);
|
||||
if ((i = dn_expand(ans, end, cp, buf, sizeof(buf)-1)) < 0) {
|
||||
if ((i = dn_expand(answer.qb2, end, cp, buf, sizeof(buf)-1)) < 0) {
|
||||
php_dns_free_handle(handle);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1118,7 +1114,7 @@ PHP_FUNCTION(dns_get_mx)
|
||||
}
|
||||
}
|
||||
php_dns_free_handle(handle);
|
||||
RETURN_TRUE;
|
||||
RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL_P(mx_list)) != 0);
|
||||
}
|
||||
/* }}} */
|
||||
#endif /* HAVE_FULL_DNS_FUNCS */
|
||||
|
||||
@@ -1496,6 +1496,11 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
|
||||
Z_PARAM_ZVAL_DEREF(info)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "Invalid path");
|
||||
return;
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
zval_ptr_dtor(info);
|
||||
array_init(info);
|
||||
|
||||
Loaded 100 of 143 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user