mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 16:35:43 +00:00
Compare commits
226
Commits
php-7.4.11
...
php-7.4.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e2e0b5848 | ||
|
|
eedc59df2c | ||
|
|
75c297d39a | ||
|
|
d9f8119f29 | ||
|
|
f419e049ff | ||
|
|
bd2b4a5b2e | ||
|
|
b5ce6df0da | ||
|
|
d971b67027 | ||
|
|
96b725122d | ||
|
|
8eaaabdd58 | ||
|
|
25643b56a2 | ||
|
|
77b6e95d92 | ||
|
|
6808968c89 | ||
|
|
00e41a10b8 | ||
|
|
2cab085bb3 | ||
|
|
e0d6c3f7ba | ||
|
|
4e68c53a21 | ||
|
|
00ba784a2c | ||
|
|
0123f75b5d | ||
|
|
9690ded288 | ||
|
|
83738281eb | ||
|
|
0427dcb913 | ||
|
|
b5481defe6 | ||
|
|
0044a81fbb | ||
|
|
dd97cb1665 | ||
|
|
ee3227af48 | ||
|
|
78b44ddeba | ||
|
|
bd6850a282 | ||
|
|
133ac0151b | ||
|
|
c21e901ba7 | ||
|
|
24537a73c0 | ||
|
|
a66d73db4b | ||
|
|
f547412cba | ||
|
|
68dcaa29d8 | ||
|
|
68f80be9d1 | ||
|
|
990bb34891 | ||
|
|
fe55fe1f54 | ||
|
|
b03776adb5 | ||
|
|
9353f11bd2 | ||
|
|
7817fc07e1 | ||
|
|
cf5d46ba94 | ||
|
|
be6d72b3a4 | ||
|
|
7bc1c0cca8 | ||
|
|
6d2bc72530 | ||
|
|
31aca85572 | ||
|
|
824cbc2781 | ||
|
|
f9ba2ca136 | ||
|
|
7424bfc7ac | ||
|
|
ac2e9587fb | ||
|
|
848e24f24d | ||
|
|
8b59e4e897 | ||
|
|
2be27074b6 | ||
|
|
2e84f4d16a | ||
|
|
d5e2431884 | ||
|
|
12a09183b3 | ||
|
|
85d9a1ca6e | ||
|
|
d4bf0799b8 | ||
|
|
4ea01bdc67 | ||
|
|
c7c87515f6 | ||
|
|
d4200ba6cf | ||
|
|
4ef7be20ab | ||
|
|
315b95b065 | ||
|
|
a54f0f7680 | ||
|
|
de58fb34c9 | ||
|
|
9cfd650697 | ||
|
|
7f3bdda29b | ||
|
|
d134c0ac05 | ||
|
|
1359f793ee | ||
|
|
750a74ed9c | ||
|
|
a4c1a43a5b | ||
|
|
d8ff075f12 | ||
|
|
7b5f232b03 | ||
|
|
bc214c8423 | ||
|
|
4b9db65f68 | ||
|
|
7899ac4c14 | ||
|
|
5941b30bb8 | ||
|
|
fb246bec14 | ||
|
|
a29016d70d | ||
|
|
6c6a58e930 | ||
|
|
d9058b61fb | ||
|
|
db8bf0a9e0 | ||
|
|
8fd8a1b128 | ||
|
|
9c7b607320 | ||
|
|
8782c61f26 | ||
|
|
2d01a89ad1 | ||
|
|
12fc8f66e7 | ||
|
|
8488c34fc6 | ||
|
|
74cf2eb83f | ||
|
|
216d6a024a | ||
|
|
73e43b6e19 | ||
|
|
4a469c7e98 | ||
|
|
c1962e900a | ||
|
|
acce991a37 | ||
|
|
0d022ddf03 | ||
|
|
41e4a77077 | ||
|
|
1e53e14bc3 | ||
|
|
5a7f9afb99 | ||
|
|
3c4dd73c02 | ||
|
|
e304468e57 | ||
|
|
9a2e5cfccb | ||
|
|
304141e8f8 | ||
|
|
34179ba809 | ||
|
|
1ed5a2a54d | ||
|
|
7940fb42ce | ||
|
|
62a2387a8d | ||
|
|
b2b9e2e87e | ||
|
|
8bee0fbd37 | ||
|
|
82e5752b0b | ||
|
|
15443f8af4 | ||
|
|
58af1e156e | ||
|
|
07a4185df1 | ||
|
|
229eb15f0e | ||
|
|
5018581410 | ||
|
|
950157942e | ||
|
|
8227a5ff45 | ||
|
|
14d231bd16 | ||
|
|
c8929dc17e | ||
|
|
a2e7b31fac | ||
|
|
90a5d7c2ad | ||
|
|
2e7247c558 | ||
|
|
1895bf7b94 | ||
|
|
ff3878adeb | ||
|
|
e68acd031d | ||
|
|
683c988493 | ||
|
|
9dddfbe755 | ||
|
|
e857dfa7cc | ||
|
|
3b7c8bb973 | ||
|
|
c6e7969f05 | ||
|
|
69ba81d183 | ||
|
|
9ad5381a2f | ||
|
|
aa405b7da2 | ||
|
|
c00816a38f | ||
|
|
bf6873a18e | ||
|
|
7c48479f62 | ||
|
|
233b66c3d2 | ||
|
|
1666cfcca0 | ||
|
|
59f497afac | ||
|
|
773f980e00 | ||
|
|
583093844e | ||
|
|
fd4b072991 | ||
|
|
5733f11ee9 | ||
|
|
2a0e4b88fd | ||
|
|
1616363850 | ||
|
|
662083fc4f | ||
|
|
6f0b232648 | ||
|
|
3f5c47af3b | ||
|
|
a1cee97de1 | ||
|
|
f20a2b4f3c | ||
|
|
5c8b02fdd6 | ||
|
|
ae95d06f68 | ||
|
|
2bceb4bedc | ||
|
|
b5cb999e7f | ||
|
|
b87e43d931 | ||
|
|
bf5f07cc8b | ||
|
|
3928b6b435 | ||
|
|
e08f69194c | ||
|
|
df5efa2fcd | ||
|
|
1fafcd2b28 | ||
|
|
f5afd0a827 | ||
|
|
2899137391 | ||
|
|
205556c191 | ||
|
|
e5b045e6b6 | ||
|
|
035ad0aed5 | ||
|
|
af500b8685 | ||
|
|
c4dc080245 | ||
|
|
95e1a415a5 | ||
|
|
2f5cb702ff | ||
|
|
a9e4321846 | ||
|
|
626705fb9d | ||
|
|
311922ddbe | ||
|
|
7bc112a142 | ||
|
|
f1d8395c77 | ||
|
|
6acfb79276 | ||
|
|
6559fe9126 | ||
|
|
0216630ea2 | ||
|
|
ef385e806f | ||
|
|
4dfbf07644 | ||
|
|
1086e4ec88 | ||
|
|
a49555a9e1 | ||
|
|
54cbee526a | ||
|
|
e74f89d95a | ||
|
|
901d022001 | ||
|
|
610e7d2c77 | ||
|
|
a89ac98f15 | ||
|
|
2576c57a51 | ||
|
|
d30ec2cd85 | ||
|
|
9439d65f0d | ||
|
|
ff0f6c26c2 | ||
|
|
5ed0602ec6 | ||
|
|
f445e9cb93 | ||
|
|
4000780b3d | ||
|
|
19c844594e | ||
|
|
d1feeed7f3 | ||
|
|
730fdc77a7 | ||
|
|
d27dc5c028 | ||
|
|
105132bd6b | ||
|
|
81b2f3e5d9 | ||
|
|
9d1c7f8b13 | ||
|
|
a7544411df | ||
|
|
f23164584e | ||
|
|
740f0f6165 | ||
|
|
e6dc9abdb7 | ||
|
|
70cba36fc9 | ||
|
|
d87c393a18 | ||
|
|
77f43e48ff | ||
|
|
5e7c5a82a5 | ||
|
|
ecd9c42f9e | ||
|
|
c7ceebc42c | ||
|
|
f3ea88bff7 | ||
|
|
33069575d5 | ||
|
|
c3944c4c4f | ||
|
|
9f2d03952d | ||
|
|
c3c76dbfb9 | ||
|
|
efdbc3688b | ||
|
|
d591e1c4f5 | ||
|
|
1aab7db6c8 | ||
|
|
c9abb0c0ac | ||
|
|
202a0697f3 | ||
|
|
f0d2efbadc | ||
|
|
efc52f1754 | ||
|
|
9c136f10cd | ||
|
|
a4f806aa79 | ||
|
|
2bbf2a91aa | ||
|
|
e97aed4ddb | ||
|
|
edddddcea8 | ||
|
|
4e794b7935 |
No files matched your search
@@ -1,6 +1,123 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2020, PHP 7.4.11
|
||||
26 Nov 2020, PHP 7.4.13
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80280 (ADD_EXTENSION_DEP() fails for ext/standard and ext/date).
|
||||
(cmb)
|
||||
. Fixed bug #80258 (Windows Deduplication Enabled, randon permission errors).
|
||||
(cmb)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #62474 (com_event_sink crashes on certain arguments). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #80268 (loadHTML() truncates at NUL bytes). (cmb)
|
||||
|
||||
- FFI:
|
||||
. Fixed bug #79177 (FFI doesn't handle well PHP exceptions within callback).
|
||||
(cmb, Dmitry, Nikita)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb)
|
||||
. Fixed bug #76618 (segfault on imap_reopen). (girgias)
|
||||
. Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb)
|
||||
. Fixed minor regression caused by fixing bug #80220. (cmb)
|
||||
. Fixed bug #80242 (imap_mail_compose() segfaults for multipart with rfc822).
|
||||
(cmb)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #79375 (mysqli_store_result does not report error from lock wait
|
||||
timeout). (Kamil Tekiela, Nikita)
|
||||
. Fixed bug #76525 (mysqli::commit does not throw if MYSQLI_REPORT_ERROR
|
||||
enabled and mysqlnd used). (Kamil Tekiela)
|
||||
. Fixed bug #72413 (mysqlnd segfault (fetch_row second parameter
|
||||
typemismatch)). (Kamil Tekiela)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #44618 (Fetching may rely on uninitialized data). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #79643 (PHP with Opcache crashes when a file with specific name
|
||||
is included). (twosee)
|
||||
. Fixed run-time binding of preloaded dynamically declared function. (Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #79983 (openssl_encrypt / openssl_decrypt fail with OCB mode).
|
||||
(Nikita)
|
||||
|
||||
- PDO MySQL:
|
||||
. Fixed bug #66528 (No PDOException or errorCode if database becomes
|
||||
unavailable before PDO::commit). (Nikita)
|
||||
. Fixed bug #65825 (PDOStatement::fetch() does not throw exception on broken
|
||||
server connection). (Nikita)
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #70461 (disable md5 code when it is not supported in net-snmp).
|
||||
(Alexander Bergmann, cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80266 (parse_url silently drops port number 0). (cmb, Nikita)
|
||||
|
||||
29 Oct 2020, PHP 7.4.12
|
||||
|
||||
- Core:
|
||||
. Fixed bug #80061 (Copying large files may have suboptimal performance).
|
||||
(cmb)
|
||||
. Fixed bug #79423 (copy command is limited to size of file it can copy).
|
||||
(cmb)
|
||||
. Fixed bug #80126 (Covariant return types failing compilation). (Nikita)
|
||||
. Fixed bug #80186 (Segfault when iterating over FFI object). (Nikita)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #80185 (jdtounix() fails after 2037). (cmb)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #80213 (imap_mail_compose() segfaults on certain $bodies). (cmb)
|
||||
. Fixed bug #80215 (imap_mail_compose() may modify by-val parameters). (cmb)
|
||||
. Fixed bug #80220 (imap_mail_compose() may leak memory). (cmb)
|
||||
. Fixed bug #80223 (imap_mail_compose() leaks envelope on malformed bodies).
|
||||
(cmb)
|
||||
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
|
||||
(cmb)
|
||||
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with
|
||||
slashes). (cmb)
|
||||
. Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
|
||||
compression is enabled). (Nikita)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
|
||||
. Fixed bug #80147 (BINARY strings may not be properly zero-terminated).
|
||||
(cmb)
|
||||
. Fixed bug #80150 (Failure to fetch error message). (cmb)
|
||||
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
|
||||
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
|
||||
|
||||
- OPcache:
|
||||
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
|
||||
binding). (Nikita)
|
||||
. Fixed bug #80194 (Assertion failure during block assembly of unreachable
|
||||
free with leading nop). (Nikita)
|
||||
|
||||
- PCRE:
|
||||
. Updated to PCRE 10.35. (cmb)
|
||||
. Fixed bug #80118 (Erroneous whitespace match with JIT only). (cmb)
|
||||
|
||||
- PDO_ODBC:
|
||||
. Fixed bug #67465 (NULL Pointer dereference in odbc_handle_preparer). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80114 (parse_url does not accept URLs with port 0). (cmb, twosee)
|
||||
. Fixed bug #76943 (Inconsistent stream_wrapper_restore() errors). (cmb)
|
||||
. Fixed bug #76735 (Incorrect message in fopen on invalid mode). (cmb)
|
||||
|
||||
- Tidy:
|
||||
. Fixed bug #77040 (tidyNode::isHtml() is completely broken). (cmb)
|
||||
|
||||
01 Oct 2020, PHP 7.4.11
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79979 (passing value to by-ref param via CUFA crashes). (cmb,
|
||||
@@ -10,6 +127,8 @@ PHP NEWS
|
||||
. 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).
|
||||
@@ -26,9 +145,17 @@ PHP NEWS
|
||||
. 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)
|
||||
many bind parameters). (Matteo)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
|
||||
@@ -80,10 +207,6 @@ PHP NEWS
|
||||
. Fixed bug #79724 (Return type does not match in ext/session/mod_mm.c).
|
||||
(Nikita)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
|
||||
"Transfer-Encoding: chunked"). (Matteo)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79930 (array_merge_recursive() crashes when called with array
|
||||
with single reference). (Nikita)
|
||||
|
||||
@@ -125,6 +125,11 @@ DOM:
|
||||
After: ReflectionMethod::getClosure($object = null)
|
||||
The new signature is also (LSP) compatible with older PHP versions.
|
||||
|
||||
- SAPI:
|
||||
. Starting with 7.4.11, incoming cookie names are not url-decoded. This was never
|
||||
required by the standard, outgoing cookie names aren't encoded and this leads
|
||||
to security issues (CVE-2020-7070).
|
||||
|
||||
- SPL:
|
||||
. Calling get_object_vars() on an ArrayObject instance will now always return
|
||||
the properties of the ArrayObject itself (or a subclass). Previously it
|
||||
|
||||
+4
-4
@@ -164,16 +164,16 @@ int main()
|
||||
double d = (double) LONG_MIN * LONG_MIN + 2e9;
|
||||
|
||||
if ((long) d == 2e9 && (long) -d == -2e9) {
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
} else if (sizeof(long) == 8) {
|
||||
double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
|
||||
|
||||
if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
]])], [
|
||||
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
|
||||
@@ -284,7 +284,7 @@ int main()
|
||||
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
|
||||
fclose(fp);
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
]])], [
|
||||
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Array addition should not add INDIRECT elements
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$x = 1;
|
||||
$ary = ['y' => 1];
|
||||
$ary += $GLOBALS;
|
||||
var_dump($ary['x']);
|
||||
$x = 2;
|
||||
var_dump($ary['x']);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Add $GLOBALS to itself
|
||||
--FILE--
|
||||
<?php
|
||||
$GLOBALS += $GLOBALS;
|
||||
$x = $GLOBALS + $GLOBALS;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #80126: Covariant return types failing compilation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface I {
|
||||
public function method(): I;
|
||||
}
|
||||
|
||||
abstract class A implements I {
|
||||
public function method(): I { }
|
||||
}
|
||||
|
||||
class C extends A { }
|
||||
|
||||
class C2 extends C {
|
||||
public function method(): C2 { }
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #80126: Covariant return types failing compilation (variation 2)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface I {
|
||||
public function method(): I;
|
||||
}
|
||||
|
||||
abstract class A implements I {
|
||||
public function method(): I {
|
||||
return new static();
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A { }
|
||||
|
||||
interface I2 { }
|
||||
|
||||
class C2 extends C implements I2 {
|
||||
public function method(): C2 { }
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #80194: Assertion failure during block assembly of unreachable free with leading nop
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($x) {
|
||||
switch ($x->y) {
|
||||
default:
|
||||
throw new Exception;
|
||||
case 'foobar':
|
||||
return new stdClass();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$x = (object)['y' => 'foobar'];
|
||||
var_dump(test($x));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#2 (0) {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Make sure type inference upholds invariants for dead arrays
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test() {
|
||||
foreach ($a as $v) {
|
||||
$b[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Warning: Invalid argument supplied for foreach() in %s on line %d
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Test property guard hash value assumption
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
function __get($var) {
|
||||
return $this->{$var.''};
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
var_dump($test->x);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: Test::$x in %s on line %d
|
||||
NULL
|
||||
+6
-1
@@ -1050,7 +1050,12 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
|
||||
return FAILURE;
|
||||
}
|
||||
function = (zend_function*)Z_PTR_P(zv);
|
||||
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
|
||||
if (UNEXPECTED(function->common.fn_flags & ZEND_ACC_PRELOADED)
|
||||
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
|
||||
zv = zend_hash_add(EG(function_table), Z_STR_P(lcname), zv);
|
||||
} else {
|
||||
zv = zend_hash_set_bucket_key(EG(function_table), (Bucket*)zv, Z_STR_P(lcname));
|
||||
}
|
||||
if (UNEXPECTED(!zv)) {
|
||||
do_bind_function_error(Z_STR_P(lcname), &function->op_array, 0);
|
||||
return FAILURE;
|
||||
|
||||
+17
-13
@@ -2124,7 +2124,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
{
|
||||
uint32_t idx;
|
||||
Bucket *p;
|
||||
zval *t;
|
||||
zval *t, *s;
|
||||
|
||||
IS_CONSISTENT(source);
|
||||
IS_CONSISTENT(target);
|
||||
@@ -2133,18 +2133,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
if (overwrite) {
|
||||
for (idx = 0; idx < source->nNumUsed; idx++) {
|
||||
p = source->arData + idx;
|
||||
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
|
||||
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
|
||||
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
|
||||
continue;
|
||||
s = &p->val;
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
|
||||
s = Z_INDIRECT_P(s);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
|
||||
continue;
|
||||
}
|
||||
if (p->key) {
|
||||
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_UPDATE | HASH_UPDATE_INDIRECT);
|
||||
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_UPDATE | HASH_UPDATE_INDIRECT);
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
} else {
|
||||
t = zend_hash_index_update(target, p->h, &p->val);
|
||||
t = zend_hash_index_update(target, p->h, s);
|
||||
if (pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
@@ -2153,18 +2155,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
|
||||
} else {
|
||||
for (idx = 0; idx < source->nNumUsed; idx++) {
|
||||
p = source->arData + idx;
|
||||
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
|
||||
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
|
||||
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
|
||||
continue;
|
||||
s = &p->val;
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
|
||||
s = Z_INDIRECT_P(s);
|
||||
}
|
||||
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
|
||||
continue;
|
||||
}
|
||||
if (p->key) {
|
||||
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_ADD | HASH_UPDATE_INDIRECT);
|
||||
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_ADD | HASH_UPDATE_INDIRECT);
|
||||
if (t && pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
} else {
|
||||
t = zend_hash_index_add(target, p->h, &p->val);
|
||||
t = zend_hash_index_add(target, p->h, s);
|
||||
if (t && pCopyConstructor) {
|
||||
pCopyConstructor(t);
|
||||
}
|
||||
|
||||
+10
-12
@@ -259,8 +259,6 @@ static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name
|
||||
|
||||
/* Instanceof that's safe to use on unlinked classes. */
|
||||
static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) {
|
||||
zend_class_entry *ce;
|
||||
|
||||
if (ce1 == ce2) {
|
||||
return 1;
|
||||
}
|
||||
@@ -269,18 +267,18 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
|
||||
return instanceof_function(ce1, ce2);
|
||||
}
|
||||
|
||||
ce = ce1;
|
||||
while (ce->parent) {
|
||||
if (ce->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
|
||||
ce = ce->parent;
|
||||
if (ce1->parent) {
|
||||
zend_class_entry *parent_ce;
|
||||
if (ce1->ce_flags & ZEND_ACC_RESOLVED_PARENT) {
|
||||
parent_ce = ce1->parent;
|
||||
} else {
|
||||
ce = zend_lookup_class_ex(ce->parent_name, NULL,
|
||||
parent_ce = zend_lookup_class_ex(ce1->parent_name, NULL,
|
||||
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
|
||||
if (!ce) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ce == ce2) {
|
||||
|
||||
/* It's not sufficient to only check the parent chain itself, as need to do a full
|
||||
* recursive instanceof in case the parent interfaces haven't been copied yet. */
|
||||
if (parent_ce && unlinked_instanceof(parent_ce, ce2)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -297,7 +295,7 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < ce1->num_interfaces; i++) {
|
||||
ce = zend_lookup_class_ex(
|
||||
zend_class_entry *ce = zend_lookup_class_ex(
|
||||
ce1->interface_names[i].name, ce1->interface_names[i].lc_name,
|
||||
ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
|
||||
if (ce && unlinked_instanceof(ce, ce2)) {
|
||||
|
||||
@@ -619,8 +619,8 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
|
||||
if (EXPECTED(Z_TYPE_P(zv) == IS_STRING)) {
|
||||
zend_string *str = Z_STR_P(zv);
|
||||
if (EXPECTED(str == member) ||
|
||||
/* hash values are always pred-calculated here */
|
||||
(EXPECTED(ZSTR_H(str) == ZSTR_H(member)) &&
|
||||
/* "str" always has a pre-calculated hash value here */
|
||||
(EXPECTED(ZSTR_H(str) == zend_string_hash_val(member)) &&
|
||||
EXPECTED(zend_string_equal_content(str, member)))) {
|
||||
return &Z_PROPERTY_GUARD_P(zv);
|
||||
} else if (EXPECTED(Z_PROPERTY_GUARD_P(zv) == 0)) {
|
||||
|
||||
@@ -934,7 +934,7 @@ ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op) /* {{{ */
|
||||
|
||||
static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zval *op1, zval *op2) /* {{{ */
|
||||
{
|
||||
if ((result == op1) && (result == op2)) {
|
||||
if (result == op1 && Z_ARR_P(op1) == Z_ARR_P(op2)) {
|
||||
/* $a += $a */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -498,6 +498,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||
ALLOCA_FLAG(use_heap_large)
|
||||
wchar_t *pathw = NULL;
|
||||
int may_retry_reparse_point;
|
||||
#define FREE_PATHW() \
|
||||
do { free(pathw); } while(0);
|
||||
|
||||
@@ -597,6 +598,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
retry_reparse_point:
|
||||
may_retry_reparse_point = 0;
|
||||
if (save) {
|
||||
pathw = php_win32_ioutil_any_to_w(path);
|
||||
if (!pathw) {
|
||||
@@ -691,6 +693,7 @@ retry_reparse_tag_cloud:
|
||||
CloseHandle(hLink);
|
||||
|
||||
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
|
||||
may_retry_reparse_point = 1;
|
||||
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
|
||||
isabsolute = pbuffer->SymbolicLinkReparseBuffer.Flags == 0;
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
@@ -827,7 +830,7 @@ retry_reparse_tag_cloud:
|
||||
free_alloca(pbuffer, use_heap_large);
|
||||
free(substitutename);
|
||||
|
||||
{
|
||||
if (may_retry_reparse_point) {
|
||||
DWORD attrs;
|
||||
|
||||
FREE_PATHW()
|
||||
|
||||
+24
-7
@@ -6317,11 +6317,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (OP1_TYPE != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
HashTable *properties;
|
||||
if (Z_OBJ_P(array_ptr)->properties
|
||||
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
|
||||
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
@@ -6329,8 +6325,21 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (OP1_TYPE != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(result) = (uint32_t) -1;
|
||||
FREE_OP1_IF_VAR();
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
|
||||
FREE_OP1_IF_VAR();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -6397,6 +6406,7 @@ ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
HashTable *properties;
|
||||
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
|
||||
if (array_ptr == array_ref) {
|
||||
ZVAL_NEW_REF(array_ref, array_ref);
|
||||
@@ -6415,8 +6425,15 @@ ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
|
||||
FREE_OP1_VAR_PTR();
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
|
||||
FREE_OP1_VAR_PTR();
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
|
||||
+102
-28
@@ -4140,11 +4140,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_CONST != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
HashTable *properties;
|
||||
if (Z_OBJ_P(array_ptr)->properties
|
||||
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
|
||||
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
@@ -4152,7 +4148,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_CONST != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(result) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -4218,6 +4228,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
HashTable *properties;
|
||||
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
|
||||
if (array_ptr == array_ref) {
|
||||
ZVAL_NEW_REF(array_ref, array_ref);
|
||||
@@ -4236,7 +4247,15 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -18192,11 +18211,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_TMP_VAR != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
HashTable *properties;
|
||||
if (Z_OBJ_P(array_ptr)->properties
|
||||
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
|
||||
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
@@ -18204,7 +18219,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_TMP_VAR != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(result) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -18271,6 +18300,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
HashTable *properties;
|
||||
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
|
||||
if (array_ptr == array_ref) {
|
||||
ZVAL_NEW_REF(array_ref, array_ref);
|
||||
@@ -18289,7 +18319,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -21282,11 +21320,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_VAR != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
HashTable *properties;
|
||||
if (Z_OBJ_P(array_ptr)->properties
|
||||
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
|
||||
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
@@ -21294,8 +21328,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_VAR != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(result) = (uint32_t) -1;
|
||||
zval_ptr_dtor_nogc(free_op1);
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
|
||||
zval_ptr_dtor_nogc(free_op1);
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -21362,6 +21409,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
HashTable *properties;
|
||||
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
|
||||
if (array_ptr == array_ref) {
|
||||
ZVAL_NEW_REF(array_ref, array_ref);
|
||||
@@ -21380,8 +21428,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
|
||||
if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
|
||||
if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -37792,11 +37847,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_CV != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
HashTable *properties;
|
||||
if (Z_OBJ_P(array_ptr)->properties
|
||||
&& UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
|
||||
if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
|
||||
@@ -37804,7 +37855,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
result = EX_VAR(opline->result.var);
|
||||
ZVAL_COPY_VALUE(result, array_ptr);
|
||||
if (IS_CV != IS_TMP_VAR) {
|
||||
Z_ADDREF_P(array_ptr);
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(result) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(result) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
@@ -37870,6 +37935,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
|
||||
if (!Z_OBJCE_P(array_ptr)->get_iterator) {
|
||||
HashTable *properties;
|
||||
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
|
||||
if (array_ptr == array_ref) {
|
||||
ZVAL_NEW_REF(array_ref, array_ref);
|
||||
@@ -37888,7 +37954,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
|
||||
}
|
||||
Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
|
||||
}
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
|
||||
|
||||
properties = Z_OBJPROP_P(array_ptr);
|
||||
if (zend_hash_num_elements(properties) == 0) {
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t) -1;
|
||||
|
||||
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
|
||||
}
|
||||
|
||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
|
||||
|
||||
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,14 @@ trigger:
|
||||
- UPGRADING
|
||||
- UPGRADING.INTERNALS
|
||||
|
||||
schedules:
|
||||
- cron: "0 1 * * *"
|
||||
displayName: Nightly build
|
||||
branches:
|
||||
include:
|
||||
- PHP-7.4
|
||||
- master
|
||||
|
||||
jobs:
|
||||
- template: azure/job.yml
|
||||
parameters:
|
||||
|
||||
+10
-1
@@ -59,7 +59,7 @@ jobs:
|
||||
php vendor/bin/phpunit
|
||||
displayName: 'Test Laravel'
|
||||
- script: |
|
||||
git clone https://github.com/symfony/symfony.git --branch=master --depth=1
|
||||
git clone https://github.com/symfony/symfony.git --depth=1
|
||||
cd symfony
|
||||
php7.3 /usr/bin/composer install --no-progress
|
||||
php7.3 ./phpunit install
|
||||
@@ -81,3 +81,12 @@ jobs:
|
||||
php vendor/bin/phpunit
|
||||
displayName: 'Test Amphp'
|
||||
condition: or(succeeded(), failed())
|
||||
- script: |
|
||||
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
|
||||
cd symfony_demo
|
||||
export USE_ZEND_ALLOC=0
|
||||
export USE_TRACKED_ALLOC=1
|
||||
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
|
||||
php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php
|
||||
displayName: 'Symfony Preloading'
|
||||
condition: or(succeeded(), failed())
|
||||
Vendored
+1
-5
@@ -978,10 +978,6 @@ else
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" void exit (int);
|
||||
#endif
|
||||
|
||||
void fnord() { int i=42;}
|
||||
int main ()
|
||||
{
|
||||
@@ -997,7 +993,7 @@ int main ()
|
||||
else
|
||||
puts (dlerror ());
|
||||
|
||||
exit (status);
|
||||
return (status);
|
||||
}]
|
||||
EOF
|
||||
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
|
||||
|
||||
+15
-13
@@ -1176,14 +1176,14 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
$1
|
||||
main() {
|
||||
int main() {
|
||||
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
|
||||
|
||||
if (fd < 0) exit(1);
|
||||
if (pwrite(fd, "text", 4, 0) != 4) exit(1);
|
||||
if (fd < 0) return 1;
|
||||
if (pwrite(fd, "text", 4, 0) != 4) return 1;
|
||||
/* Linux glibc breakage until 2.2.5 */
|
||||
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
|
||||
exit(0);
|
||||
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
]])],[
|
||||
@@ -1209,14 +1209,14 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
$1
|
||||
main() {
|
||||
int main() {
|
||||
char buf[3];
|
||||
int fd = open("conftest_in", O_RDONLY);
|
||||
if (fd < 0) exit(1);
|
||||
if (pread(fd, buf, 2, 0) != 2) exit(1);
|
||||
if (fd < 0) return 1;
|
||||
if (pread(fd, buf, 2, 0) != 2) return 1;
|
||||
/* Linux glibc breakage until 2.2.5 */
|
||||
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
|
||||
exit(0);
|
||||
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1;
|
||||
return 0;
|
||||
}
|
||||
]])],[
|
||||
ac_cv_pread=yes
|
||||
@@ -1478,13 +1478,13 @@ int seeker(void *cookie, off64_t *position, int whence)
|
||||
|
||||
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
|
||||
|
||||
main() {
|
||||
int main() {
|
||||
struct cookiedata g = { 0 };
|
||||
FILE *fp = fopencookie(&g, "r", funcs);
|
||||
|
||||
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
|
||||
exit(0);
|
||||
exit(1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
]])], [
|
||||
@@ -1907,6 +1907,8 @@ AC_DEFUN([PHP_SETUP_ICU],[
|
||||
if test "$PKG_CONFIG icu-io --atleast-version=60"; then
|
||||
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
|
||||
fi
|
||||
|
||||
ICU_CFLAGS="$ICU_CFLAGS -DU_DEFINE_FALSE_AND_TRUE=1"
|
||||
])
|
||||
|
||||
dnl
|
||||
|
||||
+7
-6
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[7.4.11-dev],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[7.4.13],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
@@ -662,6 +662,7 @@ dnl getaddrinfo.
|
||||
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
|
||||
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef AF_INET
|
||||
@@ -674,11 +675,11 @@ int main(void) {
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ai == 0) {
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pai = ai;
|
||||
@@ -686,16 +687,16 @@ int main(void) {
|
||||
while (pai) {
|
||||
if (pai->ai_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
if (pai->ai_addr->sa_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
pai = pai->ai_next;
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [ac_cv_func_getaddrinfo=no])],
|
||||
[ac_cv_func_getaddrinfo=no])])
|
||||
|
||||
@@ -83,12 +83,12 @@ bool(false)
|
||||
resource(%d) of type (stream)
|
||||
resource(%d) of type (stream)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "sdncal.h"
|
||||
#include <time.h>
|
||||
|
||||
#define SECS_PER_DAY (24 * 3600)
|
||||
|
||||
/* {{{ proto int unixtojd([int timestamp])
|
||||
Convert UNIX timestamp to Julian Day */
|
||||
PHP_FUNCTION(unixtojd)
|
||||
@@ -62,10 +64,10 @@ PHP_FUNCTION(jdtounix)
|
||||
}
|
||||
uday -= 2440588 /* J.D. of 1.1.1970 */;
|
||||
|
||||
if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */
|
||||
if (uday < 0 || uday > ZEND_LONG_MAX / SECS_PER_DAY) { /* before beginning of unix epoch or greater than representable */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_LONG(uday * 24 * 3600);
|
||||
RETURN_LONG(uday * SECS_PER_DAY);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80185 (jdtounix() fails after 2037)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
if (PHP_INT_SIZE != 8) die("skip for 64bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(jdtounix(2465712));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2170713600)
|
||||
int(9223372036854720000)
|
||||
bool(false)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80185 (jdtounix() fails after 2037)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
if (PHP_INT_SIZE != 4) die("skip for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(jdtounix(2465712));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
|
||||
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(2147472000)
|
||||
bool(false)
|
||||
@@ -311,18 +311,20 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
|
||||
|
||||
if (obj) {
|
||||
if (dispname == NULL && sink) {
|
||||
IProvideClassInfo2 *pci2;
|
||||
IProvideClassInfo *pci;
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
IProvideClassInfo2 *pci2;
|
||||
IProvideClassInfo *pci;
|
||||
|
||||
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
|
||||
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
|
||||
IProvideClassInfo2_Release(pci2);
|
||||
}
|
||||
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
|
||||
/* examine the available interfaces */
|
||||
/* TODO: write some code here */
|
||||
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
|
||||
IProvideClassInfo_Release(pci);
|
||||
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
|
||||
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
|
||||
IProvideClassInfo2_Release(pci2);
|
||||
}
|
||||
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
|
||||
/* examine the available interfaces */
|
||||
/* TODO: write some code here */
|
||||
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
|
||||
IProvideClassInfo_Release(pci);
|
||||
}
|
||||
}
|
||||
} else if (dispname == NULL) {
|
||||
if (obj->typeinfo) {
|
||||
@@ -339,15 +341,17 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
|
||||
/* get the library from the object; the rest will be dealt with later */
|
||||
ITypeInfo_GetContainingTypeLib(obj->typeinfo, &typelib, &idx);
|
||||
} else if (typelibname == NULL) {
|
||||
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
|
||||
if (dispname) {
|
||||
unsigned int idx;
|
||||
/* get the library from the object; the rest will be dealt with later */
|
||||
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
|
||||
if (dispname) {
|
||||
unsigned int idx;
|
||||
/* get the library from the object; the rest will be dealt with later */
|
||||
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
|
||||
|
||||
if (typelib) {
|
||||
ITypeInfo_Release(typeinfo);
|
||||
typeinfo = NULL;
|
||||
if (typelib) {
|
||||
ITypeInfo_Release(typeinfo);
|
||||
typeinfo = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #62474 (com_event_sink crashes on certain arguments)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(com_event_sink(new variant, function() {}, array()));
|
||||
var_dump(com_event_sink(new variant, new variant, 'a'));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -7,7 +7,7 @@ TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = uniqid()."://www.".uniqid().".".uniqid();
|
||||
$url = substr(uniqid(),0,7)."://www.".uniqid().".".uniqid();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
@@ -18,6 +18,6 @@ curl_close($ch);
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)"
|
||||
int\(\d\)
|
||||
--EXPECTF--
|
||||
string(%d) "%Srotocol%s"
|
||||
int(1)
|
||||
@@ -1,6 +1,7 @@
|
||||
// vim:ft=javascript
|
||||
|
||||
EXTENSION("date", "php_date.c", false, "/Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_TIMELIB_CONFIG_H=1");
|
||||
PHP_DATE = "yes";
|
||||
ADD_SOURCES("ext/date/lib", "astro.c timelib.c dow.c parse_date.c parse_tz.c tm2unixtime.c unixtime2tm.c parse_iso_intervals.c interval.c", "date");
|
||||
|
||||
ADD_FLAG('CFLAGS_DATE', "/wd4244");
|
||||
|
||||
+795
-923
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,7 @@ Bug #48097 (date_timezone_set function produces wrong datetime result)
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$d = date_create( "Mon, 23 May 1955 00:00:00 +0200" );
|
||||
$d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
|
||||
var_dump( $d );
|
||||
echo $d->format( DATE_ISO8601 ), "\n";
|
||||
echo $d->format( 'U' ), "\n\n";
|
||||
@@ -16,23 +16,23 @@ echo $d->format( 'U' ), "\n\n";
|
||||
--EXPECT--
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(26) "1955-05-23 00:00:00.000000"
|
||||
string(26) "1955-05-22 02:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(1)
|
||||
["timezone"]=>
|
||||
string(6) "+02:00"
|
||||
}
|
||||
1955-05-23T00:00:00+0200
|
||||
-461124000
|
||||
1955-05-22T02:00:00+0200
|
||||
-461203200
|
||||
|
||||
object(DateTime)#1 (3) {
|
||||
["date"]=>
|
||||
string(26) "1955-05-22 23:00:00.000000"
|
||||
string(26) "1955-05-22 01:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(15) "Europe/Budapest"
|
||||
}
|
||||
1955-05-22T23:00:00+0100
|
||||
1955-05-22T01:00:00+0100
|
||||
|
||||
-461124000
|
||||
-461203200
|
||||
@@ -2050,7 +2050,6 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
}
|
||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||
} else {
|
||||
source_len = xmlStrlen((xmlChar *) source);
|
||||
if (ZEND_SIZE_T_INT_OVFL(source_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "Input string is too long");
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #80268 (loadHTML() truncates at NUL bytes)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DOMDocument;
|
||||
$doc->loadHTML("<p>foo\0bar</p>");
|
||||
$html = $doc->saveHTML();
|
||||
var_dump(strpos($html, '<p>foo</p>') !== false);
|
||||
|
||||
file_put_contents(__DIR__ . '/80268.html', "<p>foo\0bar</p>");
|
||||
$doc = new DOMDocument;
|
||||
$doc->loadHTMLFile(__DIR__ . '/80268.html');
|
||||
$html = $doc->saveHTML();
|
||||
var_dump(strpos($html, '<p>foo</p>') !== false);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/80268.html');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
+15
-9
@@ -886,6 +886,10 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
|
||||
}
|
||||
free_alloca(fci.params, use_heap);
|
||||
|
||||
if (EG(exception)) {
|
||||
zend_error(E_ERROR, "Throwing from FFI callbacks is not allowed");
|
||||
}
|
||||
|
||||
ret_type = ZEND_FFI_TYPE(callback_data->type->func.ret_type);
|
||||
if (ret_type->kind != ZEND_FFI_TYPE_VOID) {
|
||||
zend_ffi_zval_to_cdata(ret, ret_type, &retval);
|
||||
@@ -7427,11 +7431,11 @@ void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len)
|
||||
val->ch = '\t';
|
||||
} else if (str[2] == 'v' && str_len == 4) {
|
||||
val->ch = '\v';
|
||||
} else if (str[2] >= '0' || str[2] <= '7') {
|
||||
} else if (str[2] >= '0' && str[2] <= '7') {
|
||||
n = str[2] - '0';
|
||||
if (str[3] >= '0' || str[3] <= '7') {
|
||||
if (str[3] >= '0' && str[3] <= '7') {
|
||||
n = n * 8 + (str[3] - '0');
|
||||
if ((str[4] >= '0' || str[4] <= '7') && str_len == 6) {
|
||||
if ((str[4] >= '0' && str[4] <= '7') && str_len == 6) {
|
||||
n = n * 8 + (str[4] - '0');
|
||||
} else if (str_len != 5) {
|
||||
val->kind = ZEND_FFI_VAL_ERROR;
|
||||
@@ -7445,23 +7449,25 @@ void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len)
|
||||
val->kind = ZEND_FFI_VAL_ERROR;
|
||||
}
|
||||
} else if (str[2] == 'x') {
|
||||
if (str[3] >= '0' || str[3] <= '7') {
|
||||
if (str[3] >= '0' && str[3] <= '9') {
|
||||
n = str[3] - '0';
|
||||
} else if (str[3] >= 'A' || str[3] <= 'F') {
|
||||
} else if (str[3] >= 'A' && str[3] <= 'F') {
|
||||
n = str[3] - 'A';
|
||||
} else if (str[3] >= 'a' || str[3] <= 'f') {
|
||||
} else if (str[3] >= 'a' && str[3] <= 'f') {
|
||||
n = str[3] - 'a';
|
||||
} else {
|
||||
val->kind = ZEND_FFI_VAL_ERROR;
|
||||
return;
|
||||
}
|
||||
if ((str[4] >= '0' || str[4] <= '7') && str_len == 6) {
|
||||
if ((str[4] >= '0' && str[4] <= '9') && str_len == 6) {
|
||||
n = n * 16 + (str[4] - '0');
|
||||
} else if ((str[4] >= 'A' || str[4] <= 'F') && str_len == 6) {
|
||||
} else if ((str[4] >= 'A' && str[4] <= 'F') && str_len == 6) {
|
||||
n = n * 16 + (str[4] - 'A');
|
||||
} else if ((str[4] >= 'a' || str[4] <= 'f') && str_len == 6) {
|
||||
} else if ((str[4] >= 'a' && str[4] <= 'f') && str_len == 6) {
|
||||
n = n * 16 + (str[4] - 'a');
|
||||
} else if (str_len != 5) {
|
||||
val->kind = ZEND_FFI_VAL_ERROR;
|
||||
return;
|
||||
}
|
||||
val->ch = n;
|
||||
} else if (str_len == 4) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
Bug #79177 (FFI doesn't handle well PHP exceptions within callback)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('ffi')) die('skip ffi extension not available');
|
||||
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/utils.inc';
|
||||
$header = <<<HEADER
|
||||
extern int *(*bug79177_cb)(void);
|
||||
void bug79177(void);
|
||||
HEADER;
|
||||
|
||||
if (PHP_OS_FAMILY !== 'Windows') {
|
||||
$ffi = FFI::cdef($header);
|
||||
} else {
|
||||
try {
|
||||
$ffi = FFI::cdef($header, 'php_zend_test.dll');
|
||||
} catch (FFI\Exception $ex) {
|
||||
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
|
||||
}
|
||||
}
|
||||
|
||||
$ffi->bug79177_cb = function() {
|
||||
throw new \RuntimeException('Not allowed');
|
||||
};
|
||||
try {
|
||||
$ffi->bug79177(); // this is supposed to raise a fatal error
|
||||
} catch (\Throwable $exception) {}
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Uncaught RuntimeException: Not allowed in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): {closure}()
|
||||
#1 %s(%d): FFI->bug79177()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
||||
Fatal error: Throwing from FFI callbacks is not allowed in %s on line %d
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #80186 (Segfault when iterating over FFI object)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('ffi')) die('skip ffi extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ffi = FFI::cdef('typedef int dummy;');
|
||||
foreach ($ffi as $_) { }
|
||||
foreach ($ffi as &$_) { }
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -218,6 +218,7 @@ PHP_MINIT_FUNCTION(finfo)
|
||||
memcpy(&finfo_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
|
||||
finfo_object_handlers.offset = XtOffsetOf(finfo_object, zo);
|
||||
finfo_object_handlers.free_obj = finfo_objects_free;
|
||||
finfo_object_handlers.clone_obj = NULL;
|
||||
|
||||
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Cloning and serializing finfo is not supported
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$finfo = new finfo;
|
||||
var_dump($finfo->buffer("Test string"));
|
||||
try {
|
||||
$finfo2 = clone $finfo;
|
||||
var_dump($finfo2->buffer("Test string"));
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$finfo3 = unserialize(serialize($finfo));
|
||||
var_dump($finfo3->buffer("Test string"));
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
Trying to clone an uncloneable object of class finfo
|
||||
|
||||
Warning: finfo::buffer(): The invalid fileinfo object. in %s on line %d
|
||||
bool(false)
|
||||
+2
-2
@@ -1136,7 +1136,7 @@ ZEND_FUNCTION(gmp_export)
|
||||
FETCH_GMP_ZVAL(gmpnumber, gmpnumber_arg, temp_a);
|
||||
|
||||
if (mpz_sgn(gmpnumber) == 0) {
|
||||
RETURN_EMPTY_STRING();
|
||||
RETVAL_EMPTY_STRING();
|
||||
} else {
|
||||
size_t bits_per_word = size * 8;
|
||||
size_t count = (mpz_sizeinbase(gmpnumber, 2) + bits_per_word - 1) / bits_per_word;
|
||||
@@ -1145,7 +1145,7 @@ ZEND_FUNCTION(gmp_export)
|
||||
mpz_export(ZSTR_VAL(out_string), NULL, order, size, endian, 0, gmpnumber);
|
||||
ZSTR_VAL(out_string)[ZSTR_LEN(out_string)] = '\0';
|
||||
|
||||
RETURN_NEW_STR(out_string);
|
||||
RETVAL_NEW_STR(out_string);
|
||||
}
|
||||
|
||||
FREE_GMP_TEMP(temp_a);
|
||||
|
||||
@@ -50,6 +50,9 @@ foreach ($export as $k => $test) {
|
||||
|
||||
var_dump($passed);
|
||||
|
||||
// Argument converted from int to GMP
|
||||
var_dump(bin2hex(gmp_export(0xff)));
|
||||
|
||||
// Invalid arguments (zpp failure)
|
||||
var_dump(gmp_export());
|
||||
|
||||
@@ -62,6 +65,7 @@ var_dump(gmp_export(123, 1, GMP_MSW_FIRST | GMP_LSW_FIRST));
|
||||
var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
string(2) "ff"
|
||||
|
||||
Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ int main() {
|
||||
|
||||
int main() {
|
||||
iconv_t cd;
|
||||
cd = iconv_open( "*blahblah*", "*blahblah*" );
|
||||
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
|
||||
if (cd == (iconv_t)(-1)) {
|
||||
if (errno == EINVAL) {
|
||||
return 0;
|
||||
|
||||
+76
-34
@@ -1257,7 +1257,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_IGNORE_LEAKS_BEGIN();
|
||||
imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags);
|
||||
ZEND_IGNORE_LEAKS_END();
|
||||
|
||||
if (imap_stream == NIL) {
|
||||
php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox));
|
||||
@@ -1321,7 +1323,7 @@ PHP_FUNCTION(imap_reopen)
|
||||
|
||||
imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, ZSTR_VAL(mailbox), flags);
|
||||
if (imap_le_struct->imap_stream == NIL) {
|
||||
zend_list_delete(Z_RES_P(streamind));
|
||||
zend_list_close(Z_RES_P(streamind));
|
||||
php_error_docref(NULL, E_WARNING, "Couldn't re-open stream");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2227,7 +2229,9 @@ PHP_FUNCTION(imap_lsub)
|
||||
IMAPG(folderlist_style) = FLIST_ARRAY;
|
||||
|
||||
IMAPG(imap_sfolders) = NIL;
|
||||
ZEND_IGNORE_LEAKS_BEGIN();
|
||||
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
|
||||
ZEND_IGNORE_LEAKS_END();
|
||||
if (IMAPG(imap_sfolders) == NIL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2266,7 +2270,9 @@ PHP_FUNCTION(imap_lsub_full)
|
||||
IMAPG(folderlist_style) = FLIST_OBJECT;
|
||||
|
||||
IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL;
|
||||
ZEND_IGNORE_LEAKS_BEGIN();
|
||||
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
|
||||
ZEND_IGNORE_LEAKS_END();
|
||||
if (IMAPG(imap_sfolder_objects) == NIL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2704,8 +2710,9 @@ PHP_FUNCTION(imap_rfc822_write_address)
|
||||
if (string) {
|
||||
RETVAL_STR(string);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
mail_free_address(&addr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3086,7 +3093,8 @@ static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
if (out == NIL) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRING((char *)out);
|
||||
RETVAL_STRING((char *)out);
|
||||
fs_give((void**) &out);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3192,6 +3200,9 @@ PHP_FUNCTION(imap_sort)
|
||||
} else {
|
||||
spg = mail_newsearchpgm();
|
||||
}
|
||||
if (spg == NIL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
mypgm = mail_newsortpgm();
|
||||
mypgm->reverse = rev;
|
||||
@@ -3200,6 +3211,7 @@ PHP_FUNCTION(imap_sort)
|
||||
|
||||
slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL));
|
||||
|
||||
mail_free_sortpgm(&mypgm);
|
||||
if (spg && !(flags & SE_FREE)) {
|
||||
mail_free_searchpgm(&spg);
|
||||
}
|
||||
@@ -3555,7 +3567,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
int toppart = 0;
|
||||
int first;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &envelope, &body) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/a/", &envelope, &body) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3613,6 +3625,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "custom_headers", sizeof("custom_headers") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
custom_headers_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
|
||||
custom_headers_param = mail_newbody_parameter();
|
||||
convert_to_string_ex(env_data);
|
||||
@@ -3632,17 +3645,25 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
|
||||
if (Z_TYPE_P(data) != IS_ARRAY) {
|
||||
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto done;
|
||||
}
|
||||
SEPARATE_ARRAY(data);
|
||||
|
||||
bod = mail_newbody();
|
||||
topbod = bod;
|
||||
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
|
||||
bod->type = (short) zval_get_long(pvalue);
|
||||
zend_long type = zval_get_long(pvalue);
|
||||
if (type >= 0 && type <= TYPEMAX && body_types[type] != NULL) {
|
||||
bod->type = (short) type;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
|
||||
bod->encoding = (short) zval_get_long(pvalue);
|
||||
zend_long encoding = zval_get_long(pvalue);
|
||||
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
|
||||
bod->encoding = (short) encoding;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
@@ -3655,7 +3676,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
|
||||
if(Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3687,7 +3710,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3699,15 +3724,19 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
bod->disposition.parameter = disp_param;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
bod->contents.text.size = Z_STRLEN_P(pvalue);
|
||||
if (bod->type == TYPEMESSAGE && bod->subtype && !strcmp(bod->subtype, "RFC822")) {
|
||||
bod->nested.msg = mail_newmsg();
|
||||
} else {
|
||||
bod->contents.text.data = fs_get(1);
|
||||
memcpy(bod->contents.text.data, "", 1);
|
||||
bod->contents.text.size = 0;
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
|
||||
bod->contents.text.size = Z_STRLEN_P(pvalue);
|
||||
} else {
|
||||
bod->contents.text.data = fs_get(1);
|
||||
memcpy(bod->contents.text.data, "", 1);
|
||||
bod->contents.text.size = 0;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
|
||||
bod->size.lines = zval_get_long(pvalue);
|
||||
@@ -3719,10 +3748,14 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
|
||||
}
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
short type = -1;
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
|
||||
short type = 0;
|
||||
SEPARATE_ARRAY(data);
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) {
|
||||
type = (short) zval_get_long(pvalue);
|
||||
zend_long tmp_type = zval_get_long(pvalue);
|
||||
if (tmp_type >= 0 && tmp_type <= TYPEMAX && tmp_type != TYPEMULTIPART && body_types[tmp_type] != NULL) {
|
||||
type = (short) tmp_type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!toppart) {
|
||||
@@ -3735,13 +3768,13 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
}
|
||||
|
||||
bod = &mypart->body;
|
||||
|
||||
if (type != TYPEMULTIPART) {
|
||||
bod->type = type;
|
||||
}
|
||||
bod->type = type;
|
||||
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) {
|
||||
bod->encoding = (short) zval_get_long(pvalue);
|
||||
zend_long encoding = zval_get_long(pvalue);
|
||||
if (encoding >= 0 && encoding <= ENCMAX && body_encodings[encoding] != NULL) {
|
||||
bod->encoding = (short) encoding;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
@@ -3755,7 +3788,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type.parameters", sizeof("type.parameters") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3787,7 +3822,9 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) {
|
||||
if (Z_TYPE_P(pvalue) == IS_ARRAY) {
|
||||
disp_param = tmp_param = NULL;
|
||||
SEPARATE_ARRAY(pvalue);
|
||||
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
|
||||
if (key == NULL) continue;
|
||||
disp_param = mail_newbody_parameter();
|
||||
disp_param->attribute = cpystr(ZSTR_VAL(key));
|
||||
convert_to_string_ex(disp_data);
|
||||
@@ -3799,15 +3836,19 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
bod->disposition.parameter = disp_param;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
|
||||
bod->contents.text.size = Z_STRLEN_P(pvalue);
|
||||
if (bod->type == TYPEMESSAGE && bod->subtype && !strcmp(bod->subtype, "RFC822")) {
|
||||
bod->nested.msg = mail_newmsg();
|
||||
} else {
|
||||
bod->contents.text.data = fs_get(1);
|
||||
memcpy(bod->contents.text.data, "", 1);
|
||||
bod->contents.text.size = 0;
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) {
|
||||
convert_to_string_ex(pvalue);
|
||||
bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1);
|
||||
memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
|
||||
bod->contents.text.size = Z_STRLEN_P(pvalue);
|
||||
} else {
|
||||
bod->contents.text.data = fs_get(1);
|
||||
memcpy(bod->contents.text.data, "", 1);
|
||||
bod->contents.text.size = 0;
|
||||
}
|
||||
}
|
||||
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) {
|
||||
bod->size.lines = zval_get_long(pvalue);
|
||||
@@ -3824,7 +3865,8 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
|
||||
if (first) {
|
||||
php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array");
|
||||
RETURN_FALSE;
|
||||
RETVAL_FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) {
|
||||
@@ -3907,7 +3949,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
|
||||
bod=&part->body;
|
||||
|
||||
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data, CRLF);
|
||||
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data ? (char *) bod->contents.text.data : "", CRLF);
|
||||
efree(mystring);
|
||||
mystring=tempstring;
|
||||
} while ((part = part->next)); /* until done */
|
||||
@@ -3917,7 +3959,7 @@ PHP_FUNCTION(imap_mail_compose)
|
||||
efree(mystring);
|
||||
mystring=tempstring;
|
||||
} else if (bod) {
|
||||
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data, CRLF);
|
||||
spprintf(&tempstring, 0, "%s%s%s", mystring, bod->contents.text.data ? (char *) bod->contents.text.data : "", CRLF);
|
||||
efree(mystring);
|
||||
mystring=tempstring;
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #64076 (imap_sort() does not return FALSE on failure)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once __DIR__ . '/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/imap_include.inc';
|
||||
$stream = setup_test_mailbox('', 2);
|
||||
imap_errors(); // clear error stack
|
||||
var_dump(imap_sort($stream, SORTFROM, 0, 0, 'UNSUPPORTED SEARCH CRITERIUM'));
|
||||
var_dump(imap_errors() !== false);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once __DIR__ . '/clean.inc';
|
||||
?>
|
||||
--EXPECT--
|
||||
Create a temporary mailbox and add 2 msgs
|
||||
.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created
|
||||
bool(false)
|
||||
bool(true)
|
||||
@@ -11,5 +11,5 @@ imap_mail('1', 1, NULL);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imap_mail(): No message string in mail command in %s on line %d
|
||||
%s
|
||||
%A
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #80213 (imap_mail_compose() segfaults on certain $bodies)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope = [];
|
||||
$body = [[
|
||||
'type.parameters' => ['param'],
|
||||
'disposition' => ['disp'],
|
||||
], [
|
||||
'type.parameters' => ['param'],
|
||||
'disposition' => ['disp'],
|
||||
]];
|
||||
imap_mail_compose($envelope, $body);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -0,0 +1,69 @@
|
||||
--TEST--
|
||||
Bug #80215 (imap_mail_compose() may modify by-val parameters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$envelope = [
|
||||
"from" => 1,
|
||||
"to" => 2,
|
||||
"custom_headers" => [3],
|
||||
];
|
||||
$body = [[
|
||||
"contents.data" => 4,
|
||||
"type.parameters" => ['foo' => 5],
|
||||
"disposition" => ['bar' => 6],
|
||||
], [
|
||||
"contents.data" => 7,
|
||||
"type.parameters" => ['foo' => 8],
|
||||
"disposition" => ['bar' => 9],
|
||||
]];
|
||||
imap_mail_compose($envelope, $body);
|
||||
var_dump($envelope, $body);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
["from"]=>
|
||||
int(1)
|
||||
["to"]=>
|
||||
int(2)
|
||||
["custom_headers"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["contents.data"]=>
|
||||
int(4)
|
||||
["type.parameters"]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
int(5)
|
||||
}
|
||||
["disposition"]=>
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
int(6)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
["contents.data"]=>
|
||||
int(7)
|
||||
["type.parameters"]=>
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
int(8)
|
||||
}
|
||||
["disposition"]=>
|
||||
array(1) {
|
||||
["bar"]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #80216 (imap_mail_compose() does not validate types/encodings)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], []]);
|
||||
imap_mail_compose([], [['type' => 12]]);
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], ['type' => 12]]);
|
||||
imap_mail_compose([], [['encoding' => 8]]);
|
||||
imap_mail_compose([], [['type' => TYPEMULTIPART], ['encoding' => 8]]);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Bug #80220 (imap_mail_compose() may leak memory) - message/rfc822 regression
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$bodies = [[
|
||||
'type' => TYPEMESSAGE,
|
||||
'subtype' => 'RFC822',
|
||||
], [
|
||||
'contents.data' => 'asd',
|
||||
]];
|
||||
var_dump(imap_mail_compose([], $bodies));
|
||||
|
||||
$bodies = [[
|
||||
'type' => TYPEMESSAGE,
|
||||
], [
|
||||
'contents.data' => 'asd',
|
||||
]];
|
||||
var_dump(imap_mail_compose([], $bodies));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(53) "MIME-Version: 1.0
|
||||
Content-Type: MESSAGE/RFC822
|
||||
|
||||
|
||||
"
|
||||
string(53) "MIME-Version: 1.0
|
||||
Content-Type: MESSAGE/RFC822
|
||||
|
||||
|
||||
"
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #80223 (imap_mail_compose() leaks envelope on malformed bodies)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imap_mail_compose([], []);
|
||||
imap_mail_compose([], [1]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d
|
||||
|
||||
Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #80226 (imap_sort() leaks sortpgm memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(__DIR__.'/imap_include.inc');
|
||||
$stream = imap_open($default_mailbox, $username, $password);
|
||||
imap_sort($stream, SORTFROM, 0);
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #80242 (imap_mail_compose() segfaults for multipart with rfc822)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$bodies = [[
|
||||
'type' => TYPEMULTIPART,
|
||||
], [
|
||||
'type' => TYPETEXT,
|
||||
'contents.data' => 'some text',
|
||||
], [
|
||||
'type' => TYPEMESSAGE,
|
||||
'subtype' => 'RFC822',
|
||||
]];
|
||||
imap_mail_compose([], $bodies);
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
imap_rfc822_write_address() : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imap_rfc822_write_address('me', 'example.com', 'My Name'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(24) "My Name <me@example.com>"
|
||||
@@ -36,6 +36,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
|
||||
int spattern_len = 0;
|
||||
zval* object;
|
||||
MessageFormatter_object* mfo;
|
||||
UParseError parse_error;
|
||||
int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
|
||||
intl_error_reset( NULL );
|
||||
|
||||
@@ -79,12 +80,26 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
|
||||
(mfo)->mf_data.orig_format_len = pattern_len;
|
||||
|
||||
/* Create an ICU message formatter. */
|
||||
MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, locale, NULL, &INTL_DATA_ERROR_CODE(mfo));
|
||||
MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, locale, &parse_error, &INTL_DATA_ERROR_CODE(mfo));
|
||||
|
||||
if(spattern) {
|
||||
efree(spattern);
|
||||
}
|
||||
|
||||
if (INTL_DATA_ERROR_CODE( mfo ) == U_PATTERN_SYNTAX_ERROR) {
|
||||
char *msg = NULL;
|
||||
smart_str parse_error_str;
|
||||
parse_error_str = intl_parse_error_to_string( &parse_error );
|
||||
spprintf( &msg, 0, "pattern syntax error (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "unknown parser error" );
|
||||
smart_str_free( &parse_error_str );
|
||||
|
||||
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( mfo ) );
|
||||
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
|
||||
|
||||
efree( msg );
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: message formatter creation failed");
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -116,7 +131,9 @@ PHP_METHOD( MessageFormatter, __construct )
|
||||
return_value = ZEND_THIS;
|
||||
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
|
||||
if (!EG(exception)) {
|
||||
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
|
||||
zend_string *err = intl_error_get_message(NULL);
|
||||
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
|
||||
zend_string_release_ex(err, 0);
|
||||
}
|
||||
}
|
||||
zend_restore_error_handling(&error_handling);
|
||||
|
||||
@@ -94,6 +94,7 @@ PHP_FUNCTION( msgfmt_format_message )
|
||||
size_t slocale_len = 0;
|
||||
MessageFormatter_object mf;
|
||||
MessageFormatter_object *mfo = &mf;
|
||||
UParseError parse_error;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "ssa",
|
||||
@@ -136,10 +137,25 @@ PHP_FUNCTION( msgfmt_format_message )
|
||||
#endif
|
||||
|
||||
/* Create an ICU message formatter. */
|
||||
MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo));
|
||||
MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, &parse_error, &INTL_DATA_ERROR_CODE(mfo));
|
||||
if(spattern && spattern_len) {
|
||||
efree(spattern);
|
||||
}
|
||||
|
||||
if (INTL_DATA_ERROR_CODE( mfo ) == U_PATTERN_SYNTAX_ERROR) {
|
||||
char *msg = NULL;
|
||||
smart_str parse_error_str;
|
||||
parse_error_str = intl_parse_error_to_string( &parse_error );
|
||||
spprintf( &msg, 0, "pattern syntax error (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "unknown parser error" );
|
||||
smart_str_free( &parse_error_str );
|
||||
|
||||
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( mfo ) );
|
||||
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
|
||||
|
||||
efree( msg );
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INTL_METHOD_CHECK_STATUS(mfo, "Creating message formatter failed");
|
||||
|
||||
msgfmt_do_format(mfo, args, return_value);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
--TEST--
|
||||
locale_get_display_language()
|
||||
locale_get_display_language() icu < 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') >= 0) die('skip for ICU < 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
--TEST--
|
||||
locale_get_display_language() icu >= 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') < 0) die('skip for ICU >= 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_language for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str='';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
'art-lojban', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_language( $locale ,$disp_locale );
|
||||
$res_str .= "disp_locale=$disp_locale : display_language=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_language=Ukrainian
|
||||
disp_locale=fr : display_language=ukrainien
|
||||
disp_locale=de : display_language=Ukrainisch
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_language=(Root|Unknown language)
|
||||
disp_locale=fr : display_language=(racine|langue indéterminée)
|
||||
disp_locale=de : display_language=([rR]oot|Unbekannte Sprache)
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_language=Ukrainian
|
||||
disp_locale=fr : display_language=ukrainien
|
||||
disp_locale=de : display_language=Ukrainisch
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_language=hindi
|
||||
disp_locale=fr : display_language=hindi
|
||||
disp_locale=de : display_language=hindi
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_language=German
|
||||
disp_locale=fr : display_language=allemand
|
||||
disp_locale=de : display_language=Deutsch
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_language=French
|
||||
disp_locale=fr : display_language=français
|
||||
disp_locale=de : display_language=Französisch
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_language=Japanese
|
||||
disp_locale=fr : display_language=japonais
|
||||
disp_locale=de : display_language=Japanisch
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_language=i-enochian
|
||||
disp_locale=fr : display_language=i-enochian
|
||||
disp_locale=de : display_language=i-enochian
|
||||
-----------------
|
||||
locale='art-lojban'
|
||||
disp_locale=en : display_language=Lojban
|
||||
disp_locale=fr : display_language=lojban
|
||||
disp_locale=de : display_language=Lojban
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_language=Serbian
|
||||
disp_locale=fr : display_language=serbe
|
||||
disp_locale=de : display_language=Serbisch
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_language=Serbian
|
||||
disp_locale=fr : display_language=serbe
|
||||
disp_locale=de : display_language=Serbisch
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_language=Serbian
|
||||
disp_locale=fr : display_language=serbe
|
||||
disp_locale=de : display_language=Serbisch
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_language=Slovenian
|
||||
disp_locale=fr : display_language=slovène
|
||||
disp_locale=de : display_language=Slowenisch
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_language=Slovenian
|
||||
disp_locale=fr : display_language=slovène
|
||||
disp_locale=de : display_language=Slowenisch
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_language=German
|
||||
disp_locale=fr : display_language=allemand
|
||||
disp_locale=de : display_language=Deutsch
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_language=Slovenian
|
||||
disp_locale=fr : display_language=slovène
|
||||
disp_locale=de : display_language=Slowenisch
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_language=Slovenian
|
||||
disp_locale=fr : display_language=slovène
|
||||
disp_locale=de : display_language=Slowenisch
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_language=German
|
||||
disp_locale=fr : display_language=allemand
|
||||
disp_locale=de : display_language=Deutsch
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_language=English
|
||||
disp_locale=fr : display_language=anglais
|
||||
disp_locale=de : display_language=Englisch
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_language=Spanish
|
||||
disp_locale=fr : display_language=espagnol
|
||||
disp_locale=de : display_language=Spanisch
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_language=German
|
||||
disp_locale=fr : display_language=allemand
|
||||
disp_locale=de : display_language=Deutsch
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_language=Azerbaijani
|
||||
disp_locale=fr : display_language=azerbaïdjanais
|
||||
disp_locale=de : display_language=Aserbaidschanisch
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_language=x-whatever
|
||||
disp_locale=fr : display_language=x-whatever
|
||||
disp_locale=de : display_language=x-whatever
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_language=qaa
|
||||
disp_locale=fr : display_language=qaa
|
||||
disp_locale=de : display_language=qaa
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_language=Serbian
|
||||
disp_locale=fr : display_language=serbe
|
||||
disp_locale=de : display_language=Serbisch
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_language=Serbian
|
||||
disp_locale=fr : display_language=serbe
|
||||
disp_locale=de : display_language=Serbisch
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_language=English
|
||||
disp_locale=fr : display_language=anglais
|
||||
disp_locale=de : display_language=Englisch
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_language=Chinese
|
||||
disp_locale=fr : display_language=chinois
|
||||
disp_locale=de : display_language=Chinesisch
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_language=English
|
||||
disp_locale=fr : display_language=anglais
|
||||
disp_locale=de : display_language=Englisch
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_language=German
|
||||
disp_locale=fr : display_language=allemand
|
||||
disp_locale=de : display_language=Deutsch
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_language=a
|
||||
disp_locale=fr : display_language=a
|
||||
disp_locale=de : display_language=a
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_language=Arabic
|
||||
disp_locale=fr : display_language=arabe
|
||||
disp_locale=de : display_language=Arabisch
|
||||
-----------------
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
locale_get_display_name() icu >= 64.0
|
||||
locale_get_display_name() icu >= 65.0 && icu < 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '65.0') < 0) die('skip for ICU >= 65.0'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') >= 0) die('skip for ICU < 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
--TEST--
|
||||
locale_get_display_name() icu >= 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') < 0) die('skip for ICU >= 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try getting the display_name for different locales
|
||||
* with Procedural and Object methods.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str='';
|
||||
|
||||
$disp_locales=array('en','fr','de');
|
||||
|
||||
$locales = array(
|
||||
'sl_IT_nedis_KIRTI',
|
||||
'sl_IT_nedis-a-kirti-x-xyz',
|
||||
'sl_IT_rozaj',
|
||||
'sl_IT_NEDIS_ROJAZ_1901',
|
||||
'i-enochian',
|
||||
'zh-hakka',
|
||||
'zh-wuu',
|
||||
'i-tay',
|
||||
'sgn-BE-nl',
|
||||
'sgn-CH-de',
|
||||
'sl_IT_rozaj@currency=EUR',
|
||||
'uk-ua_CALIFORNIA@currency=;currency=GRN',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'Hindi',
|
||||
//Simple language subtag
|
||||
'de',
|
||||
'fr',
|
||||
'ja',
|
||||
'i-enochian', //(example of a grandfathered tag)
|
||||
//Language subtag plus Script subtag:
|
||||
'zh-Hant',
|
||||
'zh-Hans',
|
||||
'sr-Cyrl',
|
||||
'sr-Latn',
|
||||
//Language-Script-Region
|
||||
'zh-Hans-CN',
|
||||
'sr-Latn-CS',
|
||||
//Language-Variant
|
||||
'sl-rozaj',
|
||||
'sl-nedis',
|
||||
//Language-Region-Variant
|
||||
'de-CH-1901',
|
||||
'sl-IT-nedis',
|
||||
//Language-Script-Region-Variant
|
||||
'sl-Latn-IT-nedis',
|
||||
//Language-Region:
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-419',
|
||||
//Private use subtags:
|
||||
'de-CH-x-phonebk',
|
||||
'az-Arab-x-AZE-derbend',
|
||||
//Extended language subtags
|
||||
'zh-min',
|
||||
'zh-min-nan-Hant-CN',
|
||||
//Private use registry values
|
||||
'x-whatever',
|
||||
'qaa-Qaaa-QM-x-southern',
|
||||
'sr-Latn-QM',
|
||||
'sr-Qaaa-CS',
|
||||
/*Tags that use extensions (examples ONLY: extensions MUST be defined
|
||||
by revision or update to this document or by RFC): */
|
||||
'en-US-u-islamCal',
|
||||
'zh-CN-a-myExt-x-private',
|
||||
'en-a-myExt-b-another',
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
);
|
||||
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$res_str .= "locale='$locale'\n";
|
||||
foreach( $disp_locales as $disp_locale )
|
||||
{
|
||||
$scr = ut_loc_get_display_name( $locale ,$disp_locale );
|
||||
$scr = str_replace(array('(', ')'), '#', $scr);
|
||||
$res_str .= "disp_locale=$disp_locale : display_name=$scr";
|
||||
$res_str .= "\n";
|
||||
}
|
||||
$res_str .= "-----------------\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
locale='sl_IT_nedis_KIRTI'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_KIRTI#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_KIRTI#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_KIRTI#
|
||||
-----------------
|
||||
locale='sl_IT_nedis-a-kirti-x-xyz'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_A_KIRTI_X_XYZ#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_A_KIRTI_X_XYZ#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch)#
|
||||
-----------------
|
||||
locale='sl_IT_NEDIS_ROJAZ_1901'
|
||||
disp_locale=en : display_name=Slovenian #Italy, NEDIS_ROJAZ_1901#
|
||||
disp_locale=fr : display_name=slovène #Italie, NEDIS_ROJAZ_1901#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, NEDIS_ROJAZ_1901#
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-hakka'
|
||||
disp_locale=en : display_name=Chinese( #HAKKA#)?
|
||||
disp_locale=fr : display_name=chinois( #HAKKA#)?
|
||||
disp_locale=de : display_name=Chinesisch( #HAKKA#)?
|
||||
-----------------
|
||||
locale='zh-wuu'
|
||||
disp_locale=en : display_name=Chinese #WUU#
|
||||
disp_locale=fr : display_name=chinois #WUU#
|
||||
disp_locale=de : display_name=Chinesisch #WUU#
|
||||
-----------------
|
||||
locale='i-tay'
|
||||
disp_locale=en : display_name=i-tay
|
||||
disp_locale=fr : display_name=i-tay
|
||||
disp_locale=de : display_name=i-tay
|
||||
-----------------
|
||||
locale='sgn-BE-nl'
|
||||
disp_locale=en : display_name=sgn #Belgium, NL#
|
||||
disp_locale=fr : display_name=sgn #Belgique, NL#
|
||||
disp_locale=de : display_name=sgn #Belgien, NL#
|
||||
-----------------
|
||||
locale='sgn-CH-de'
|
||||
disp_locale=en : display_name=sgn #Switzerland, DE#
|
||||
disp_locale=fr : display_name=sgn #Suisse, DE#
|
||||
disp_locale=de : display_name=sgn #Schweiz, DE#
|
||||
-----------------
|
||||
locale='sl_IT_rozaj@currency=EUR'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Resian, [Cc]urrency=Euro#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Resia, [Dd]evise=euro#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (ROZAJ|Resianisch), Währung=Euro#
|
||||
-----------------
|
||||
locale='uk-ua_CALIFORNIA@currency=;currency=GRN'
|
||||
disp_locale=en : display_name=
|
||||
disp_locale=fr : display_name=
|
||||
disp_locale=de : display_name=
|
||||
-----------------
|
||||
locale='root'
|
||||
disp_locale=en : display_name=Unknown language
|
||||
disp_locale=fr : display_name=langue indéterminée
|
||||
disp_locale=de : display_name=Unbekannte Sprache
|
||||
-----------------
|
||||
locale='uk@currency=EURO'
|
||||
disp_locale=en : display_name=Ukrainian #[Cc]urrency=EURO#
|
||||
disp_locale=fr : display_name=ukrainien #[Dd]evise=EURO#
|
||||
disp_locale=de : display_name=Ukrainisch #Währung=EURO#
|
||||
-----------------
|
||||
locale='Hindi'
|
||||
disp_locale=en : display_name=hindi
|
||||
disp_locale=fr : display_name=hindi
|
||||
disp_locale=de : display_name=hindi
|
||||
-----------------
|
||||
locale='de'
|
||||
disp_locale=en : display_name=German
|
||||
disp_locale=fr : display_name=allemand
|
||||
disp_locale=de : display_name=Deutsch
|
||||
-----------------
|
||||
locale='fr'
|
||||
disp_locale=en : display_name=French
|
||||
disp_locale=fr : display_name=français
|
||||
disp_locale=de : display_name=Französisch
|
||||
-----------------
|
||||
locale='ja'
|
||||
disp_locale=en : display_name=Japanese
|
||||
disp_locale=fr : display_name=japonais
|
||||
disp_locale=de : display_name=Japanisch
|
||||
-----------------
|
||||
locale='i-enochian'
|
||||
disp_locale=en : display_name=i-enochian #Private-Use=i-enochian#
|
||||
disp_locale=fr : display_name=i-enochian #usage privé=i-enochian#
|
||||
disp_locale=de : display_name=i-enochian #Privatnutzung=i-enochian#
|
||||
-----------------
|
||||
locale='zh-Hant'
|
||||
disp_locale=en : display_name=Chinese #Traditional#
|
||||
disp_locale=fr : display_name=chinois #traditionnel#
|
||||
disp_locale=de : display_name=Chinesisch #Traditionell#
|
||||
-----------------
|
||||
locale='zh-Hans'
|
||||
disp_locale=en : display_name=Chinese #Simplified#
|
||||
disp_locale=fr : display_name=chinois #simplifié#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht#
|
||||
-----------------
|
||||
locale='sr-Cyrl'
|
||||
disp_locale=en : display_name=Serbian #Cyrillic#
|
||||
disp_locale=fr : display_name=serbe #cyrillique#
|
||||
disp_locale=de : display_name=Serbisch #Kyrillisch#
|
||||
-----------------
|
||||
locale='sr-Latn'
|
||||
disp_locale=en : display_name=Serbian #Latin#
|
||||
disp_locale=fr : display_name=serbe #latin#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch#
|
||||
-----------------
|
||||
locale='zh-Hans-CN'
|
||||
disp_locale=en : display_name=Chinese #Simplified, China#
|
||||
disp_locale=fr : display_name=chinois #simplifié, Chine#
|
||||
disp_locale=de : display_name=Chinesisch #Vereinfacht, China#
|
||||
-----------------
|
||||
locale='sr-Latn-CS'
|
||||
disp_locale=en : display_name=Serbian #Latin, Serbia#
|
||||
disp_locale=fr : display_name=serbe #latin, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, Serbien#
|
||||
-----------------
|
||||
locale='sl-rozaj'
|
||||
disp_locale=en : display_name=Slovenian #Resian#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Resia#
|
||||
disp_locale=de : display_name=Slowenisch( #(ROZAJ|Resianisch)#)?
|
||||
-----------------
|
||||
locale='sl-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Natisone-Dialekt#
|
||||
-----------------
|
||||
locale='de-CH-1901'
|
||||
disp_locale=en : display_name=German #Switzerland, Traditional German orthography#
|
||||
disp_locale=fr : display_name=allemand #Suisse, orthographe allemande traditionnelle#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, (1901|[aA]lte deutsche Rechtschreibung)#
|
||||
-----------------
|
||||
locale='sl-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='sl-Latn-IT-nedis'
|
||||
disp_locale=en : display_name=Slovenian #Latin, Italy, Natisone dialect#
|
||||
disp_locale=fr : display_name=slovène #latin, Italie, dialecte de Natisone#
|
||||
disp_locale=de : display_name=Slowenisch #Lateinisch, Italien, (NEDIS|Natisone-Dialekt)#
|
||||
-----------------
|
||||
locale='de-DE'
|
||||
disp_locale=en : display_name=German #Germany#
|
||||
disp_locale=fr : display_name=allemand #Allemagne#
|
||||
disp_locale=de : display_name=Deutsch #Deutschland#
|
||||
-----------------
|
||||
locale='en-US'
|
||||
disp_locale=en : display_name=English #United States#
|
||||
disp_locale=fr : display_name=anglais #États-Unis#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten#
|
||||
-----------------
|
||||
locale='es-419'
|
||||
disp_locale=en : display_name=Spanish #Latin America#
|
||||
disp_locale=fr : display_name=espagnol #Amérique latine#
|
||||
disp_locale=de : display_name=Spanisch #Lateinamerika#
|
||||
-----------------
|
||||
locale='de-CH-x-phonebk'
|
||||
disp_locale=en : display_name=German #Switzerland, Private-Use=phonebk#
|
||||
disp_locale=fr : display_name=allemand #Suisse, usage privé=phonebk#
|
||||
disp_locale=de : display_name=Deutsch #Schweiz, Privatnutzung=phonebk#
|
||||
-----------------
|
||||
locale='az-Arab-x-AZE-derbend'
|
||||
disp_locale=en : display_name=Azerbaijani #Arabic, Private-Use=aze-derbend#
|
||||
disp_locale=fr : display_name=azerbaïdjanais #arabe, usage privé=aze-derbend#
|
||||
disp_locale=de : display_name=Aserbaidschanisch #Arabisch, Privatnutzung=aze-derbend#
|
||||
-----------------
|
||||
locale='zh-min'
|
||||
disp_locale=en : display_name=Chinese #MIN#
|
||||
disp_locale=fr : display_name=chinois #MIN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN#
|
||||
-----------------
|
||||
locale='zh-min-nan-Hant-CN'
|
||||
disp_locale=en : display_name=Chinese #MIN, NAN_HANT_CN#
|
||||
disp_locale=fr : display_name=chinois #MIN, NAN_HANT_CN#
|
||||
disp_locale=de : display_name=Chinesisch #MIN, NAN_HANT_CN#
|
||||
-----------------
|
||||
locale='x-whatever'
|
||||
disp_locale=en : display_name=x-whatever #Private-Use=whatever#
|
||||
disp_locale=fr : display_name=x-whatever #usage privé=whatever#
|
||||
disp_locale=de : display_name=x-whatever #Privatnutzung=whatever#
|
||||
-----------------
|
||||
locale='qaa-Qaaa-QM-x-southern'
|
||||
disp_locale=en : display_name=qaa #Qaaa, QM, Private-Use=southern#
|
||||
disp_locale=fr : display_name=qaa #Qaaa, QM, usage privé=southern#
|
||||
disp_locale=de : display_name=qaa #Qaaa, QM, Privatnutzung=southern#
|
||||
-----------------
|
||||
locale='sr-Latn-QM'
|
||||
disp_locale=en : display_name=Serbian #Latin, QM#
|
||||
disp_locale=fr : display_name=serbe #latin, QM#
|
||||
disp_locale=de : display_name=Serbisch #Lateinisch, QM#
|
||||
-----------------
|
||||
locale='sr-Qaaa-CS'
|
||||
disp_locale=en : display_name=Serbian #Qaaa, Serbia#
|
||||
disp_locale=fr : display_name=serbe #Qaaa, Serbie#
|
||||
disp_locale=de : display_name=Serbisch #Qaaa, Serbien#
|
||||
-----------------
|
||||
locale='en-US-u-islamCal'
|
||||
disp_locale=en : display_name=English #United States, attribute=islamcal#
|
||||
disp_locale=fr : display_name=anglais #États-Unis, attribute=islamcal#
|
||||
disp_locale=de : display_name=Englisch #Vereinigte Staaten, attribute=islamcal#
|
||||
-----------------
|
||||
locale='zh-CN-a-myExt-x-private'
|
||||
disp_locale=en : display_name=Chinese #China, a=myext, Private-Use=private#
|
||||
disp_locale=fr : display_name=chinois #Chine, a=myext, usage privé=private#
|
||||
disp_locale=de : display_name=Chinesisch #China, a=myext, Privatnutzung=private#
|
||||
-----------------
|
||||
locale='en-a-myExt-b-another'
|
||||
disp_locale=en : display_name=English #a=myext, b=another#
|
||||
disp_locale=fr : display_name=anglais #a=myext, b=another#
|
||||
disp_locale=de : display_name=Englisch #a=myext, b=another#
|
||||
-----------------
|
||||
locale='de-419-DE'
|
||||
disp_locale=en : display_name=German #Latin America, DE#
|
||||
disp_locale=fr : display_name=allemand #Amérique latine, DE#
|
||||
disp_locale=de : display_name=Deutsch #Lateinamerika, DE#
|
||||
-----------------
|
||||
locale='a-DE'
|
||||
disp_locale=en : display_name=a #Germany#
|
||||
disp_locale=fr : display_name=a #Allemagne#
|
||||
disp_locale=de : display_name=a #Deutschland#
|
||||
-----------------
|
||||
locale='ar-a-aaa-b-bbb-a-ccc'
|
||||
disp_locale=en : display_name=Arabic #a=aaa, b=bbb#
|
||||
disp_locale=fr : display_name=arabe #a=aaa, b=bbb#
|
||||
disp_locale=de : display_name=Arabisch #a=aaa, b=bbb#
|
||||
-----------------
|
||||
@@ -96,12 +96,12 @@ Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
|
||||
IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
|
||||
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
|
||||
IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
|
||||
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
@@ -115,17 +115,17 @@ Warning: MessageFormatter::create() expects parameter 1 to be string, array give
|
||||
Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
|
||||
'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
|
||||
IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
|
||||
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
|
||||
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
|
||||
IntlException: pattern syntax error (parse error at offset 1, after "{", before or at "0,choice}"): U_PATTERN_SYNTAX_ERROR in %s on line %d
|
||||
'pattern syntax error (parse error at offset 1, after "{", before or at "0,choice}"): U_PATTERN_SYNTAX_ERROR'
|
||||
'pattern syntax error (parse error at offset 1, after "{", before or at "0,choice}"): U_PATTERN_SYNTAX_ERROR'
|
||||
'pattern syntax error (parse error at offset 1, after "{", before or at "0,choice}"): U_PATTERN_SYNTAX_ERROR'
|
||||
|
||||
IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
|
||||
IntlException: msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES in %s on line %d
|
||||
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
|
||||
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
|
||||
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
|
||||
|
||||
IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
|
||||
IntlException: msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND in %s on line %d
|
||||
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
|
||||
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
|
||||
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
IntlRuleBasedBreakIterator::getBinaryRules(): basic test
|
||||
IntlRuleBasedBreakIterator::getBinaryRules(): basic test icu >= 61.1 && icu < 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if(version_compare(INTL_ICU_VERSION, '61.1') < 0) print 'skip ICU >= 61.1 only'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') >= 0) die('skip for ICU < 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
IntlRuleBasedBreakIterator::getBinaryRules(): basic test icu >= 68.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') < 0) die('skip for ICU >= 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
|
||||
$rules = <<<RULES
|
||||
\$LN = [[:letter:] [:number:]];
|
||||
\$S = [.;,:];
|
||||
|
||||
!!forward;
|
||||
\$LN+ {1};
|
||||
\$S+ {42};
|
||||
!!reverse;
|
||||
\$LN+ {1};
|
||||
\$S+ {42};
|
||||
!!safe_forward;
|
||||
!!safe_reverse;
|
||||
RULES;
|
||||
$rbbi = new IntlRuleBasedBreakIterator($rules);
|
||||
$rbbi->setText('sdfkjsdf88á.... ,;');
|
||||
|
||||
$br = $rbbi->getBinaryRules();
|
||||
|
||||
$rbbi2 = new IntlRuleBasedBreakIterator($br, true);
|
||||
|
||||
var_dump($rbbi->getRules(), $rbbi2->getRules());
|
||||
var_dump($rbbi->getRules() == $rbbi2->getRules());
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(119) "$LN=[[:letter:][:number:]];$S=[.;,:];!!forward;$LN+{1};$S+{42};!!reverse;$LN+{1};$S+{42};!!safe_forward;!!safe_reverse;"
|
||||
string(119) "$LN=[[:letter:][:number:]];$S=[.;,:];!!forward;$LN+{1};$S+{42};!!reverse;$LN+{1};$S+{42};!!safe_forward;!!safe_reverse;"
|
||||
bool(true)
|
||||
==DONE==
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
IntlRuleBasedBreakIterator::getRules(): basic test
|
||||
IntlRuleBasedBreakIterator::getRules(): basic test icu >= 61.1 && icu < 68.1
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '61.1') < 0) die('skip for ICU >= 61.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') >= 0) die('skip for ICU < 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
IntlRuleBasedBreakIterator::getRules(): basic test icu >= 68.1
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '68.1') < 0) die('skip for ICU >= 68.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
|
||||
$rules = <<<RULES
|
||||
\$LN = [[:letter:] [:number:]];
|
||||
\$S = [.;,:];
|
||||
|
||||
!!forward;
|
||||
\$LN+ {1};
|
||||
\$S+ {42};
|
||||
!!reverse;
|
||||
\$LN+ {1};
|
||||
\$S+ {42};
|
||||
!!safe_forward;
|
||||
!!safe_reverse;
|
||||
RULES;
|
||||
$rbbi = new IntlRuleBasedBreakIterator($rules);
|
||||
var_dump($rbbi->getRules());
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(119) "$LN=[[:letter:][:number:]];$S=[.;,:];!!forward;$LN+{1};$S+{42};!!reverse;$LN+{1};$S+{42};!!safe_forward;!!safe_reverse;"
|
||||
==DONE==
|
||||
@@ -47,14 +47,8 @@ if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then
|
||||
elif test "$PHP_MYSQLI" != "no"; then
|
||||
|
||||
MYSQL_CONFIG=$PHP_MYSQLI
|
||||
|
||||
MYSQL_LIB_NAME='mysqlclient'
|
||||
if test "$enable_maintainer_zts" = "yes"; then
|
||||
MYSQL_LIB_CFG='--libs_r'
|
||||
MYSQL_LIB_NAME='mysqlclient_r'
|
||||
else
|
||||
MYSQL_LIB_CFG='--libs'
|
||||
fi
|
||||
MYSQL_LIB_CFG='--libs'
|
||||
|
||||
if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG $MYSQL_LIB_CFG > /dev/null 2>&1; then
|
||||
MYSQLI_INCLINE=`$MYSQL_CONFIG --cflags | $SED -e "s/'//g"`
|
||||
|
||||
+1
-1
@@ -699,7 +699,7 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
|
||||
REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
#if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND)
|
||||
#if (MYSQL_VERSION_ID > 50110 && MYSQL_VERSION_ID < 80000) || (MYSQL_VERSION_ID >= 100000) || defined(MYSQLI_USE_MYSQLND)
|
||||
REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT);
|
||||
#endif
|
||||
|
||||
|
||||
+17
-5
@@ -171,6 +171,7 @@ PHP_FUNCTION(mysqli_autocommit)
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
if (mysql_autocommit(mysql->mysql, (my_bool)automode)) {
|
||||
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
@@ -614,7 +615,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
size_t user_len, password_len, dbname_len;
|
||||
zend_ulong rc;
|
||||
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
|
||||
const CHARSET_INFO * old_charset;
|
||||
MY_CHARSET_INFO old_charset;
|
||||
#endif
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
|
||||
@@ -623,7 +624,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
|
||||
old_charset = mysql->mysql->charset;
|
||||
mysql_get_character_set_info(mysql->mysql, &old_charset);
|
||||
#endif
|
||||
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
@@ -643,7 +644,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug :
|
||||
Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call
|
||||
*/
|
||||
rc = mysql_set_character_set(mysql->mysql, old_charset->csname);
|
||||
rc = mysql_set_character_set(mysql->mysql, old_charset.csname);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -754,6 +755,7 @@ PHP_FUNCTION(mysqli_commit)
|
||||
#else
|
||||
if (FAIL == mysqlnd_commit(mysql->mysql, flags, name)) {
|
||||
#endif
|
||||
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
@@ -1123,7 +1125,8 @@ void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS)
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
|
||||
|
||||
if (FAIL == mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything)) {
|
||||
if (FAIL == mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything)) {
|
||||
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
|
||||
RETURN_BOOL(FALSE);
|
||||
} else if (fetched_anything == TRUE) {
|
||||
RETURN_BOOL(TRUE);
|
||||
@@ -1701,10 +1704,12 @@ static int mysqli_options_get_option_zval_type(int option)
|
||||
#endif /* MySQL 4.1.0 */
|
||||
case MYSQL_OPT_READ_TIMEOUT:
|
||||
case MYSQL_OPT_WRITE_TIMEOUT:
|
||||
#ifdef MYSQL_OPT_GUESS_CONNECTION /* removed in MySQL-8.0 */
|
||||
case MYSQL_OPT_GUESS_CONNECTION:
|
||||
case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
|
||||
case MYSQL_OPT_USE_REMOTE_CONNECTION:
|
||||
case MYSQL_SECURE_AUTH:
|
||||
#endif
|
||||
#ifdef MYSQL_OPT_RECONNECT
|
||||
case MYSQL_OPT_RECONNECT:
|
||||
#endif /* MySQL 5.0.13 */
|
||||
@@ -1939,6 +1944,11 @@ PHP_FUNCTION(mysqli_real_query)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(MYSQLI_USE_MYSQLND) || MYSQL_VERSION_ID < 50707 || defined(MARIADB_BASE_VERSION)
|
||||
# define mysql_real_escape_string_quote(mysql, to, from, length, quote) \
|
||||
mysql_real_escape_string(mysql, to, from, length)
|
||||
#endif
|
||||
|
||||
/* {{{ proto string mysqli_real_escape_string(object link, string escapestr)
|
||||
Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection */
|
||||
PHP_FUNCTION(mysqli_real_escape_string) {
|
||||
@@ -1954,7 +1964,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
newstr = zend_string_alloc(2 * escapestr_len, 0);
|
||||
ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
|
||||
ZSTR_LEN(newstr) = mysql_real_escape_string_quote(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len, '\'');
|
||||
newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
|
||||
|
||||
RETURN_NEW_STR(newstr);
|
||||
@@ -1981,6 +1991,7 @@ PHP_FUNCTION(mysqli_rollback)
|
||||
#else
|
||||
if (FAIL == mysqlnd_rollback(mysql->mysql, flags, name)) {
|
||||
#endif
|
||||
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
@@ -2342,6 +2353,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
|
||||
#else
|
||||
if (FAIL == mysql_stmt_attr_set(stmt->stmt, attr, mode_p)) {
|
||||
#endif
|
||||
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
|
||||
+27
-28
@@ -328,7 +328,8 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql));
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
mysql->mysql->reconnect = MyG(reconnect);
|
||||
char reconnect = MyG(reconnect);
|
||||
mysql_options(mysql->mysql, MYSQL_OPT_RECONNECT, (char *)&reconnect);
|
||||
#endif
|
||||
unsigned int allow_local_infile = MyG(allow_local_infile);
|
||||
mysql_options(mysql->mysql, MYSQL_OPT_LOCAL_INFILE, (char *)&allow_local_infile);
|
||||
@@ -1112,45 +1113,43 @@ extern char * mysqli_escape_string_for_tx_name_in_comment(const char * const nam
|
||||
static int mysqli_begin_transaction_libmysql(MYSQL * conn, const unsigned int mode, const char * const name)
|
||||
{
|
||||
int ret;
|
||||
zend_bool err = FALSE;
|
||||
smart_str tmp_str = {0};
|
||||
char * name_esc;
|
||||
char * query;
|
||||
unsigned int query_len;
|
||||
if (mode & TRANS_START_WITH_CONSISTENT_SNAPSHOT) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
if (mysql_get_server_version(conn) < 50605L) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
err = TRUE;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
if (err == FALSE){
|
||||
char * name_esc = mysqli_escape_string_for_tx_name_in_comment(name);
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
|
||||
name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
|
||||
name_esc = mysqli_escape_string_for_tx_name_in_comment(name);
|
||||
query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
|
||||
name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
|
||||
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
}
|
||||
smart_str_free(&tmp_str);
|
||||
if (name_esc) {
|
||||
efree(name_esc);
|
||||
}
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
|
||||
if (ret && mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY) && mysql_errno(conn) == 1064) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1260,7 +1259,7 @@ PHP_FUNCTION(mysqli_release_savepoint)
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
if (mysqli_savepoint_libmysql(mysql->mysql, name, TRUE)) {
|
||||
#else
|
||||
if (FAIL == mysqlnd_savepoint(mysql->mysql, name)) {
|
||||
if (FAIL == mysqlnd_release_savepoint(mysql->mysql, name)) {
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,6 @@
|
||||
#define WE_HAD_MBSTATE_T
|
||||
#endif
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
#if !defined(HAVE_MBRLEN) && defined(WE_HAD_MBRLEN)
|
||||
#define HAVE_MBRLEN 1
|
||||
#endif
|
||||
@@ -64,20 +62,12 @@
|
||||
#define HAVE_MBSTATE_T 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
We need more than mysql.h because we need CHARSET_INFO in one place.
|
||||
This order has been borrowed from the ODBC driver. Nothing can be removed
|
||||
from the list of headers :(
|
||||
*/
|
||||
|
||||
#include <my_sys.h>
|
||||
#include <mysql.h>
|
||||
#if MYSQL_VERSION_ID >= 80000 && MYSQL_VERSION_ID < 100000
|
||||
typedef _Bool my_bool;
|
||||
#endif
|
||||
#include <errmsg.h>
|
||||
#include <my_list.h>
|
||||
#include <m_string.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <my_list.h>
|
||||
#include <m_ctype.h>
|
||||
#include "mysqli_libmysql.h"
|
||||
#endif /* MYSQLI_USE_MYSQLND */
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
--TEST--
|
||||
Bug #79375: mysqli_store_result does not report error from lock wait timeout
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli2 = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
$mysqli->query('DROP TABLE IF EXISTS test');
|
||||
$mysqli->query('CREATE TABLE test (first int) ENGINE = InnoDB');
|
||||
$mysqli->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
|
||||
|
||||
function testStmtStoreResult(mysqli $mysqli, string $name) {
|
||||
$mysqli->query("SET innodb_lock_wait_timeout = 1");
|
||||
$mysqli->query("START TRANSACTION");
|
||||
$query = "SELECT first FROM test WHERE first = 1 FOR UPDATE";
|
||||
echo "Running query on $name\n";
|
||||
$stmt = $mysqli->prepare($query);
|
||||
$stmt->execute();
|
||||
try {
|
||||
$stmt->store_result();
|
||||
echo "Got {$stmt->num_rows} for $name\n";
|
||||
} catch(mysqli_sql_exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
function testStmtGetResult(mysqli $mysqli, string $name) {
|
||||
$mysqli->query("SET innodb_lock_wait_timeout = 1");
|
||||
$mysqli->query("START TRANSACTION");
|
||||
$query = "SELECT first FROM test WHERE first = 1 FOR UPDATE";
|
||||
echo "Running query on $name\n";
|
||||
$stmt = $mysqli->prepare($query);
|
||||
$stmt->execute();
|
||||
try {
|
||||
$res = $stmt->get_result();
|
||||
echo "Got {$res->num_rows} for $name\n";
|
||||
} catch(mysqli_sql_exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
function testNormalQuery(mysqli $mysqli, string $name) {
|
||||
$mysqli->query("SET innodb_lock_wait_timeout = 1");
|
||||
$mysqli->query("START TRANSACTION");
|
||||
$query = "SELECT first FROM test WHERE first = 1 FOR UPDATE";
|
||||
echo "Running query on $name\n";
|
||||
try {
|
||||
$res = $mysqli->query($query);
|
||||
echo "Got {$res->num_rows} for $name\n";
|
||||
} catch(mysqli_sql_exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
function testStmtUseResult(mysqli $mysqli, string $name) {
|
||||
$mysqli->query("SET innodb_lock_wait_timeout = 1");
|
||||
$mysqli->query("START TRANSACTION");
|
||||
$query = "SELECT first FROM test WHERE first = 1 FOR UPDATE";
|
||||
echo "Running query on $name\n";
|
||||
$stmt = $mysqli->prepare($query);
|
||||
$stmt->execute();
|
||||
try {
|
||||
$stmt->fetch(); // should throw an error
|
||||
$stmt->fetch();
|
||||
echo "Got {$stmt->num_rows} for $name\n";
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
function testResultFetchRow(mysqli $mysqli, string $name) {
|
||||
$mysqli->query("SET innodb_lock_wait_timeout = 1");
|
||||
$mysqli->query("START TRANSACTION");
|
||||
$query = "SELECT first FROM test WHERE first = 1 FOR UPDATE";
|
||||
echo "Running query on $name\n";
|
||||
$res = $mysqli->query($query, MYSQLI_USE_RESULT);
|
||||
try {
|
||||
$res->fetch_row();
|
||||
$res->fetch_row();
|
||||
echo "Got {$res->num_rows} for $name\n";
|
||||
} catch(mysqli_sql_exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
testStmtStoreResult($mysqli, 'first connection');
|
||||
testStmtStoreResult($mysqli2, 'second connection');
|
||||
|
||||
$mysqli->close();
|
||||
$mysqli2->close();
|
||||
|
||||
echo "\n";
|
||||
// try it again for get_result
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli2 = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
testStmtGetResult($mysqli, 'first connection');
|
||||
testStmtGetResult($mysqli2, 'second connection');
|
||||
|
||||
$mysqli->close();
|
||||
$mysqli2->close();
|
||||
|
||||
echo "\n";
|
||||
// try it again with unprepared query
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli2 = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
testNormalQuery($mysqli, 'first connection');
|
||||
testNormalQuery($mysqli2, 'second connection');
|
||||
|
||||
$mysqli->close();
|
||||
$mysqli2->close();
|
||||
|
||||
echo "\n";
|
||||
// try it again with unprepared query
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli2 = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
testStmtUseResult($mysqli, 'first connection');
|
||||
testStmtUseResult($mysqli2, 'second connection');
|
||||
|
||||
$mysqli->close();
|
||||
$mysqli2->close();
|
||||
|
||||
echo "\n";
|
||||
// try it again using fetch_row on a result object
|
||||
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli2 = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
|
||||
|
||||
testResultFetchRow($mysqli, 'first connection');
|
||||
testResultFetchRow($mysqli2, 'second connection');
|
||||
|
||||
$mysqli->close();
|
||||
$mysqli2->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Running query on first connection
|
||||
Got %d for first connection
|
||||
Running query on second connection
|
||||
Lock wait timeout exceeded; try restarting transaction
|
||||
|
||||
Running query on first connection
|
||||
Got %d for first connection
|
||||
Running query on second connection
|
||||
Lock wait timeout exceeded; try restarting transaction
|
||||
|
||||
Running query on first connection
|
||||
Got %d for first connection
|
||||
Running query on second connection
|
||||
Lock wait timeout exceeded; try restarting transaction
|
||||
|
||||
Running query on first connection
|
||||
Got %d for first connection
|
||||
Running query on second connection
|
||||
Lock wait timeout exceeded; try restarting transaction
|
||||
|
||||
Running query on first connection
|
||||
Got 1 for first connection
|
||||
Running query on second connection
|
||||
|
||||
Warning: mysqli_result::fetch_row(): Error while reading a row in %s on line %d
|
||||
Got 0 for second connection
|
||||
@@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
Bug #80107 mysqli_query() fails for ~16 MB long query when compression is enabled
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once("connect.inc");
|
||||
$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||
if (!$link) {
|
||||
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
|
||||
}
|
||||
$result = $link->query("SHOW VARIABLES LIKE 'max_allowed_packet'");
|
||||
if ($result->fetch_assoc()['Value'] < 0xffffff) {
|
||||
die('skip max_allowed_packet is less than 0xffffff');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("connect.inc");
|
||||
|
||||
$data_size = 16777174;
|
||||
|
||||
// Insert with compression disabled:
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket);
|
||||
$mysqli->query("DROP TABLE IF EXISTS test");
|
||||
$mysqli->query("CREATE TABLE test (`blob` LONGBLOB NOT NULL) ENGINE=MyISAM");
|
||||
|
||||
$data = str_repeat("x", $data_size);
|
||||
$mysqli->query("INSERT INTO $db.test(`blob`) VALUE ('$data')");
|
||||
|
||||
var_dump(mysqli_error_list($mysqli));
|
||||
$mysqli->close();
|
||||
|
||||
// Insert with compression enabled:
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS);
|
||||
|
||||
$data = str_repeat("x", $data_size);
|
||||
$mysqli->query("INSERT INTO $db.test(`blob`) VALUE ('$data')");
|
||||
|
||||
var_dump(mysqli_error_list($mysqli));
|
||||
$mysqli->close();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
@@ -50,7 +50,7 @@ if (!have_innodb($link))
|
||||
printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
/* note that there is no savepoint my... */
|
||||
if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
|
||||
if (false !== ($tmp = mysqli_release_savepoint($link, 'my')))
|
||||
printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
|
||||
|
||||
+250
-209
@@ -3,285 +3,314 @@ mysqli_report()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
require_once("connect.inc");
|
||||
|
||||
$tmp = NULL;
|
||||
$link = NULL;
|
||||
if (true !== ($tmp = mysqli_report(-1)))
|
||||
printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (NULL !== ($tmp = @mysqli_report()))
|
||||
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
|
||||
printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (true !== ($tmp = mysqli_report(-1)))
|
||||
printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
|
||||
printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
|
||||
printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
|
||||
printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
|
||||
printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
|
||||
printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
|
||||
printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
|
||||
printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
|
||||
printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
require('table.inc');
|
||||
|
||||
if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
|
||||
printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
|
||||
/*
|
||||
Internal macro MYSQL_REPORT_ERROR
|
||||
*/
|
||||
mysqli_report(MYSQLI_REPORT_ERROR);
|
||||
|
||||
require('table.inc');
|
||||
mysqli_multi_query($link, "BAR; FOO;");
|
||||
mysqli_query($link, "FOO");
|
||||
try {
|
||||
mysqli_kill($link, -1);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
/*
|
||||
Internal macro MYSQL_REPORT_ERROR
|
||||
*/
|
||||
mysqli_report(MYSQLI_REPORT_ERROR);
|
||||
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
|
||||
mysqli_prepare($link, "FOO");
|
||||
mysqli_real_query($link, "FOO");
|
||||
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
|
||||
printf("[009] select_db should have failed\n");
|
||||
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
|
||||
|
||||
mysqli_multi_query($link, "BAR; FOO;");
|
||||
mysqli_query($link, "FOO");
|
||||
mysqli_kill($link, -1);
|
||||
mysqli_multi_query($link, "SELECT 1; FOO;");
|
||||
mysqli_autocommit($link, true);
|
||||
mysqli_commit($link);
|
||||
mysqli_rollback($link);
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
while(mysqli_more_results($link)) {
|
||||
mysqli_next_result($link);
|
||||
$res = mysqli_store_result($link);
|
||||
}
|
||||
mysqli_next_result($link);
|
||||
|
||||
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
|
||||
mysqli_prepare($link, "FOO");
|
||||
mysqli_real_query($link, "FOO");
|
||||
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
|
||||
printf("[009] select_db should have failed\n");
|
||||
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
|
||||
$stmt = mysqli_prepare($link, "SELECT 1");
|
||||
mysqli_stmt_attr_set($stmt, MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE);
|
||||
|
||||
// Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
|
||||
// not have been set. If that would be the case, the test would be broken.
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
|
||||
// Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
|
||||
// not have been set. If that would be the case, the test would be broken.
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_multi_query($link, "BAR; FOO;");
|
||||
mysqli_query($link, "FOO");
|
||||
try {
|
||||
mysqli_kill($link, -1);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
mysqli_prepare($link, "FOO");
|
||||
mysqli_real_query($link, "FOO");
|
||||
mysqli_select_db($link, "Oh lord, let this be an unknown database name");
|
||||
|
||||
mysqli_multi_query($link, "BAR; FOO;");
|
||||
mysqli_query($link, "FOO");
|
||||
mysqli_kill($link, -1);
|
||||
mysqli_prepare($link, "FOO");
|
||||
mysqli_real_query($link, "FOO");
|
||||
mysqli_select_db($link, "Oh lord, let this be an unknown database name");
|
||||
mysqli_multi_query($link, "SELECT 1; FOO;");
|
||||
mysqli_autocommit($link, true);
|
||||
mysqli_commit($link);
|
||||
mysqli_rollback($link);
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
while(mysqli_more_results($link)) {
|
||||
mysqli_next_result($link);
|
||||
$res = mysqli_store_result($link);
|
||||
}
|
||||
mysqli_next_result($link);
|
||||
|
||||
/*
|
||||
Internal macro MYSQL_REPORT_STMT_ERROR
|
||||
*/
|
||||
$stmt = mysqli_prepare($link, "SELECT 1");
|
||||
mysqli_stmt_attr_set($stmt, MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE);
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR);
|
||||
/*
|
||||
Internal macro MYSQL_REPORT_STMT_ERROR
|
||||
*/
|
||||
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "FOO");
|
||||
mysqli_report(MYSQLI_REPORT_ERROR);
|
||||
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "FOO");
|
||||
|
||||
/* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
// mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
|
||||
/* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */
|
||||
/* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */
|
||||
/* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */
|
||||
/* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */
|
||||
/* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */
|
||||
/* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
// mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
|
||||
// Check
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
/* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */
|
||||
/* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */
|
||||
/* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */
|
||||
/* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */
|
||||
/* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "FOO");
|
||||
// Check
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "FOO");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
|
||||
/*
|
||||
MYSQLI_REPORT_STRICT
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
$stmt = mysqli_stmt_init($link);
|
||||
mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
|
||||
$id = 1;
|
||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||
mysqli_kill($link, mysqli_thread_id($link));
|
||||
mysqli_stmt_execute($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_close($link);
|
||||
|
||||
MYSQLI_REPORT_STRICT --->
|
||||
php_mysqli_report_error() ->
|
||||
MYSQLI_REPORT_MYSQL_ERROR,
|
||||
MYSQLI_REPORT_STMT_ERROR ->
|
||||
already tested
|
||||
/*
|
||||
MYSQLI_REPORT_STRICT
|
||||
|
||||
php_mysqli_throw_sql_exception() ->
|
||||
my_mysqli_real_connect()
|
||||
my_mysqli_connect()
|
||||
MYSQLI_REPORT_STRICT --->
|
||||
php_mysqli_report_error() ->
|
||||
MYSQLI_REPORT_MYSQL_ERROR,
|
||||
MYSQLI_REPORT_STMT_ERROR ->
|
||||
already tested
|
||||
|
||||
can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result()
|
||||
*/
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_report(MYSQLI_REPORT_STRICT);
|
||||
php_mysqli_throw_sql_exception() ->
|
||||
my_mysqli_real_connect()
|
||||
my_mysqli_connect()
|
||||
|
||||
try {
|
||||
can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result()
|
||||
*/
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_report(MYSQLI_REPORT_STRICT);
|
||||
|
||||
if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
|
||||
printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user . 'unknown_really', $db, $port, $socket);
|
||||
mysqli_close($link);
|
||||
try {
|
||||
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
printf("[013] %s\n", $e->getMessage());
|
||||
}
|
||||
if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
|
||||
printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user . 'unknown_really', $db, $port, $socket);
|
||||
mysqli_close($link);
|
||||
|
||||
try {
|
||||
if (!$link = mysqli_init())
|
||||
printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
printf("[013] %s\n", $e->getMessage());
|
||||
}
|
||||
|
||||
if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
|
||||
printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user . 'unknown_really', $db, $port, $socket);
|
||||
mysqli_close($link);
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
printf("[016] %s\n", $e->getMessage());
|
||||
}
|
||||
try {
|
||||
if (!$link = mysqli_init())
|
||||
printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
|
||||
/*
|
||||
MYSQLI_REPORT_INDEX --->
|
||||
mysqli_query()
|
||||
mysqli_stmt_execute()
|
||||
mysqli_prepare()
|
||||
mysqli_real_query()
|
||||
mysqli_store_result()
|
||||
mysqli_use_result()
|
||||
if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
|
||||
printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
|
||||
$host, $user . 'unknown_really', $db, $port, $socket);
|
||||
mysqli_close($link);
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
printf("[016] %s\n", $e->getMessage());
|
||||
}
|
||||
|
||||
No test, because of to many prerequisites:
|
||||
- Server needs to be started with and
|
||||
--log-slow-queries --log-queries-not-using-indexes
|
||||
- query must cause the warning on all MySQL versions
|
||||
/*
|
||||
MYSQLI_REPORT_INDEX --->
|
||||
mysqli_query()
|
||||
mysqli_stmt_execute()
|
||||
mysqli_prepare()
|
||||
mysqli_real_query()
|
||||
mysqli_store_result()
|
||||
mysqli_use_result()
|
||||
|
||||
TODO:
|
||||
*/
|
||||
$log_slow_queries = false;
|
||||
$log_queries_not_using_indexes = false;
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_report(MYSQLI_REPORT_INDEX);
|
||||
No test, because of to many prerequisites:
|
||||
- Server needs to be started with and
|
||||
--log-slow-queries --log-queries-not-using-indexes
|
||||
- query must cause the warning on all MySQL versions
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
TODO:
|
||||
*/
|
||||
$log_slow_queries = false;
|
||||
$log_queries_not_using_indexes = false;
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_report(MYSQLI_REPORT_INDEX);
|
||||
|
||||
if (mysqli_get_server_version($link) <= 50600) {
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
|
||||
printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
|
||||
if (!$row = mysqli_fetch_assoc($res))
|
||||
printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (mysqli_get_server_version($link) <= 50600) {
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
|
||||
printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
$log_slow_query = ('ON' == $row['Value']);
|
||||
if (!$row = mysqli_fetch_assoc($res))
|
||||
printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (mysqli_get_server_version($link) >= 50111) {
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
|
||||
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
$log_slow_query = ('ON' == $row['Value']);
|
||||
|
||||
if (!$row = mysqli_fetch_assoc($res))
|
||||
printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (mysqli_get_server_version($link) >= 50111) {
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
|
||||
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
$log_queries_not_using_indexes = ('ON' == $row['Value']);
|
||||
if (!$row = mysqli_fetch_assoc($res))
|
||||
printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if ($log_slow_queries && $log_queries_not_using_indexes) {
|
||||
$log_queries_not_using_indexes = ('ON' == $row['Value']);
|
||||
|
||||
for ($i = 100; $i < 20000; $i++) {
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
|
||||
printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if ($log_slow_queries && $log_queries_not_using_indexes) {
|
||||
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
|
||||
printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
for ($i = 100; $i < 20000; $i++) {
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
|
||||
printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
|
||||
mysqli_free_result($res);
|
||||
}
|
||||
}
|
||||
}
|
||||
// this might cause a warning - no index used
|
||||
if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
|
||||
printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
// Maybe we've provoked an index message, maybe not.
|
||||
// All we can do is make a few dummy calls to ensure that all codes gets executed which
|
||||
// checks the flag. Functions to check: mysqli_query() - done above,
|
||||
// mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result()
|
||||
// mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id()
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_close($link);
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
mysqli_free_result($res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
// Maybe we've provoked an index message, maybe not.
|
||||
// All we can do is make a few dummy calls to ensure that all codes gets executed which
|
||||
// checks the flag. Functions to check: mysqli_query() - done above,
|
||||
// mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result()
|
||||
// mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id()
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
mysqli_close($link);
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
|
||||
if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
|
||||
printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
|
||||
printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
|
||||
printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
if (!$res = mysqli_use_result($link))
|
||||
printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
|
||||
printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
mysqli_free_result($res);
|
||||
if (!$res = mysqli_use_result($link))
|
||||
printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
|
||||
printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
mysqli_free_result($res);
|
||||
|
||||
if (!$res = mysqli_store_result($link))
|
||||
printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
|
||||
printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
mysqli_free_result($res);
|
||||
if (!$res = mysqli_store_result($link))
|
||||
printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test'))
|
||||
printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
else
|
||||
mysqli_stmt_close($stmt);
|
||||
mysqli_free_result($res);
|
||||
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) ||
|
||||
!mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT))
|
||||
printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test'))
|
||||
printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
else
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
$tmp = mysqli_thread_safe($link);
|
||||
$tmp = mysqli_thread_id($link);
|
||||
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) ||
|
||||
!mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT))
|
||||
printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
mysqli_close($link);
|
||||
print "done!";
|
||||
$tmp = mysqli_thread_id($link);
|
||||
|
||||
mysqli_close($link);
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli_multi_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'BAR; FOO' at line 1 in %s on line %d
|
||||
@@ -294,6 +323,18 @@ Warning: mysqli_prepare(): (%d/%d): You have an error in your SQL syntax; check
|
||||
|
||||
Warning: mysqli_real_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
||||
|
||||
Warning: mysqli_autocommit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
||||
|
||||
Warning: mysqli_commit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
||||
|
||||
Warning: mysqli_rollback(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
||||
|
||||
Warning: mysqli_stmt_prepare(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
|
||||
|
||||
Warning: mysqli_store_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
||||
|
||||
Warning: mysqli_stmt_attr_set(): (%s/%d): Not implemented in %s on line %d
|
||||
|
||||
Warning: mysqli_kill(): processid should have positive value in %s on line %d
|
||||
|
||||
Warning: mysqli_stmt_prepare(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
|
||||
|
||||
@@ -124,32 +124,77 @@ if (!function_exists('mysqli_stmt_get_result'))
|
||||
if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
|
||||
printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
|
||||
if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt)))
|
||||
printf("[036] Expecting array, got %s/%s, [%d] %s\n",
|
||||
gettype($tmp), var_export($tmp, 1),
|
||||
mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
// get_result cannot be used in PS cursor mode
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
|
||||
printf("[037] Expecting boolean/false, got %s/%s, [%d] %s\n",
|
||||
gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
|
||||
printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
printf("[038] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
printf("[039] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
var_dump($row);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
if (!mysqli_stmt_attr_set($stmt, MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY))
|
||||
printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
try {
|
||||
$res = mysqli_stmt_get_result($stmt);
|
||||
// we expect no segfault if we try to fetch a row because get_result should throw an error or return false
|
||||
mysqli_fetch_assoc($res);
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
$res = $stmt->get_result();
|
||||
// we expect no segfault if we try to fetch a row because get_result should throw an error or return false
|
||||
$res->fetch_assoc();
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
|
||||
if (!$stmt = mysqli_stmt_init($link))
|
||||
printf("[034] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
|
||||
printf("[035] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
if (!mysqli_stmt_execute($stmt))
|
||||
printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
$id = NULL;
|
||||
$label = NULL;
|
||||
if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
|
||||
printf("[037] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
|
||||
if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt)))
|
||||
printf("[038] Expecting array, got %s/%s, [%d] %s\n",
|
||||
gettype($tmp), var_export($tmp, 1),
|
||||
mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
|
||||
printf("[039] Expecting boolean/false, got %s/%s, [%d] %s\n",
|
||||
gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
|
||||
printf("[040] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
|
||||
printf("[041] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
var_dump($row);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
|
||||
if (!mysqli_kill($link, mysqli_thread_id($link)))
|
||||
printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
printf("[042] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
|
||||
if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
|
||||
printf("[041] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
printf("[043] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
|
||||
printf("[042] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
printf("[044] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
@@ -168,8 +213,10 @@ Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
|
||||
|
||||
Warning: mysqli_stmt_get_result(): invalid object or resource mysqli_stmt
|
||||
in %s on line %d
|
||||
[038] [2014] [Commands out of sync; you can't run this command now]
|
||||
[039] [0] []
|
||||
mysqli_stmt_get_result() cannot be used with cursors
|
||||
get_result() cannot be used with cursors
|
||||
[040] [2014] [Commands out of sync; you can't run this command now]
|
||||
[041] [0] []
|
||||
array(2) {
|
||||
["id"]=>
|
||||
int(1)
|
||||
|
||||
@@ -2134,23 +2134,16 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "WITH CONSISTENT SNAPSHOT", sizeof("WITH CONSISTENT SNAPSHOT") - 1);
|
||||
}
|
||||
if (mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY)) {
|
||||
zend_ulong server_version = conn->m->get_server_version(conn);
|
||||
if (server_version < 50605L) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
smart_str_free(&tmp_str);
|
||||
break;
|
||||
} else if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
if (mode & TRANS_START_READ_WRITE) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
|
||||
} else if (mode & TRANS_START_READ_ONLY) {
|
||||
if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
|
||||
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
|
||||
}
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
@@ -2169,6 +2162,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsi
|
||||
}
|
||||
ret = conn->m->query(conn, query, query_len);
|
||||
mnd_sprintf_free(query);
|
||||
if (ret && mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY) &&
|
||||
mysqlnd_stmt_errno(conn) == 1064) {
|
||||
php_error_docref(NULL, E_WARNING, "This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
conn->m->local_tx_end(conn, this_func, ret);
|
||||
|
||||
@@ -524,7 +524,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const
|
||||
if (i + 1 < mode_len && mode[i+1] == ',') {
|
||||
unsigned int j = i + 2;
|
||||
#ifdef PHP_WIN32
|
||||
if (i+4 < mode_len && mode[i+3] == ':' && (mode[i+4] == '\\' || mode[i+5] == '/')) {
|
||||
if (i+4 < mode_len && mode[i+3] == ':' && (mode[i+4] == '\\' || mode[i+4] == '/')) {
|
||||
j = i + 5;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -50,6 +50,57 @@ MYSQLND_METHOD(mysqlnd_pfc, reset)(MYSQLND_PFC * const pfc, MYSQLND_STATS * cons
|
||||
#define STORE_HEADER_SIZE(safe_storage, buffer) COPY_HEADER((safe_storage), (buffer))
|
||||
#define RESTORE_HEADER_SIZE(buffer, safe_storage) STORE_HEADER_SIZE((safe_storage), (buffer))
|
||||
|
||||
#ifdef MYSQLND_COMPRESSION_ENABLED
|
||||
static ssize_t write_compressed_packet(
|
||||
const MYSQLND_PFC *pfc, MYSQLND_VIO *vio,
|
||||
MYSQLND_STATS *conn_stats, MYSQLND_ERROR_INFO *error_info,
|
||||
zend_uchar *uncompressed_payload, size_t to_be_sent, zend_uchar *compress_buf) {
|
||||
DBG_ENTER("write_compressed_packet");
|
||||
/* here we need to compress the data and then write it, first comes the compressed header */
|
||||
size_t tmp_complen = to_be_sent;
|
||||
size_t payload_size;
|
||||
if (PASS == pfc->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tmp_complen,
|
||||
uncompressed_payload, to_be_sent))
|
||||
{
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent);
|
||||
payload_size = tmp_complen;
|
||||
} else {
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, 0);
|
||||
memcpy(compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, uncompressed_payload, to_be_sent);
|
||||
payload_size = to_be_sent;
|
||||
}
|
||||
|
||||
int3store(compress_buf, payload_size);
|
||||
int1store(compress_buf + 3, pfc->data->compressed_envelope_packet_no);
|
||||
DBG_INF_FMT("writing "MYSQLND_SZ_T_SPEC" bytes to the network", payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE);
|
||||
|
||||
ssize_t bytes_sent = vio->data->m.network_write(vio, compress_buf, payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, conn_stats, error_info);
|
||||
pfc->data->compressed_envelope_packet_no++;
|
||||
#ifdef WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY
|
||||
if (res == Z_OK) {
|
||||
size_t decompressed_size = left + MYSQLND_HEADER_SIZE;
|
||||
zend_uchar * decompressed_data = mnd_malloc(decompressed_size);
|
||||
int error = pfc->data->m.decode(decompressed_data, decompressed_size,
|
||||
compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
if (error == Z_OK) {
|
||||
int i;
|
||||
DBG_INF("success decompressing");
|
||||
for (i = 0 ; i < decompressed_size; i++) {
|
||||
if (i && (i % 30 == 0)) {
|
||||
printf("\n\t\t");
|
||||
}
|
||||
printf("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
DBG_INF_FMT("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
}
|
||||
} else {
|
||||
DBG_INF("error decompressing");
|
||||
}
|
||||
mnd_free(decompressed_data);
|
||||
}
|
||||
#endif /* WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY */
|
||||
DBG_RETURN(bytes_sent);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* {{{ mysqlnd_pfc::send */
|
||||
/*
|
||||
@@ -92,53 +143,27 @@ MYSQLND_METHOD(mysqlnd_pfc, send)(MYSQLND_PFC * const pfc, MYSQLND_VIO * const v
|
||||
DBG_INF_FMT("packet_no=%u", pfc->data->packet_no);
|
||||
#ifdef MYSQLND_COMPRESSION_ENABLED
|
||||
if (pfc->data->compressed == TRUE) {
|
||||
/* here we need to compress the data and then write it, first comes the compressed header */
|
||||
size_t tmp_complen = to_be_sent;
|
||||
size_t payload_size;
|
||||
zend_uchar * uncompressed_payload = p; /* should include the header */
|
||||
|
||||
STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
|
||||
int3store(uncompressed_payload, to_be_sent);
|
||||
int1store(uncompressed_payload + 3, pfc->data->packet_no);
|
||||
if (PASS == pfc->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tmp_complen,
|
||||
uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE))
|
||||
{
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent + MYSQLND_HEADER_SIZE);
|
||||
payload_size = tmp_complen;
|
||||
if (to_be_sent <= MYSQLND_MAX_PACKET_SIZE - MYSQLND_HEADER_SIZE) {
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE, compress_buf);
|
||||
} else {
|
||||
int3store(compress_buf + MYSQLND_HEADER_SIZE, 0);
|
||||
memcpy(compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE);
|
||||
payload_size = to_be_sent + MYSQLND_HEADER_SIZE;
|
||||
/* The uncompressed size including the header would overflow. Split into two
|
||||
* compressed packets. The size of the first one is relatively arbitrary here. */
|
||||
const size_t split_off_bytes = 8192;
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload, split_off_bytes, compress_buf);
|
||||
bytes_sent = write_compressed_packet(
|
||||
pfc, vio, conn_stats, error_info,
|
||||
uncompressed_payload + split_off_bytes,
|
||||
to_be_sent + MYSQLND_HEADER_SIZE - split_off_bytes, compress_buf);
|
||||
}
|
||||
RESTORE_HEADER_SIZE(uncompressed_payload, safe_storage);
|
||||
|
||||
int3store(compress_buf, payload_size);
|
||||
int1store(compress_buf + 3, pfc->data->packet_no);
|
||||
DBG_INF_FMT("writing "MYSQLND_SZ_T_SPEC" bytes to the network", payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE);
|
||||
bytes_sent = vio->data->m.network_write(vio, compress_buf, payload_size + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, conn_stats, error_info);
|
||||
pfc->data->compressed_envelope_packet_no++;
|
||||
#if WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY
|
||||
if (res == Z_OK) {
|
||||
size_t decompressed_size = left + MYSQLND_HEADER_SIZE;
|
||||
zend_uchar * decompressed_data = mnd_malloc(decompressed_size);
|
||||
int error = pfc->data->m.decode(decompressed_data, decompressed_size,
|
||||
compress_buf + MYSQLND_HEADER_SIZE + COMPRESSED_HEADER_SIZE, payload_size);
|
||||
if (error == Z_OK) {
|
||||
int i;
|
||||
DBG_INF("success decompressing");
|
||||
for (i = 0 ; i < decompressed_size; i++) {
|
||||
if (i && (i % 30 == 0)) {
|
||||
printf("\n\t\t");
|
||||
}
|
||||
printf("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
DBG_INF_FMT("%.2X ", (int)*((char*)&(decompressed_data[i])));
|
||||
}
|
||||
} else {
|
||||
DBG_INF("error decompressing");
|
||||
}
|
||||
mnd_free(decompressed_data);
|
||||
}
|
||||
#endif /* WHEN_WE_NEED_TO_CHECK_WHETHER_COMPRESSION_WORKS_CORRECTLY */
|
||||
} else
|
||||
#endif /* MYSQLND_COMPRESSION_ENABLED */
|
||||
{
|
||||
|
||||
@@ -121,9 +121,11 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
|
||||
stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED;
|
||||
} else {
|
||||
COPY_CLIENT_ERROR(conn->error_info, result->stored_data->error_info);
|
||||
COPY_CLIENT_ERROR(stmt->error_info, result->stored_data->error_info);
|
||||
stmt->result->m.free_result_contents(stmt->result);
|
||||
stmt->result = NULL;
|
||||
stmt->state = MYSQLND_STMT_PREPARED;
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
DBG_RETURN(result);
|
||||
@@ -151,13 +153,19 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s)
|
||||
}
|
||||
|
||||
if (stmt->cursor_exists) {
|
||||
/* Silently convert buffered to unbuffered, for now */
|
||||
DBG_RETURN(s->m->use_result(s));
|
||||
/* Prepared statement cursors are not supported as of yet */
|
||||
char * msg;
|
||||
mnd_sprintf(&msg, 0, "%s() cannot be used with cursors", get_active_function_name());
|
||||
SET_CLIENT_ERROR(stmt->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, msg);
|
||||
if (msg) {
|
||||
mnd_sprintf_free(msg);
|
||||
}
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
/* Nothing to store for UPSERT/LOAD DATA*/
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) {
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
SET_CLIENT_ERROR(stmt->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
|
||||
DBG_RETURN(NULL);
|
||||
}
|
||||
|
||||
@@ -178,7 +186,7 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((result = result->m.store_result(result, conn, MYSQLND_STORE_PS | MYSQLND_STORE_NO_COPY))) {
|
||||
if (result->m.store_result(result, conn, MYSQLND_STORE_PS | MYSQLND_STORE_NO_COPY)) {
|
||||
UPSERT_STATUS_SET_AFFECTED_ROWS(stmt->upsert_status, result->stored_data->row_count);
|
||||
stmt->state = MYSQLND_STMT_PREPARED;
|
||||
result->type = MYSQLND_RES_PS_BUF;
|
||||
@@ -409,6 +417,7 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
|
||||
|
||||
ret = conn->command->stmt_prepare(conn, query_string);
|
||||
if (FAIL == ret) {
|
||||
COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -881,9 +890,13 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi
|
||||
} else if (ret == FAIL) {
|
||||
if (row_packet->error_info.error_no) {
|
||||
COPY_CLIENT_ERROR(conn->error_info, row_packet->error_info);
|
||||
COPY_CLIENT_ERROR(stmt->error_info, row_packet->error_info);
|
||||
if (stmt) {
|
||||
COPY_CLIENT_ERROR(stmt->error_info, row_packet->error_info);
|
||||
}
|
||||
}
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_QUIT_SENT) {
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
}
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
|
||||
} else if (row_packet->eof) {
|
||||
DBG_INF("EOF");
|
||||
|
||||
@@ -743,7 +743,9 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi
|
||||
COPY_CLIENT_ERROR(conn->error_info, row_packet->error_info);
|
||||
DBG_ERR_FMT("errorno=%u error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
}
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_QUIT_SENT) {
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
}
|
||||
result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
|
||||
} else if (row_packet->eof) {
|
||||
/* Mark the connection as usable again */
|
||||
@@ -881,7 +883,9 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
|
||||
COPY_CLIENT_ERROR(conn->error_info, row_packet->error_info);
|
||||
DBG_ERR_FMT("errorno=%u error=%s", row_packet->error_info.error_no, row_packet->error_info.error);
|
||||
}
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
if (GET_CONNECTION_STATE(&conn->state) != CONN_QUIT_SENT) {
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_READY);
|
||||
}
|
||||
result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
|
||||
} else if (row_packet->eof) {
|
||||
/* Mark the connection as usable again */
|
||||
@@ -907,7 +911,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
|
||||
result->memory_pool->checkpoint = checkpoint;
|
||||
|
||||
DBG_INF_FMT("ret=%s fetched=%u", ret == PASS? "PASS":"FAIL", *fetched_anything);
|
||||
DBG_RETURN(PASS);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -1354,6 +1354,15 @@ premature_end:
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Like SET_CLIENT_ERROR, but for packet error_info. The type is the same,
|
||||
* but only some parts of it are used. */
|
||||
static void set_packet_error(
|
||||
MYSQLND_ERROR_INFO *info, unsigned err_no, const char *sqlstate, const char *error)
|
||||
{
|
||||
info->error_no = err_no;
|
||||
strlcpy(info->sqlstate, sqlstate, sizeof(info->sqlstate));
|
||||
strlcpy(info->error, error, sizeof(info->error));
|
||||
}
|
||||
|
||||
/* {{{ php_mysqlnd_read_row_ex */
|
||||
static enum_func_status
|
||||
@@ -1361,6 +1370,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
|
||||
MYSQLND_VIO * vio,
|
||||
MYSQLND_STATS * stats,
|
||||
MYSQLND_ERROR_INFO * error_info,
|
||||
MYSQLND_CONNECTION_STATE * connection_state,
|
||||
MYSQLND_MEMORY_POOL * pool,
|
||||
MYSQLND_ROW_BUFFER * buffer,
|
||||
size_t * const data_size)
|
||||
@@ -1389,6 +1399,8 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
|
||||
*data_size = 0;
|
||||
if (UNEXPECTED(FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info))) {
|
||||
ret = FAIL;
|
||||
SET_CONNECTION_STATE(connection_state, CONN_QUIT_SENT);
|
||||
set_packet_error(error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
|
||||
} else {
|
||||
*data_size += header.size;
|
||||
buffer->ptr = pool->get_chunk(pool, *data_size + prealloc_more_bytes);
|
||||
@@ -1396,7 +1408,8 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
|
||||
|
||||
if (UNEXPECTED(PASS != (ret = pfc->data->m.receive(pfc, vio, p, header.size, stats, error_info)))) {
|
||||
DBG_ERR("Empty row packet body");
|
||||
php_error(E_WARNING, "Empty row packet body");
|
||||
SET_CONNECTION_STATE(connection_state, CONN_QUIT_SENT);
|
||||
set_packet_error(error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
|
||||
} else {
|
||||
while (header.size >= MYSQLND_MAX_PACKET_SIZE) {
|
||||
if (FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info)) {
|
||||
@@ -1425,7 +1438,8 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
|
||||
|
||||
if (PASS != (ret = pfc->data->m.receive(pfc, vio, p, header.size, stats, error_info))) {
|
||||
DBG_ERR("Empty row packet body");
|
||||
php_error(E_WARNING, "Empty row packet body");
|
||||
SET_CONNECTION_STATE(connection_state, CONN_QUIT_SENT);
|
||||
set_packet_error(error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1720,8 +1734,8 @@ php_mysqlnd_rowp_read_text_protocol_c(MYSQLND_ROW_BUFFER * row_buffer, zval * fi
|
||||
static enum_func_status
|
||||
php_mysqlnd_rowp_read(MYSQLND_CONN_DATA * conn, void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_ROW *packet= (MYSQLND_PACKET_ROW *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = conn->error_info;
|
||||
MYSQLND_PACKET_ROW *packet = (MYSQLND_PACKET_ROW *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = &packet->error_info;
|
||||
MYSQLND_PFC * pfc = conn->protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = conn->vio;
|
||||
MYSQLND_STATS * stats = conn->stats;
|
||||
@@ -1731,7 +1745,7 @@ php_mysqlnd_rowp_read(MYSQLND_CONN_DATA * conn, void * _packet)
|
||||
|
||||
DBG_ENTER("php_mysqlnd_rowp_read");
|
||||
|
||||
ret = php_mysqlnd_read_row_ex(pfc, vio, stats, error_info,
|
||||
ret = php_mysqlnd_read_row_ex(pfc, vio, stats, error_info, &conn->state,
|
||||
packet->result_set_memory_pool, &packet->row_buffer, &data_size);
|
||||
if (FAIL == ret) {
|
||||
goto end;
|
||||
|
||||
+37
-17
@@ -1309,7 +1309,7 @@ PHP_FUNCTION(odbc_execute)
|
||||
int numArgs = ZEND_NUM_ARGS(), i, ne;
|
||||
RETCODE rc;
|
||||
|
||||
if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) {
|
||||
if (zend_parse_parameters(numArgs, "r|a/", &pv_res, &pv_param_arr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1808,6 +1808,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
|
||||
|
||||
if (rc == SQL_SUCCESS_WITH_INFO) {
|
||||
ZVAL_STRINGL(&tmp, buf, result->longreadlen);
|
||||
} else if (rc != SQL_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (retcode %u)", i + 1, rc);
|
||||
ZVAL_FALSE(&tmp);
|
||||
} else if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
@@ -1961,6 +1964,9 @@ PHP_FUNCTION(odbc_fetch_into)
|
||||
}
|
||||
if (rc == SQL_SUCCESS_WITH_INFO) {
|
||||
ZVAL_STRINGL(&tmp, buf, result->longreadlen);
|
||||
} else if (rc != SQL_SUCCESS) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (retcode %u)", i + 1, rc);
|
||||
ZVAL_FALSE(&tmp);
|
||||
} else if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
ZVAL_NULL(&tmp);
|
||||
break;
|
||||
@@ -2198,12 +2204,13 @@ PHP_FUNCTION(odbc_result)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
zend_string_efree(field_str);
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (retcode %u)", field_ind + 1, rc);
|
||||
RETURN_FALSE;
|
||||
} else if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
zend_string_efree(field_str);
|
||||
RETURN_NULL();
|
||||
} else if (rc == SQL_NO_DATA_FOUND) {
|
||||
zend_string_efree(field_str);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* Reduce fieldlen by 1 if we have char data. One day we might
|
||||
have binary strings... */
|
||||
@@ -2220,6 +2227,7 @@ PHP_FUNCTION(odbc_result)
|
||||
if (rc != SQL_SUCCESS_WITH_INFO) {
|
||||
field_str = zend_string_truncate(field_str, result->values[field_ind].vallen, 0);
|
||||
}
|
||||
ZSTR_VAL(field_str)[ZSTR_LEN(field_str)] = '\0';
|
||||
RETURN_NEW_STR(field_str);
|
||||
break;
|
||||
|
||||
@@ -2248,6 +2256,12 @@ PHP_FUNCTION(odbc_result)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (retcode %u)", field_ind + 1, rc);
|
||||
efree(field);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
|
||||
efree(field);
|
||||
RETURN_NULL();
|
||||
@@ -2357,6 +2371,11 @@ PHP_FUNCTION(odbc_result_all)
|
||||
}
|
||||
if (rc == SQL_SUCCESS_WITH_INFO) {
|
||||
PHPWRITE(buf, result->longreadlen);
|
||||
} else if (rc != SQL_SUCCESS) {
|
||||
php_printf("</td></tr></table>");
|
||||
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (retcode %u)", i + 1, rc);
|
||||
efree(buf);
|
||||
RETURN_FALSE;
|
||||
} else if (result->values[i].vallen == SQL_NULL_DATA) {
|
||||
php_printf("<td>NULL</td>");
|
||||
break;
|
||||
@@ -2771,6 +2790,7 @@ PHP_FUNCTION(odbc_next_result)
|
||||
}
|
||||
efree(result->values);
|
||||
result->values = NULL;
|
||||
result->numcols = 0;
|
||||
}
|
||||
|
||||
result->fetched = 0;
|
||||
@@ -3154,7 +3174,7 @@ PHP_FUNCTION(odbc_tables)
|
||||
type, SAFE_SQL_NTS(type));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTables");
|
||||
odbc_sql_error(conn, result->stmt, "SQLTables");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3225,7 +3245,7 @@ PHP_FUNCTION(odbc_columns)
|
||||
column, (SQLSMALLINT) column_len);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3290,7 +3310,7 @@ PHP_FUNCTION(odbc_columnprivileges)
|
||||
column, SAFE_SQL_NTS(column));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumnPrivileges");
|
||||
odbc_sql_error(conn, result->stmt, "SQLColumnPrivileges");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3370,7 +3390,7 @@ PHP_FUNCTION(odbc_foreignkeys)
|
||||
ftable, SAFE_SQL_NTS(ftable) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLForeignKeys");
|
||||
odbc_sql_error(conn, result->stmt, "SQLForeignKeys");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3432,7 +3452,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
|
||||
rc = SQLGetTypeInfo(result->stmt, data_type );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLGetTypeInfo");
|
||||
odbc_sql_error(conn, result->stmt, "SQLGetTypeInfo");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3494,7 +3514,7 @@ PHP_FUNCTION(odbc_primarykeys)
|
||||
table, SAFE_SQL_NTS(table) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLPrimaryKeys");
|
||||
odbc_sql_error(conn, result->stmt, "SQLPrimaryKeys");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3563,7 +3583,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
|
||||
col, SAFE_SQL_NTS(col) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedureColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLProcedureColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3631,7 +3651,7 @@ PHP_FUNCTION(odbc_procedures)
|
||||
proc, SAFE_SQL_NTS(proc) );
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedures");
|
||||
odbc_sql_error(conn, result->stmt, "SQLProcedures");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3667,7 +3687,7 @@ PHP_FUNCTION(odbc_specialcolumns)
|
||||
SQLUSMALLINT type, scope, nullable;
|
||||
RETCODE rc;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
|
||||
&name, &name_len, &vscope, &vnullable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -3704,7 +3724,7 @@ PHP_FUNCTION(odbc_specialcolumns)
|
||||
nullable);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLSpecialColumns");
|
||||
odbc_sql_error(conn, result->stmt, "SQLSpecialColumns");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3774,7 +3794,7 @@ PHP_FUNCTION(odbc_statistics)
|
||||
reserved);
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLStatistics");
|
||||
odbc_sql_error(conn, result->stmt, "SQLStatistics");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3837,7 +3857,7 @@ PHP_FUNCTION(odbc_tableprivileges)
|
||||
table, SAFE_SQL_NTS(table));
|
||||
|
||||
if (rc == SQL_ERROR) {
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTablePrivileges");
|
||||
odbc_sql_error(conn, result->stmt, "SQLTablePrivileges");
|
||||
efree(result);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Bug #44618 (Fetching may rely on uninitialized data)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . "/config.inc";
|
||||
$conn = odbc_connect($dsn, $user, $pass, SQL_CUR_USE_ODBC);
|
||||
|
||||
odbc_exec($conn, "CREATE TABLE bug44618(ID INT, real1 REAL, text1 TEXT)");
|
||||
odbc_exec($conn, "INSERT INTO bug44618 VALUES (1, 10.0199995, 'testing 1,2,3')");
|
||||
|
||||
$result = odbc_exec($conn, "SELECT * FROM bug44618");
|
||||
var_dump(odbc_fetch_array($result));
|
||||
$result = null;
|
||||
|
||||
$result = odbc_exec($conn, "SELECT * FROM bug44618");
|
||||
odbc_fetch_into($result, $array);
|
||||
var_dump($array);
|
||||
$result = null;
|
||||
|
||||
$result = odbc_exec($conn, "SELECT * FROM bug44618");
|
||||
odbc_fetch_row($result);
|
||||
var_dump(odbc_result($result, "text1"));
|
||||
$result = null;
|
||||
|
||||
$result = odbc_exec($conn, "SELECT * FROM bug44618");
|
||||
odbc_result_all($result);
|
||||
$result = null;
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include __DIR__ . "/config.inc";
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, "DROP TABLE bug44618");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: odbc_fetch_array(): Cannot get data of column #3 (retcode 100) in %s on line %d
|
||||
array(3) {
|
||||
["ID"]=>
|
||||
string(1) "1"
|
||||
["real1"]=>
|
||||
string(5) "10.02"
|
||||
["text1"]=>
|
||||
bool(false)
|
||||
}
|
||||
|
||||
Warning: odbc_fetch_into(): Cannot get data of column #3 (retcode 100) in %s on line %d
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "1"
|
||||
[1]=>
|
||||
string(5) "10.02"
|
||||
[2]=>
|
||||
bool(false)
|
||||
}
|
||||
|
||||
Warning: odbc_result(): Cannot get data of column #3 (retcode 100) in %s on line %d
|
||||
bool(false)
|
||||
<table><tr><th>ID</th><th>real1</th><th>text1</th></tr>
|
||||
<tr><td>1</td><td>10.02</td><td></td></tr></table>
|
||||
Warning: odbc_result_all(): Cannot get data of column #3 (retcode 100) in %s on line %d
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #46050 (odbc_next_result corrupts prepared resource)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__ . "/config.inc";
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
$stmt = odbc_prepare($conn, "SELECT 1");
|
||||
var_dump(odbc_execute($stmt));
|
||||
var_dump(odbc_fetch_array($stmt));
|
||||
var_dump(odbc_next_result($stmt));
|
||||
var_dump(odbc_execute($stmt));
|
||||
var_dump(odbc_fetch_array($stmt));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
array(1) {
|
||||
["1"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
bool(false)
|
||||
bool(true)
|
||||
array(1) {
|
||||
["1"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #78470 (odbc_specialcolumns() no longer accepts $nullable)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
var_dump(odbc_specialcolumns($conn, SQL_BEST_ROWID, '', '', '', SQL_SCOPE_CURROW, SQL_NO_NULLS));
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (odbc result)
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #80147 (BINARY strings may not be properly zero-terminated)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, "CREATE TABLE bug80147 (id INT, whatever VARBINARY(50))");
|
||||
odbc_exec($conn, "INSERT INTO bug80147 VALUES (1, CONVERT(VARBINARY(50), 'whatever'))");
|
||||
|
||||
$res = odbc_exec($conn, "SELECT * FROM bug80147");
|
||||
odbc_binmode($res, ODBC_BINMODE_RETURN);
|
||||
odbc_fetch_row($res);
|
||||
var_dump(odbc_result($res, 'whatever'));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, "DROP TABLE bug80147");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(8) "whatever"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #80152 (odbc_execute() moves internal pointer of $params)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn,"CREATE TABLE bug80152 (id INT, name CHAR(24))");
|
||||
$stmt = odbc_prepare($conn,"INSERT INTO bug80152 (id, name) VALUES (?, ?)");
|
||||
$params = [1, "John", "Lim"];
|
||||
var_dump(key($params));
|
||||
odbc_execute($stmt, $params);
|
||||
var_dump(key($params));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
odbc_exec($conn, "DROP TABLE bug80152");
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
@@ -1941,7 +1941,7 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
|
||||
|
||||
/* Eliminate NOPs */
|
||||
for (b = blocks; b < end; b++) {
|
||||
if (b->flags & ZEND_BB_REACHABLE) {
|
||||
if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
|
||||
strip_nops(op_array, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,8 +287,9 @@ int ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ext
|
||||
|
||||
/* Phis */
|
||||
FOREACH_PHI(phi) {
|
||||
int source;
|
||||
FOREACH_PHI_SOURCE(phi, source) {
|
||||
unsigned num_sources = NUM_PHI_SOURCES(phi);
|
||||
for (i = 0; i < num_sources; i++) {
|
||||
int source = phi->sources[i];
|
||||
if (source < 0) {
|
||||
FAIL(VARFMT " negative source\n", VAR(phi->ssa_var));
|
||||
}
|
||||
@@ -298,7 +299,16 @@ int ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ext
|
||||
if (ssa->vars[source].var != ssa->vars[phi->ssa_var].var) {
|
||||
FAIL(VARFMT " source of phi for " VARFMT "\n", VAR(source), VAR(phi->ssa_var));
|
||||
}
|
||||
} FOREACH_PHI_SOURCE_END();
|
||||
if (phi->use_chains[i]) {
|
||||
int j;
|
||||
for (j = i + 1; j < num_sources; j++) {
|
||||
if (phi->sources[j] == source && phi->use_chains[j]) {
|
||||
FAIL("use chain for source " VARFMT " of phi " VARFMT
|
||||
" at %d despite earlier use\n", VAR(source), VAR(phi->ssa_var), j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ssa->vars[phi->ssa_var].definition_phi != phi) {
|
||||
FAIL(VARFMT " does not define this phi\n", VAR(phi->ssa_var));
|
||||
}
|
||||
|
||||
@@ -2106,24 +2106,28 @@ static uint32_t assign_dim_result_type(
|
||||
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
|
||||
}
|
||||
if (tmp & MAY_BE_ARRAY) {
|
||||
if (value_type & MAY_BE_UNDEF) {
|
||||
tmp |= MAY_BE_ARRAY_OF_NULL;
|
||||
}
|
||||
if (dim_op_type == IS_UNUSED) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_LONG;
|
||||
} else {
|
||||
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_LONG;
|
||||
/* Only add key type if we have a value type. We want to maintain the invariant that a
|
||||
* key type exists iff a value type exists even in dead code that may use empty types. */
|
||||
if (value_type & (MAY_BE_ANY|MAY_BE_UNDEF)) {
|
||||
if (value_type & MAY_BE_UNDEF) {
|
||||
tmp |= MAY_BE_ARRAY_OF_NULL;
|
||||
}
|
||||
if (dim_type & MAY_BE_STRING) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_STRING;
|
||||
if (dim_op_type != IS_CONST) {
|
||||
// FIXME: numeric string
|
||||
if (dim_op_type == IS_UNUSED) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_LONG;
|
||||
} else {
|
||||
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_LONG;
|
||||
}
|
||||
}
|
||||
if (dim_type & (MAY_BE_UNDEF|MAY_BE_NULL)) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_STRING;
|
||||
if (dim_type & MAY_BE_STRING) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_STRING;
|
||||
if (dim_op_type != IS_CONST) {
|
||||
// FIXME: numeric string
|
||||
tmp |= MAY_BE_ARRAY_KEY_LONG;
|
||||
}
|
||||
}
|
||||
if (dim_type & (MAY_BE_UNDEF|MAY_BE_NULL)) {
|
||||
tmp |= MAY_BE_ARRAY_KEY_STRING;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Only add value type if we have a key type. It might be that the key type is illegal
|
||||
|
||||
@@ -906,6 +906,8 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args)
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "assert")) {
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "db2_execute")) {
|
||||
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
|
||||
} else if (zend_string_equals_literal(name, "func_num_args")) {
|
||||
return ZEND_FUNC_VARARG;
|
||||
} else if (zend_string_equals_literal(name, "func_get_arg")) {
|
||||
|
||||
@@ -1298,11 +1298,7 @@ static inline void zend_ssa_remove_phi_source(zend_ssa *ssa, zend_ssa_phi *phi,
|
||||
for (j = 0; j < predecessors_count; j++) {
|
||||
if (phi->sources[j] == var_num) {
|
||||
if (j < pred_offset) {
|
||||
if (next_phi == NULL) {
|
||||
next_phi = phi->use_chains[pred_offset];
|
||||
} else {
|
||||
ZEND_ASSERT(phi->use_chains[pred_offset] == NULL);
|
||||
}
|
||||
ZEND_ASSERT(next_phi == NULL);
|
||||
} else if (j >= pred_offset) {
|
||||
phi->use_chains[j] = next_phi;
|
||||
}
|
||||
@@ -1591,6 +1587,8 @@ void zend_ssa_rename_var_uses(zend_ssa *ssa, int old, int new, zend_bool update_
|
||||
new_var->phi_use_chain = phi;
|
||||
}
|
||||
after_first_new_source = 1;
|
||||
} else {
|
||||
phi->use_chains[j] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2576,7 +2576,9 @@ static int zend_accel_init_shm(void)
|
||||
if (ZCG(accel_directives).interned_strings_buffer) {
|
||||
accel_shared_globals = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024));
|
||||
} else {
|
||||
accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals));
|
||||
/* Make sure there is always at least one interned string hash slot,
|
||||
* so the table can be queried unconditionally. */
|
||||
accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals) + sizeof(uint32_t));
|
||||
}
|
||||
if (!accel_shared_globals) {
|
||||
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
|
||||
@@ -2617,6 +2619,8 @@ static int zend_accel_init_shm(void)
|
||||
STRTAB_INVALID_POS,
|
||||
(char*)ZCSG(interned_strings).start -
|
||||
((char*)&ZCSG(interned_strings) + sizeof(zend_string_table)));
|
||||
} else {
|
||||
*STRTAB_HASH_TO_SLOT(&ZCSG(interned_strings), 0) = STRTAB_INVALID_POS;
|
||||
}
|
||||
|
||||
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);
|
||||
@@ -4048,7 +4052,8 @@ static void preload_register_trait_methods(zend_class_entry *ce) {
|
||||
zend_op_array *op_array;
|
||||
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
|
||||
if (!(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
|
||||
zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array);
|
||||
ZEND_ASSERT(op_array->refcount && "Must have refcount pointer");
|
||||
zend_shared_alloc_register_xlat_entry(op_array->refcount, op_array);
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
@@ -4059,18 +4064,18 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
|
||||
if (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE) {
|
||||
zend_op_array *orig_op_array = zend_shared_alloc_get_xlat_entry(op_array->opcodes);
|
||||
if (orig_op_array) {
|
||||
zend_class_entry *scope = op_array->scope;
|
||||
uint32_t fn_flags = op_array->fn_flags;
|
||||
zend_function *prototype = op_array->prototype;
|
||||
HashTable *ht = op_array->static_variables;
|
||||
*op_array = *orig_op_array;
|
||||
op_array->scope = scope;
|
||||
op_array->fn_flags = fn_flags;
|
||||
op_array->prototype = prototype;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
zend_op_array *orig_op_array = zend_shared_alloc_get_xlat_entry(op_array->refcount);
|
||||
ZEND_ASSERT(orig_op_array && "Must be in xlat table");
|
||||
|
||||
zend_class_entry *scope = op_array->scope;
|
||||
uint32_t fn_flags = op_array->fn_flags;
|
||||
zend_function *prototype = op_array->prototype;
|
||||
HashTable *ht = op_array->static_variables;
|
||||
*op_array = *orig_op_array;
|
||||
op_array->scope = scope;
|
||||
op_array->fn_flags = fn_flags;
|
||||
op_array->prototype = prototype;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
@@ -4078,6 +4083,7 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
|
||||
static int preload_optimize(zend_persistent_script *script)
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
zend_persistent_script *tmp_script;
|
||||
|
||||
zend_shared_alloc_init_xlat_table();
|
||||
|
||||
@@ -4087,8 +4093,8 @@ static int preload_optimize(zend_persistent_script *script)
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
|
||||
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
|
||||
ZEND_HASH_FOREACH_PTR(preload_scripts, tmp_script) {
|
||||
ZEND_HASH_FOREACH_PTR(&tmp_script->script.class_table, ce) {
|
||||
if (ce->ce_flags & ZEND_ACC_TRAIT) {
|
||||
preload_register_trait_methods(ce);
|
||||
}
|
||||
@@ -4100,16 +4106,12 @@ static int preload_optimize(zend_persistent_script *script)
|
||||
}
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
|
||||
if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
|
||||
preload_fix_trait_methods(ce);
|
||||
}
|
||||
preload_fix_trait_methods(ce);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
|
||||
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
|
||||
if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
|
||||
preload_fix_trait_methods(ce);
|
||||
}
|
||||
preload_fix_trait_methods(ce);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Check that phi use chains are correctly maintained when removing blocks
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(array $adapters) {
|
||||
foreach ($adapters as $adapter) {
|
||||
if (\in_array('cli-server', ['cli', 'phpdbg'], true) && $adapter instanceof stdClass && !\filter_var('1', \FILTER_VALIDATE_BOOLEAN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$adapters[] = $adapter;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (1) {
|
||||
function f() {}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Defining a dynamic function inside the preload script
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/preload_dynamic_function.inc
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(function_exists("f"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
trait T1 {
|
||||
public function method() {
|
||||
// Needs to be optimized somehow.
|
||||
$str = "Foo";
|
||||
echo "$str\n";
|
||||
}
|
||||
}
|
||||
|
||||
trait T2 {}
|
||||
|
||||
class C1 {
|
||||
use T1;
|
||||
}
|
||||
|
||||
class C2 extends C1 {
|
||||
use T2;
|
||||
}
|
||||
|
||||
trait T3 {
|
||||
public function method() {
|
||||
// Prevent trivial inheritance.
|
||||
static $x;
|
||||
// Needs to be optimized somehow.
|
||||
$str = "Foo";
|
||||
echo "$str\n";
|
||||
}
|
||||
}
|
||||
class C3 {
|
||||
use T3;
|
||||
}
|
||||
class C4 extends C3 {}
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Op array fixed up multiple times during preloading
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/preload_trait_multiple_fixup.inc
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
(new C2)->method();
|
||||
(new C4)->method();
|
||||
?>
|
||||
--EXPECT--
|
||||
Foo
|
||||
Foo
|
||||
+33
-16
@@ -6484,6 +6484,8 @@ PHP_FUNCTION(openssl_digest)
|
||||
struct php_openssl_cipher_mode {
|
||||
zend_bool is_aead;
|
||||
zend_bool is_single_run_aead;
|
||||
zend_bool set_tag_length_always;
|
||||
zend_bool set_tag_length_when_encrypting;
|
||||
int aead_get_tag_flag;
|
||||
int aead_set_tag_flag;
|
||||
int aead_ivlen_flag;
|
||||
@@ -6491,27 +6493,43 @@ struct php_openssl_cipher_mode {
|
||||
|
||||
static void php_openssl_load_cipher_mode(struct php_openssl_cipher_mode *mode, const EVP_CIPHER *cipher_type) /* {{{ */
|
||||
{
|
||||
switch (EVP_CIPHER_mode(cipher_type)) {
|
||||
#ifdef EVP_CIPH_GCM_MODE
|
||||
int cipher_mode = EVP_CIPHER_mode(cipher_type);
|
||||
memset(mode, 0, sizeof(struct php_openssl_cipher_mode));
|
||||
switch (cipher_mode) {
|
||||
#if PHP_OPENSSL_API_VERSION >= 0x10100
|
||||
case EVP_CIPH_GCM_MODE:
|
||||
case EVP_CIPH_OCB_MODE:
|
||||
case EVP_CIPH_CCM_MODE:
|
||||
mode->is_aead = 1;
|
||||
/* For OCB mode, explicitly set the tag length even when decrypting,
|
||||
* see https://github.com/openssl/openssl/issues/8331. */
|
||||
mode->set_tag_length_always = cipher_mode == EVP_CIPH_OCB_MODE;
|
||||
mode->set_tag_length_when_encrypting = cipher_mode == EVP_CIPH_CCM_MODE;
|
||||
mode->is_single_run_aead = cipher_mode == EVP_CIPH_CCM_MODE;
|
||||
mode->aead_get_tag_flag = EVP_CTRL_AEAD_GET_TAG;
|
||||
mode->aead_set_tag_flag = EVP_CTRL_AEAD_SET_TAG;
|
||||
mode->aead_ivlen_flag = EVP_CTRL_AEAD_SET_IVLEN;
|
||||
break;
|
||||
#else
|
||||
# ifdef EVP_CIPH_GCM_MODE
|
||||
case EVP_CIPH_GCM_MODE:
|
||||
mode->is_aead = 1;
|
||||
mode->is_single_run_aead = 0;
|
||||
mode->aead_get_tag_flag = EVP_CTRL_GCM_GET_TAG;
|
||||
mode->aead_set_tag_flag = EVP_CTRL_GCM_SET_TAG;
|
||||
mode->aead_ivlen_flag = EVP_CTRL_GCM_SET_IVLEN;
|
||||
break;
|
||||
#endif
|
||||
#ifdef EVP_CIPH_CCM_MODE
|
||||
# endif
|
||||
# ifdef EVP_CIPH_CCM_MODE
|
||||
case EVP_CIPH_CCM_MODE:
|
||||
mode->is_aead = 1;
|
||||
mode->is_single_run_aead = 1;
|
||||
mode->set_tag_length_when_encrypting = 1;
|
||||
mode->aead_get_tag_flag = EVP_CTRL_CCM_GET_TAG;
|
||||
mode->aead_set_tag_flag = EVP_CTRL_CCM_SET_TAG;
|
||||
mode->aead_ivlen_flag = EVP_CTRL_CCM_SET_IVLEN;
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
default:
|
||||
memset(mode, 0, sizeof(struct php_openssl_cipher_mode));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -6521,11 +6539,6 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
|
||||
{
|
||||
char *iv_new;
|
||||
|
||||
/* Best case scenario, user behaved */
|
||||
if (*piv_len == iv_required_len) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (mode->is_aead) {
|
||||
if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_ivlen_flag, *piv_len, NULL) != 1) {
|
||||
php_error_docref(NULL, E_WARNING, "Setting of IV length for AEAD mode failed");
|
||||
@@ -6534,6 +6547,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) {
|
||||
@@ -6593,12 +6611,13 @@ static int php_openssl_cipher_init(const EVP_CIPHER *cipher_type,
|
||||
if (php_openssl_validate_iv(piv, piv_len, max_iv_len, free_iv, cipher_ctx, mode) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (mode->is_single_run_aead && enc) {
|
||||
if (mode->set_tag_length_always || (enc && mode->set_tag_length_when_encrypting)) {
|
||||
if (!EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, NULL)) {
|
||||
php_error_docref(NULL, E_WARNING, "Setting tag length for AEAD cipher failed");
|
||||
return FAILURE;
|
||||
}
|
||||
} else if (!enc && tag && tag_len > 0) {
|
||||
}
|
||||
if (!enc && tag && tag_len > 0) {
|
||||
if (!mode->is_aead) {
|
||||
php_error_docref(NULL, E_WARNING, "The tag cannot be used because the cipher method does not support AEAD");
|
||||
} else if (!EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_set_tag_flag, tag_len, (unsigned char *) tag)) {
|
||||
@@ -6744,8 +6763,6 @@ PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, ch
|
||||
}
|
||||
} else if (tag) {
|
||||
ZEND_TRY_ASSIGN_REF_NULL(tag);
|
||||
php_error_docref(NULL, E_WARNING,
|
||||
"The authenticated tag cannot be provided for cipher that doesn not support AEAD");
|
||||
} else if (mode.is_aead) {
|
||||
php_error_docref(NULL, E_WARNING, "A tag should be provided when using AEAD mode");
|
||||
zend_string_release_ex(outbuf, 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' .
|
||||
@@ -87,7 +108,58 @@ $php_openssl_cipher_tests = array(
|
||||
'01e4a9a4fba43c90ccdcb281d48c7c6f' .
|
||||
'd62875d2aca417034c34aee5',
|
||||
),
|
||||
)
|
||||
),
|
||||
// First few test vectors from RFC 7253.
|
||||
'aes-128-ocb' => array(
|
||||
array(
|
||||
'key' => '000102030405060708090A0B0C0D0E0F',
|
||||
'iv' => 'BBAA99887766554433221100',
|
||||
'aad' => '',
|
||||
'pt' => '',
|
||||
'tag' => '785407BFFFC8AD9EDCC5520AC9111EE6',
|
||||
'ct' => '',
|
||||
),
|
||||
array(
|
||||
'key' => '000102030405060708090A0B0C0D0E0F',
|
||||
'iv' => 'BBAA99887766554433221101',
|
||||
'aad' => '0001020304050607',
|
||||
'pt' => '0001020304050607',
|
||||
'tag' => '5725BDA0D3B4EB3A257C9AF1F8F03009',
|
||||
'ct' => '6820B3657B6F615A',
|
||||
),
|
||||
array(
|
||||
'key' => '000102030405060708090A0B0C0D0E0F',
|
||||
'iv' => 'BBAA99887766554433221102',
|
||||
'aad' => '0001020304050607',
|
||||
'pt' => '',
|
||||
'tag' => '81017F8203F081277152FADE694A0A00',
|
||||
'ct' => '',
|
||||
),
|
||||
array(
|
||||
'key' => '000102030405060708090A0B0C0D0E0F',
|
||||
'iv' => 'BBAA99887766554433221103',
|
||||
'aad' => '',
|
||||
'pt' => '0001020304050607',
|
||||
'tag' => '14054CD1F35D82760B2CD00D2F99BFA9',
|
||||
'ct' => '45DD69F8F5AAE724',
|
||||
),
|
||||
array(
|
||||
'key' => '000102030405060708090A0B0C0D0E0F',
|
||||
'iv' => 'BBAA99887766554433221104',
|
||||
'aad' => '000102030405060708090A0B0C0D0E0F',
|
||||
'pt' => '000102030405060708090A0B0C0D0E0F',
|
||||
'tag' => '3AD7A4FF3835B8C5701C1CCEC8FC3358',
|
||||
'ct' => '571D535B60B277188BE5147170A9A22C',
|
||||
),
|
||||
array(
|
||||
'key' => '0F0E0D0C0B0A09080706050403020100',
|
||||
'iv' => 'BBAA9988776655443322110D',
|
||||
'aad' => '000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627',
|
||||
'pt' => '000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627',
|
||||
'tag' => 'D0C515F4D1CDD4FDAC4F02AA',
|
||||
'ct' => '1792A4E31E0755FB03E31B22116E6C2DDF9EFD6E33D536F1A0124B0A55BAE884ED93481529C76B6A',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
function openssl_get_cipher_tests($method)
|
||||
|
||||
Loaded 100 of 203 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user