mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 08:26:38 +00:00
Compare commits
310
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6bc51a449 | ||
|
|
78c931a55f | ||
|
|
9855bd6414 | ||
|
|
161b672b88 | ||
|
|
ee87db285f | ||
|
|
095a30e11b | ||
|
|
e111ef5626 | ||
|
|
2870178720 | ||
|
|
d207d6a57f | ||
|
|
cc69950b15 | ||
|
|
ce66492a13 | ||
|
|
ed7e3bc70a | ||
|
|
a96ca13963 | ||
|
|
40bd84d3e3 | ||
|
|
033dac7a6f | ||
|
|
2a181b5ea0 | ||
|
|
38d97557da | ||
|
|
c20a97df6d | ||
|
|
2139c2c2de | ||
|
|
33eb30274f | ||
|
|
99fdf5916e | ||
|
|
2073e96ec5 | ||
|
|
9e54d9d692 | ||
|
|
ca618a4f10 | ||
|
|
0510b47894 | ||
|
|
e5b27b9916 | ||
|
|
1ba3314335 | ||
|
|
b494d94f16 | ||
|
|
dfc2e3a2ac | ||
|
|
d011da9d1a | ||
|
|
c4106d4569 | ||
|
|
1127163996 | ||
|
|
b52c4fcbcd | ||
|
|
e069b0beba | ||
|
|
ebd5f56442 | ||
|
|
a536d6d61b | ||
|
|
4e92cd172a | ||
|
|
bddf8140e4 | ||
|
|
f151e048ed | ||
|
|
b73a108543 | ||
|
|
289cb0f77c | ||
|
|
3462efa386 | ||
|
|
1baeae4270 | ||
|
|
8efd3c3387 | ||
|
|
0f8c1ee76d | ||
|
|
dee191ee07 | ||
|
|
141072a838 | ||
|
|
f28aeaee05 | ||
|
|
99fe18503a | ||
|
|
77ced46dea | ||
|
|
236ae06e0b | ||
|
|
9443c61928 | ||
|
|
cc7b000d2c | ||
|
|
cc266045a5 | ||
|
|
98102648cb | ||
|
|
a766f65ca3 | ||
|
|
c23736216d | ||
|
|
9026562c79 | ||
|
|
ebb590b625 | ||
|
|
08f08858f3 | ||
|
|
474292c3e4 | ||
|
|
a820aab9da | ||
|
|
a6e8c73c43 | ||
|
|
2c43fb49d6 | ||
|
|
545a29d0cb | ||
|
|
ad790bea2e | ||
|
|
77a841db48 | ||
|
|
5d0d812a53 | ||
|
|
47fb17b108 | ||
|
|
d207fd449c | ||
|
|
1ae888d984 | ||
|
|
ea24847620 | ||
|
|
d85651d58d | ||
|
|
246cb03e26 | ||
|
|
3847a6fcb6 | ||
|
|
137f22ad36 | ||
|
|
268e801cb1 | ||
|
|
f3dc67b255 | ||
|
|
791f07e4f0 | ||
|
|
e5ef7cbe87 | ||
|
|
8bf21adb8c | ||
|
|
9bbb9e537c | ||
|
|
c97b8bbf82 | ||
|
|
3a236d0587 | ||
|
|
787593b708 | ||
|
|
09bb2527e9 | ||
|
|
c793885b76 | ||
|
|
26a33a96fa | ||
|
|
f8258325b4 | ||
|
|
39d668e927 | ||
|
|
a72bab1b9a | ||
|
|
ae163d9a36 | ||
|
|
1118fca75d | ||
|
|
0f1726e45d | ||
|
|
9b0df97a42 | ||
|
|
34deda13a8 | ||
|
|
2eb6a541a9 | ||
|
|
e2285eb542 | ||
|
|
ae04110032 | ||
|
|
deb1bad80f | ||
|
|
962706d16c | ||
|
|
15ad5d31d1 | ||
|
|
ef274e0b60 | ||
|
|
fb09f1341f | ||
|
|
486f18f09e | ||
|
|
cb97fd3097 | ||
|
|
00c0d7702c | ||
|
|
bf5a802f5a | ||
|
|
c5276ad380 | ||
|
|
f6430e3fe2 | ||
|
|
e835916f65 | ||
|
|
88b5df91f6 | ||
|
|
b35f45ded2 | ||
|
|
19b4fa17d3 | ||
|
|
809a7b5f8f | ||
|
|
5d7f9dcca7 | ||
|
|
1f6b842af4 | ||
|
|
7b98d056d3 | ||
|
|
3521661bd1 | ||
|
|
d1b1866a3a | ||
|
|
2458dab466 | ||
|
|
6b5597f7d8 | ||
|
|
096fd88dcb | ||
|
|
5af0db88fa | ||
|
|
14b22704c7 | ||
|
|
701460ba84 | ||
|
|
ed9d1b708b | ||
|
|
4a4c72a82a | ||
|
|
1f726c9925 | ||
|
|
d95ee27551 | ||
|
|
77bd405959 | ||
|
|
b20bcbc363 | ||
|
|
3c42f64e6e | ||
|
|
e62c6e7dbe | ||
|
|
939e1095f2 | ||
|
|
6531719da5 | ||
|
|
011be49dda | ||
|
|
bcf2e10ae7 | ||
|
|
44f4d2be01 | ||
|
|
69dee5c732 | ||
|
|
61a4fc4e44 | ||
|
|
5dd1ef90ca | ||
|
|
13e9a471d7 | ||
|
|
f31ba7cb53 | ||
|
|
dad8bd5851 | ||
|
|
11507c0e1b | ||
|
|
d04a1e8d70 | ||
|
|
e77077edeb | ||
|
|
dd622f9ca9 | ||
|
|
bc58ba750f | ||
|
|
ea592e6b6c | ||
|
|
827cb0484e | ||
|
|
87cb883563 | ||
|
|
62554efffe | ||
|
|
5f1190684f | ||
|
|
7212829435 | ||
|
|
eb2a3c6c65 | ||
|
|
075e685439 | ||
|
|
7dcfa839c9 | ||
|
|
3d7284d09e | ||
|
|
6c9db02ff7 | ||
|
|
bca6d373fc | ||
|
|
66badcdc0c | ||
|
|
3fdde65617 | ||
|
|
e029019275 | ||
|
|
ad52ec3db8 | ||
|
|
695b8192c7 | ||
|
|
f9d1d1f36f | ||
|
|
e9b8193b24 | ||
|
|
0bafb530d6 | ||
|
|
f96df64cb2 | ||
|
|
04db3d0f7a | ||
|
|
d6e81f0bfd | ||
|
|
917222f395 | ||
|
|
951e29f66e | ||
|
|
5fbb0988d1 | ||
|
|
73bf238507 | ||
|
|
d5ee654b71 | ||
|
|
5bf8032112 | ||
|
|
97a8483143 | ||
|
|
4455899a93 | ||
|
|
34fb42970a | ||
|
|
974c46b89b | ||
|
|
a422b1e60c | ||
|
|
be11b354f4 | ||
|
|
a9d00be024 | ||
|
|
dc461d6f56 | ||
|
|
8f221bdec0 | ||
|
|
a231860b02 | ||
|
|
68c3d09c2c | ||
|
|
1c8c06a403 | ||
|
|
bc6ddb7f45 | ||
|
|
364fad275e | ||
|
|
5681f6523b | ||
|
|
a8a1dc038c | ||
|
|
aebbf38df5 | ||
|
|
83626ef97a | ||
|
|
6fc405e851 | ||
|
|
589f8107e8 | ||
|
|
f7b431fb30 | ||
|
|
6043a2d6f7 | ||
|
|
b027071688 | ||
|
|
33382dc7ee | ||
|
|
798e707eb3 | ||
|
|
d6bc266ba0 | ||
|
|
e470068293 | ||
|
|
b2429259af | ||
|
|
a8422edced | ||
|
|
ee0ca6470d | ||
|
|
c8ab9e1e53 | ||
|
|
11e36411c1 | ||
|
|
2d9836a579 | ||
|
|
1228f31cd2 | ||
|
|
9b8d8cac04 | ||
|
|
cbee239262 | ||
|
|
683635dff6 | ||
|
|
4dedccd8e2 | ||
|
|
398204ace9 | ||
|
|
ad787626a4 | ||
|
|
41aa83f0c2 | ||
|
|
d21612401f | ||
|
|
6c3b70e9a5 | ||
|
|
1a25137a69 | ||
|
|
348b5eb434 | ||
|
|
d057d767cc | ||
|
|
8ad44700cf | ||
|
|
ea642026eb | ||
|
|
637e47a5ed | ||
|
|
538ff93876 | ||
|
|
54ca2e7f8c | ||
|
|
b00a5c03e6 | ||
|
|
b0def5bde9 | ||
|
|
6b85926104 | ||
|
|
e01d0387d1 | ||
|
|
f59b201f19 | ||
|
|
3fe2e2a372 | ||
|
|
5b3e1ded35 | ||
|
|
afc3f6e8d5 | ||
|
|
3139be0bea | ||
|
|
7ba70a5fed | ||
|
|
d3ae4fe2d2 | ||
|
|
beab622265 | ||
|
|
35713efa02 | ||
|
|
d990b9316a | ||
|
|
7f090ac16a | ||
|
|
643c9c9b47 | ||
|
|
a0d8cedd2b | ||
|
|
df4d0a73d2 | ||
|
|
f8c1ce18e9 | ||
|
|
c547c1b980 | ||
|
|
c6ce03e45e | ||
|
|
4c083e7a66 | ||
|
|
6738d19fb8 | ||
|
|
2c602be7c8 | ||
|
|
279ba58edb | ||
|
|
972c4869a7 | ||
|
|
2513da4b4c | ||
|
|
b3fff5fc41 | ||
|
|
435e812c09 | ||
|
|
7c852a7961 | ||
|
|
98ef183ed0 | ||
|
|
8677edb2dd | ||
|
|
029a60b2c7 | ||
|
|
127273327b | ||
|
|
5ac5f313bd | ||
|
|
fe3d53f443 | ||
|
|
42344cdc53 | ||
|
|
d8f2e1a511 | ||
|
|
4b42056042 | ||
|
|
090fef553d | ||
|
|
6e5287bb95 | ||
|
|
befdc10c32 | ||
|
|
31c3646757 | ||
|
|
1df43a086f | ||
|
|
919ead1157 | ||
|
|
3070883bcf | ||
|
|
4371af3e19 | ||
|
|
4c06d929c0 | ||
|
|
95ee9efa57 | ||
|
|
5a18d7a0df | ||
|
|
ee76a5ae5a | ||
|
|
58b0003975 | ||
|
|
a4c55eefd0 | ||
|
|
6e64aba47f | ||
|
|
e2dcf3cc54 | ||
|
|
8dca5ae5ec | ||
|
|
49782c5499 | ||
|
|
06d309fd7a | ||
|
|
83e7618f05 | ||
|
|
ff83c00715 | ||
|
|
b4e4788c44 | ||
|
|
98e43a33c8 | ||
|
|
2ef8809ef3 | ||
|
|
ac732d75bd | ||
|
|
9090a21de0 | ||
|
|
b8aec1e725 | ||
|
|
4e407b8777 | ||
|
|
4302c0b542 | ||
|
|
4ea7f3467d | ||
|
|
3770c2e463 | ||
|
|
bb79e5764b | ||
|
|
281a1754b9 | ||
|
|
9f4905fb0d | ||
|
|
5fe6d2134b | ||
|
|
ab68d90057 | ||
|
|
ab200bd660 | ||
|
|
68296c4055 | ||
|
|
9322b43d65 | ||
|
|
0d87a0ba57 | ||
|
|
36239fee36 |
No files matched your search
+1
-7
@@ -8,12 +8,6 @@ branches:
|
||||
- PHP-5.6
|
||||
- PHP-7.0
|
||||
|
||||
skip_commits:
|
||||
files:
|
||||
- NEWS
|
||||
- UPGRADING*
|
||||
- README.*
|
||||
|
||||
clone_depth: 64
|
||||
|
||||
cache:
|
||||
@@ -23,7 +17,7 @@ environment:
|
||||
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: c:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.3
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.7
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
@@ -16,9 +16,11 @@ define ____executor_globals
|
||||
end
|
||||
set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
|
||||
set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
|
||||
set $eg_ptr = $eg
|
||||
else
|
||||
set $eg = executor_globals
|
||||
set $cg = compiler_globals
|
||||
set $eg_ptr = (zend_executor_globals*) &executor_globals
|
||||
end
|
||||
end
|
||||
|
||||
@@ -289,6 +291,16 @@ define ____printzv
|
||||
end
|
||||
end
|
||||
|
||||
define print_global_vars
|
||||
____executor_globals
|
||||
set $symtable = ((HashTable *)&($eg_ptr->symbol_table))
|
||||
print_ht $symtable
|
||||
end
|
||||
|
||||
document print_global_vars
|
||||
Prints the global variables
|
||||
end
|
||||
|
||||
define print_const_table
|
||||
set $ind = 1
|
||||
printf "[%p] {\n", $arg0
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
dist: trusty
|
||||
language: c
|
||||
sudo: false
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -50,6 +50,8 @@ before_script:
|
||||
- ccache --version
|
||||
- ccache --zero-stats
|
||||
- export USE_CCACHE=1
|
||||
# Enable IPv6
|
||||
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
# Setup Extensions
|
||||
|
||||
@@ -1,6 +1,154 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2018, PHP 7.2.5
|
||||
16 Aug 2018, PHP 7.2.9
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
|
||||
(cmb)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
|
||||
(ZiHang Gao)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis)
|
||||
|
||||
- PDO_PgSQL:
|
||||
. Fixed bug #75402 (Possible Memory Leak using PDO::CURSOR_SCROLL option).
|
||||
(Anatol)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle).
|
||||
(cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
|
||||
. Fixed bug #68553 (array_column: null values in $index_key become incrementing
|
||||
keys in result). (Laruence)
|
||||
. Fixed bug #76643 (Segmentation fault when using `output_add_rewrite_var`).
|
||||
(cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
|
||||
(Timur Ibragimov)
|
||||
|
||||
19 Jul 2018, PHP 7.2.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
|
||||
with an error handler). (Laruence)
|
||||
. Fixed bug #76520 (Object creation leaks memory when executed over HTTP).
|
||||
(Nikita)
|
||||
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
|
||||
properly). (Nikita)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #76409 (heap use after free in _php_stream_free). (cmb)
|
||||
. Fixed bug #76423 (Int Overflow lead to Heap OverFlow in
|
||||
exif_thumbnail_extract of exif.c). (Stas)
|
||||
. Fixed bug #76557 (heap-buffer-overflow (READ of size 48) while reading exif
|
||||
data). (Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
|
||||
non-blocking). (Nikita)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #74670 (Integer Underflow when unserializing GMP and possible
|
||||
other classes). (Nikita)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
|
||||
type). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #76532 (Integer overflow and excessive memory usage
|
||||
in mb_strimwidth). (MarcusSchwarz)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76477 (Opcache causes empty return value).
|
||||
(Nikita, Laruence)
|
||||
|
||||
- PGSQL:
|
||||
. Fixed bug #76548 (pg_fetch_result did not fetch the next row). (Anatol)
|
||||
|
||||
- phpdbg:
|
||||
. Fix arginfo wrt. optional/required parameters. (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
|
||||
error handler). (Laruence)
|
||||
. Fixed bug #75231 (ReflectionProperty#getValue() incorrectly works with
|
||||
inherited classes). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
|
||||
(Laruence)
|
||||
. Fixed bug #71848 (getimagesize with $imageinfo returns false). (cmb)
|
||||
|
||||
- Win32:
|
||||
. Fixed bug #76459 (windows linkinfo lacks openbasedir check). (Anatol)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).
|
||||
(Dennis Birkholz, Remi)
|
||||
|
||||
07 Jun 2018, PHP 7.2.7
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76337 (segfault when opcache enabled + extension use
|
||||
zend_register_class_alias). (xKhorasan)
|
||||
|
||||
- CLI Server:
|
||||
. Fixed bug #76333 (PHP built-in server does not find files if root path
|
||||
contains special characters). (Anatol)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #76296 (openssl_pkey_get_public does not respect open_basedir).
|
||||
(Erik Lax, Jakub Zelenka)
|
||||
. Fixed bug #76174 (openssl extension fails to build with LibreSSL 2.7).
|
||||
(Jakub Zelenka)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #76367 (NoRewindIterator segfault 11). (Laruence)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76410 (SIGV in zend_mm_alloc_small). (Laruence)
|
||||
. Fixed bug #76335 ("link(): Bad file descriptor" with non-ASCII path).
|
||||
(Anatol)
|
||||
|
||||
24 May 2018, PHP 7.2.6
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #76164 (exif_read_data zend_mm_heap corrupted). (cmb)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #76075 --with-fpm-acl wrongly tries to find libacl on FreeBSD.
|
||||
(mgorny)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #74385 (Locale::parseLocale() broken with some arguments).
|
||||
(Anatol)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76205 (PHP-FPM sporadic crash when running Infinitewp). (Dmitry)
|
||||
. Fixed bug #76275 (Assertion failure in file cache when unserializing empty
|
||||
try_catch_array). (Nikita)
|
||||
. Fixed bug #76281 (Opcache causes incorrect "undefined variable" errors).
|
||||
(Nikita)
|
||||
|
||||
- Reflection:
|
||||
. Fixed arginfo of array_replace(_recursive) and array_merge(_recursive).
|
||||
(carusogabriel)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #74892 (Url Rewriting (trans_sid) not working on urls that start
|
||||
with "#"). (Andrew Nester)
|
||||
|
||||
26 Apr 2018, PHP 7.2.5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75722 (Convert valgrind detection to configure option).
|
||||
@@ -9,6 +157,10 @@ PHP NEWS
|
||||
- Date:
|
||||
. Fixed bug #76131 (mismatch arginfo for date_create). (carusogabriel)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #76130 (Heap Buffer Overflow (READ: 1786) in exif_iif_add_value).
|
||||
(Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #68440 (ERROR: failed to reload: execvp() failed: Argument list
|
||||
too long). (Jacob Hipps)
|
||||
@@ -18,9 +170,16 @@ PHP NEWS
|
||||
. Fixed bug #52070 (imagedashedline() - dashed line sometimes is not visible).
|
||||
(cmb)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #76249 (stream filter convert.iconv leads to infinite loop on
|
||||
invalid sequence). (Stas)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #76153 (Intl compilation fails with icu4c 61.1). (Anatol)
|
||||
|
||||
- ldap:
|
||||
. Fixed bug #76248 (Malicious LDAP-Server Response causes Crash). (Stas)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
|
||||
. Fixed bug #76113 (mbstring does not build with Oniguruma 6.8.1).
|
||||
@@ -33,6 +192,9 @@ PHP NEWS
|
||||
- Opcache:
|
||||
. Fixed bug #76094 (Access violation when using opcache). (Laruence)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #76129 (fix for CVE-2018-5712 may not be complete). (Stas)
|
||||
|
||||
- phpdbg:
|
||||
. Fixed bug #76143 (Memory corruption: arbitrary NUL overwrite). (Laruence)
|
||||
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
|
||||
@@ -20,7 +20,7 @@ assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = "aaa";
|
||||
@@ -161,7 +161,7 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = 'aaa';
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug 76337: segmentation fault when an extension use zend_register_class_alias() and opcache enabled
|
||||
--SKIPIF--
|
||||
<?php if (!class_exists('_ZendTestClass') || !extension_loaded('Zend OPcache')) die('skip');
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(class_exists('_ZendTestClassAlias'));
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #76383: array_map on $GLOBALS returns IS_INDIRECT
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
array_map(function($x) use (&$lastval) { $lastval = $x; }, $GLOBALS);
|
||||
var_dump(gettype($lastval), $lastval); // will contain $a
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(7) "integer"
|
||||
int(1)
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #76502: Chain of mixed exceptions and errors does not serialize properly
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$examples = [
|
||||
"Exception(Exception())" => new Exception("outer", 0, new Exception("inner")),
|
||||
"Error(Error())" => new Error("outer", 0, new Error("inner")),
|
||||
"Error(Exception())" => new Error("outer", 0, new Exception("inner")),
|
||||
"Exception(Error())" => new Exception("outer", 0, new Error("inner"))
|
||||
];
|
||||
|
||||
foreach ($examples as $name => $example) {
|
||||
$processed = unserialize(serialize($example));
|
||||
$processedPrev = $processed->getPrevious();
|
||||
echo "---- $name ----\n";
|
||||
echo "before: ", get_class($example), ".previous == ",
|
||||
get_class($example->getPrevious()), "\n";
|
||||
echo "after : ", get_class($processed), ".previous == ",
|
||||
$processedPrev ? get_class($processedPrev) : "null", "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
---- Exception(Exception()) ----
|
||||
before: Exception.previous == Exception
|
||||
after : Exception.previous == Exception
|
||||
---- Error(Error()) ----
|
||||
before: Error.previous == Error
|
||||
after : Error.previous == Error
|
||||
---- Error(Exception()) ----
|
||||
before: Error.previous == Exception
|
||||
after : Error.previous == Exception
|
||||
---- Exception(Error()) ----
|
||||
before: Exception.previous == Error
|
||||
after : Exception.previous == Error
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler)
|
||||
--FILE--
|
||||
<?php
|
||||
set_error_handler(function ($severity, $message, $file, $line) {
|
||||
throw new \Exception($message);
|
||||
});
|
||||
|
||||
$x = "foo";
|
||||
$y = &$x["bar"];
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
|
||||
Stack trace:
|
||||
#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array)
|
||||
#1 {main}
|
||||
thrown in %sbug76534.php on line %d
|
||||
@@ -2785,6 +2785,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen
|
||||
|
||||
zend_assert_valid_class_name(lcname);
|
||||
|
||||
lcname = zend_new_interned_string(lcname);
|
||||
ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
|
||||
zend_string_release(lcname);
|
||||
if (ce) {
|
||||
@@ -2871,6 +2872,7 @@ ZEND_API int zend_disable_class(char *class_name, size_t class_name_length) /* {
|
||||
key = zend_string_alloc(class_name_length, 0);
|
||||
zend_str_tolower_copy(ZSTR_VAL(key), class_name, class_name_length);
|
||||
disabled_class = zend_hash_find_ptr(CG(class_table), key);
|
||||
zend_string_release(key);
|
||||
if (!disabled_class) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
+8
-1
@@ -195,7 +195,14 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
|
||||
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
|
||||
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
|
||||
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
|
||||
#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
|
||||
#define pefree_size(ptr, size, persistent) do { \
|
||||
if (persistent) { \
|
||||
free(ptr); \
|
||||
} else { \
|
||||
efree_size(ptr, size);\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
|
||||
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
|
||||
#define perealloc2(ptr, size, copy_size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc2((ptr), (size), (copy_size)))
|
||||
|
||||
@@ -1076,6 +1076,9 @@ tail_call:
|
||||
zend_ast_export_ex(str, decl->child[1], 0, indent);
|
||||
if (decl->child[3]) {
|
||||
smart_str_appends(str, ": ");
|
||||
if (decl->child[3]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, decl->child[3], 0, indent);
|
||||
}
|
||||
if (decl->child[2]) {
|
||||
@@ -1610,6 +1613,9 @@ simple_list:
|
||||
break;
|
||||
case ZEND_AST_PARAM:
|
||||
if (ast->child[0]) {
|
||||
if (ast->child[0]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, ast->child[0], 0, indent);
|
||||
smart_str_appendc(str, ' ');
|
||||
}
|
||||
|
||||
+2
-2
@@ -968,8 +968,8 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
|
||||
#define ZEND_RETURNS_FUNCTION 1<<0
|
||||
#define ZEND_RETURNS_VALUE 1<<1
|
||||
#define ZEND_RETURNS_FUNCTION (1<<0)
|
||||
#define ZEND_RETURNS_VALUE (1<<1)
|
||||
|
||||
#define ZEND_ARRAY_ELEMENT_REF (1<<0)
|
||||
#define ZEND_ARRAY_NOT_PACKED (1<<1)
|
||||
|
||||
@@ -323,7 +323,7 @@ ZEND_METHOD(exception, __wakeup)
|
||||
CHECK_EXC_TYPE(ZEND_STR_TRACE, IS_ARRAY);
|
||||
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
|
||||
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), zend_ce_throwable) ||
|
||||
pvalue == object)) {
|
||||
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
|
||||
}
|
||||
|
||||
+9
-4
@@ -990,9 +990,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
zend_class_entry *ce = NULL;
|
||||
void *dummy_cache_slot = NULL;
|
||||
|
||||
if (UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
|
||||
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
|
||||
@@ -1651,7 +1654,9 @@ fetch_from_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
ZVAL_ERROR(result);
|
||||
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
|
||||
@@ -142,6 +142,7 @@ void init_executor(void) /* {{{ */
|
||||
EG(in_autoload) = NULL;
|
||||
EG(autoload_func) = NULL;
|
||||
EG(error_handling) = EH_NORMAL;
|
||||
EG(flags) = EG_FLAGS_INITIAL;
|
||||
|
||||
zend_vm_stack_init();
|
||||
|
||||
|
||||
+3
-1
@@ -916,7 +916,9 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
+24
-8
@@ -17661,7 +17661,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -20685,7 +20687,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -21999,7 +22003,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -24605,7 +24611,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -35400,7 +35408,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -39558,7 +39568,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -41917,7 +41929,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -45591,7 +45605,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
+5
-5
@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=5
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -6,6 +6,11 @@ if(!extension_loaded("bcmath")) print "skip";
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip valid only for windows');
|
||||
}
|
||||
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
|
||||
$req = "10.0.17134";
|
||||
if (version_compare($cur, $req) >= 0) {
|
||||
echo "skip Only for Windows systems < $req";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -14,5 +19,4 @@ var_dump(bcpowmod(1, 1.2, 1, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
string(3) "0.0"
|
||||
bc math warning: non-zero scale in exponent
|
||||
%Astring(3) "0.0"%A
|
||||
@@ -4,7 +4,11 @@ Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
|
||||
<?php
|
||||
if(!extension_loaded("bcmath")) print "skip";
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip Not valid for windows');
|
||||
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
|
||||
$req = "10.0.17134";
|
||||
if (version_compare($cur, $req) < 0) {
|
||||
echo "skip Compatible on Windows systems >= $req";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -6,6 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip valid only for windows');
|
||||
}
|
||||
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
|
||||
$req = "10.0.17134";
|
||||
if (version_compare($cur, $req) >= 0) {
|
||||
echo "skip Only for Windows systems < $req";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -13,9 +18,7 @@ var_dump(bcpowmod('4.1', '4', '3', 3));
|
||||
var_dump(bcpowmod('4', '4', '3.1', 3));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(5) "1.000"
|
||||
string(5) "1.000"
|
||||
===DONE===
|
||||
bc math warning: non-zero scale in base
|
||||
bc math warning: non-zero scale in modulus
|
||||
--EXPECTF--
|
||||
%Astring(5) "1.000"
|
||||
%Astring(5) "1.000"
|
||||
===DONE===%A
|
||||
@@ -4,7 +4,11 @@ Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip Not valid for windows');
|
||||
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
|
||||
$req = "10.0.17134";
|
||||
if (version_compare($cur, $req) < 0) {
|
||||
echo "skip Compatible on Windows systems >= $req";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
+25
-25
@@ -340,38 +340,38 @@ char *JewishMonthName[14] =
|
||||
char *JewishMonthHebNameLeap[14] =
|
||||
{
|
||||
"",
|
||||
"תשרי",
|
||||
"חשון",
|
||||
"כסלו",
|
||||
"טבת",
|
||||
"שבט",
|
||||
"אדר א'",
|
||||
"אדר ב'",
|
||||
"ניסן",
|
||||
"אייר",
|
||||
"סיון",
|
||||
"תמוז",
|
||||
"אב",
|
||||
"אלול"
|
||||
"\xFA\xF9\xF8\xE9",
|
||||
"\xE7\xF9\xE5\xEF",
|
||||
"\xEB\xF1\xEC\xE5",
|
||||
"\xE8\xE1\xFA",
|
||||
"\xF9\xE1\xE8",
|
||||
"\xE0\xE3\xF8 \xE0'",
|
||||
"\xE0\xE3\xF8 \xE1'",
|
||||
"\xF0\xE9\xF1\xEF",
|
||||
"\xE0\xE9\xE9\xF8",
|
||||
"\xF1\xE9\xe5\xEF",
|
||||
"\xFA\xEE\xE5\xE6",
|
||||
"\xE0\xE1",
|
||||
"\xE0\xEC\xE5\xEC"
|
||||
};
|
||||
|
||||
/* names for regular year */
|
||||
char *JewishMonthHebName[14] =
|
||||
{
|
||||
"",
|
||||
"תשרי",
|
||||
"חשון",
|
||||
"כסלו",
|
||||
"טבת",
|
||||
"שבט",
|
||||
"\xFA\xF9\xF8\xE9",
|
||||
"\xE7\xF9\xE5\xEF",
|
||||
"\xEB\xF1\xEC\xE5",
|
||||
"\xE8\xE1\xFA",
|
||||
"\xF9\xE1\xE8",
|
||||
"",
|
||||
"אדר",
|
||||
"ניסן",
|
||||
"אייר",
|
||||
"סיון",
|
||||
"תמוז",
|
||||
"אב",
|
||||
"אלול"
|
||||
"\xE0\xE3\xF8",
|
||||
"\xF0\xE9\xF1\xEF",
|
||||
"\xE0\xE9\xE9\xF8",
|
||||
"\xF1\xE9\xE5\xEF",
|
||||
"\xFA\xEE\xE5\xE6",
|
||||
"\xE0\xE1",
|
||||
"\xE0\xEC\xE5\xEC"
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
Test all hebrew month names
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip calendar extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
for ($year = 5000; $year <= 5001; $year++) {
|
||||
$leap = ($year === 5001) ? 'leap' : 'normal';
|
||||
echo "$leap year $year\n";
|
||||
for ($month = 1; $month <= 13; $month++) {
|
||||
$jd = jewishtojd($month, 1, $year);
|
||||
$hebrew = jdtojewish($jd, true);
|
||||
$hex = bin2hex($hebrew);
|
||||
echo "$hex\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
normal year 5000
|
||||
e020faf9f8e920e4
|
||||
e020e7f9e5ef20e4
|
||||
e020ebf1ece520e4
|
||||
e020e8e1fa20e4
|
||||
e020f9e1e820e4
|
||||
e020e0e3f820e02720e4
|
||||
e020e0e3f820e12720e4
|
||||
e020f0e9f1ef20e4
|
||||
e020e0e9e9f820e4
|
||||
e020f1e9e5ef20e4
|
||||
e020faeee5e620e4
|
||||
e020e0e120e4
|
||||
e020e0ece5ec20e4
|
||||
|
||||
leap year 5001
|
||||
e020faf9f8e920e4e0
|
||||
e020e7f9e5ef20e4e0
|
||||
e020ebf1ece520e4e0
|
||||
e020e8e1fa20e4e0
|
||||
e020f9e1e820e4e0
|
||||
e020e0e3f820e4e0
|
||||
e020e0e3f820e4e0
|
||||
e020f0e9f1ef20e4e0
|
||||
e020e0e9e9f820e4e0
|
||||
e020f1e9e5ef20e4e0
|
||||
e020faeee5e620e4e0
|
||||
e020e0e120e4e0
|
||||
e020e0ece5ec20e4e0
|
||||
|
||||
===DONE===
|
||||
@@ -30,7 +30,8 @@ echo "Ok\n";
|
||||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
|
||||
Hello World!
|
||||
Hello World!Ok
|
||||
%A
|
||||
Hello World!
|
||||
Hello World!* Closing connection 0
|
||||
Ok
|
||||
|
||||
@@ -65,4 +65,3 @@ Hello World!Ok for CURLOPT_FILE
|
||||
|
||||
%AOk for CURLOPT_INFILE
|
||||
===DONE===
|
||||
%A
|
||||
@@ -13,17 +13,23 @@ function curl_cli_server_start() {
|
||||
$doc_root = __DIR__;
|
||||
$router = "responder/get.php";
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => array("pipe", "w"),
|
||||
);
|
||||
|
||||
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
|
||||
} else {
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
|
||||
$cmd .= " {$router}";
|
||||
$cmd .= " 2>/dev/null";
|
||||
|
||||
+1049
-1045
File diff suppressed because it is too large.
Load diff
+26
-44
@@ -2358,48 +2358,6 @@ static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
|
||||
return &new_obj->std;
|
||||
} /* }}} */
|
||||
|
||||
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
|
||||
{
|
||||
HashTable *props;
|
||||
zval zv;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
|
||||
tzobj = Z_PHPTIMEZONE_P(object);
|
||||
|
||||
props = zend_std_get_properties(object);
|
||||
|
||||
if (!tzobj->initialized) {
|
||||
return props;
|
||||
}
|
||||
|
||||
ZVAL_LONG(&zv, tzobj->type);
|
||||
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
|
||||
|
||||
switch (tzobj->type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
ZVAL_STRING(&zv, tzobj->tzi.tz->name);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
tzobj->tzi.utc_offset < 0 ? '-' : '+',
|
||||
abs(tzobj->tzi.utc_offset / 3600),
|
||||
abs(((tzobj->tzi.utc_offset % 3600) / 60)));
|
||||
|
||||
ZVAL_NEW_STR(&zv, tmpstr);
|
||||
}
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
ZVAL_STRING(&zv, tzobj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
|
||||
|
||||
return props;
|
||||
} /* }}} */
|
||||
|
||||
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
{
|
||||
switch (tzobj->type) {
|
||||
@@ -2412,8 +2370,8 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
utc_offset < 0 ? '-' : '+',
|
||||
abs(utc_offset / 3600),
|
||||
abs(((utc_offset % 3600) / 60)));
|
||||
abs((int)(utc_offset / 3600)),
|
||||
abs((int)(utc_offset % 3600) / 60));
|
||||
|
||||
ZVAL_NEW_STR(zv, tmpstr);
|
||||
}
|
||||
@@ -2424,6 +2382,29 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
}
|
||||
}
|
||||
|
||||
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
|
||||
{
|
||||
HashTable *props;
|
||||
zval zv;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
tzobj = Z_PHPTIMEZONE_P(object);
|
||||
|
||||
props = zend_std_get_properties(object);
|
||||
|
||||
if (!tzobj->initialized) {
|
||||
return props;
|
||||
}
|
||||
|
||||
ZVAL_LONG(&zv, tzobj->type);
|
||||
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
|
||||
|
||||
php_timezone_to_string(tzobj, &zv);
|
||||
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
|
||||
|
||||
return props;
|
||||
} /* }}} */
|
||||
|
||||
static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
|
||||
{
|
||||
HashTable *ht, *props;
|
||||
@@ -4298,6 +4279,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int
|
||||
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
|
||||
/* Fallback to read_property. */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #76462 Undefined property: DateInterval::$f
|
||||
--FILE--
|
||||
<?php
|
||||
$buggy = new DateInterval('P0Y');
|
||||
$buggy->f += 0.01;
|
||||
|
||||
$ok = new DateInterval('P0Y');
|
||||
$ok->f = $ok->f + 0.01;
|
||||
|
||||
var_dump($buggy->f);
|
||||
var_dump($ok->f);
|
||||
?>
|
||||
--EXPECT--
|
||||
float(0.01)
|
||||
float(0.01)
|
||||
@@ -42,7 +42,11 @@ struct _notationIterator {
|
||||
xmlNotation *notation;
|
||||
};
|
||||
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name) /* {{{ */
|
||||
#if LIBXML_VERSION >= 20908
|
||||
static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */
|
||||
#else
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name)
|
||||
#endif
|
||||
{
|
||||
nodeIterator *priv = (nodeIterator *)data;
|
||||
|
||||
|
||||
@@ -719,7 +719,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
|
||||
}
|
||||
|
||||
if (sugg) {
|
||||
zval_dtor(sugg);
|
||||
zval_ptr_dtor(sugg);
|
||||
array_init(sugg);
|
||||
}
|
||||
|
||||
|
||||
+11
-7
@@ -2112,7 +2112,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
case TAG_FMT_UNDEFINED:
|
||||
if (value) {
|
||||
if (tag == TAG_MAKER_NOTE) {
|
||||
length = MIN(length, (int) strlen(value));
|
||||
length = (int) php_strnlen(value, length);
|
||||
}
|
||||
|
||||
/* do not recompute length here */
|
||||
@@ -2944,7 +2944,10 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
|
||||
return;
|
||||
}
|
||||
/* Check to make sure we are not going to go past the ExifLength */
|
||||
if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
|
||||
if (ImageInfo->Thumbnail.size > length
|
||||
|| (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length
|
||||
|| ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size
|
||||
) {
|
||||
EXIF_ERRLOG_THUMBEOF(ImageInfo)
|
||||
return;
|
||||
}
|
||||
@@ -3126,7 +3129,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
#endif
|
||||
const maker_note_type *maker_note;
|
||||
char *dir_start;
|
||||
|
||||
int data_len;
|
||||
|
||||
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -3180,6 +3184,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
switch (maker_note->offset_mode) {
|
||||
case MN_OFFSET_MAKER:
|
||||
offset_base = value_ptr;
|
||||
data_len = value_len;
|
||||
break;
|
||||
#ifdef KALLE_0
|
||||
case MN_OFFSET_GUESS:
|
||||
@@ -3197,6 +3202,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
return FALSE;
|
||||
}
|
||||
offset_base = value_ptr + offset_diff;
|
||||
data_len = value_len - offset_diff;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -3211,7 +3217,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
|
||||
offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -4324,7 +4330,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
|
||||
zend_string *base;
|
||||
if ((st.st_mode & S_IFMT) != S_IFREG) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");
|
||||
php_stream_close(ImageInfo->infile);
|
||||
ImageInfo->infile = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -4457,13 +4463,11 @@ PHP_FUNCTION(exif_read_data)
|
||||
#ifdef EXIF_DEBUG
|
||||
sections_str = exif_get_sectionlist(sections_needed);
|
||||
if (!sections_str) {
|
||||
zend_string_release(z_sections_needed);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections needed: %s", sections_str[0] ? sections_str : "None");
|
||||
EFREE_IF(sections_str);
|
||||
#endif
|
||||
zend_string_release(z_sections_needed);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(stream) == IS_RESOURCE) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #76130 (Heap Buffer Overflow (READ: 1786) in exif_iif_add_value)
|
||||
--DESCRIPTION--
|
||||
This test is meant to exhibit memory issues with the `-m` option. Since a lot of
|
||||
notices and warnings are to be expected anyway, we suppress these, since the are
|
||||
not relevant for this test.
|
||||
--INI--
|
||||
error_reporting=E_ALL & ~E_WARNING & ~E_NOTICE
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76130_1.jpg');
|
||||
exif_read_data(__DIR__ . '/bug76130_2.jpg');
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #76164 (exif_read_data zend_mm_heap corrupted)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$var1 = 'nonexistentfile';
|
||||
$var2 = 2200000000;
|
||||
@exif_read_data($var1, $var2); // we're not interested in the warning, here
|
||||
$var2 = 1;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #76409 (heap use after free in _php_stream_free)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data('.');
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(): %s in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #76423 (Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,79 @@
|
||||
--TEST--
|
||||
Bug 76557 (heap-buffer-overflow (READ of size 48) while reading exif data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_read_data(dirname(__FILE__) . "/bug76557.jpg"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x010F=Make ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x8769=Exif_IFD_Po): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x927C=MakerNote ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Invalid JPEG file in %sbug76557.php on line %d
|
||||
bool(false)
|
||||
DONE
|
||||
@@ -621,6 +621,9 @@ static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args,
|
||||
}
|
||||
|
||||
if ((option = zend_hash_str_find(HASH_OF(filter_args), "options", sizeof("options") - 1)) != NULL) {
|
||||
/* avoid reference type */
|
||||
ZVAL_DEREF(option);
|
||||
|
||||
if (filter != FILTER_CALLBACK) {
|
||||
if (Z_TYPE_P(option) == IS_ARRAY) {
|
||||
options = option;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #76366 (references in sub-array for filtering breaks the filter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('filter')) die('skip filter extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
#array to filter
|
||||
$data = ['foo' => 6];
|
||||
|
||||
#filter args
|
||||
$args = [
|
||||
'foo'=> [
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'flags' => FILTER_FORCE_ARRAY
|
||||
]
|
||||
];
|
||||
|
||||
$args['foo']['options'] = [];
|
||||
|
||||
#create reference
|
||||
$options = &$args['foo']['options'];
|
||||
|
||||
#set options
|
||||
$options['min_range'] = 1;
|
||||
$options['max_range'] = 5;
|
||||
|
||||
#show the filter result
|
||||
var_dump(filter_var_array($data, $args));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
bool(false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #74670: Integer Underflow when unserializing GMP and possible other classes
|
||||
--FILE--
|
||||
<?php
|
||||
$str = 'C:3:"GMP":4:{s:6666666666:""}';
|
||||
var_dump(unserialize($str));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
|
||||
bool(false)
|
||||
@@ -18,7 +18,7 @@ try {
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
try {
|
||||
unserialize('C:3:"GMP":8:{s:2:"42";}');
|
||||
unserialize('C:3:"GMP":9:{s:2:"42";}');
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
?>
|
||||
|
||||
@@ -2642,6 +2642,9 @@ static int php_iconv_stream_filter_append_bucket(
|
||||
tcnt = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "iconv stream filter (\"%s\"=>\"%s\"): invalid multibyte sequence", self->from_charset, self->to_charset);
|
||||
goto out_failure;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #76249 (stream filter convert.iconv leads to infinite loop on invalid sequence)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fh = fopen('php://memory', 'rw');
|
||||
fwrite($fh, "abc");
|
||||
rewind($fh);
|
||||
if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) {
|
||||
stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
|
||||
}
|
||||
$a = stream_get_contents($fh);
|
||||
var_dump(strlen($a));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: stream_get_contents(): iconv stream filter ("ucs-2"=>"utf%A8//IGNORE"): invalid multibyte sequence in %sbug76249.php on line %d
|
||||
int(3)
|
||||
DONE
|
||||
@@ -1082,6 +1082,7 @@ PHP_RSHUTDOWN_FUNCTION(imap)
|
||||
}
|
||||
}
|
||||
mail_free_errorlist(&IMAPG(imap_errorstack));
|
||||
IMAPG(imap_errorstack) = NIL;
|
||||
}
|
||||
|
||||
if (IMAPG(imap_alertstack) != NIL) {
|
||||
|
||||
@@ -167,7 +167,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
|
||||
}
|
||||
|
||||
ZVAL_STRING(&val, const_cast<char*>(typeid(*biter).name()));
|
||||
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &bio->text);
|
||||
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &val);
|
||||
|
||||
return debug_info;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ static void _breakiter_factory(const char *func_name,
|
||||
UErrorCode status = UErrorCode();
|
||||
intl_error_reset(NULL);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!",
|
||||
&locale_str, &dummy) == FAILURE) {
|
||||
spprintf(&msg, 0, "%s: bad arguments", func_name);
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
|
||||
|
||||
@@ -79,6 +79,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
|
||||
if (U_FAILURE(status)) {
|
||||
intl_error_set(NULL, status, "rbbi_create_instance: unable to "
|
||||
"create instance from compiled rules", 0);
|
||||
delete rbbi;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -103,19 +103,23 @@ typedef struct _intl_data {
|
||||
RETVAL_NEW_STR(u8str); \
|
||||
}
|
||||
|
||||
#define INTL_MAX_LOCALE_LEN 80
|
||||
#define INTL_MAX_LOCALE_LEN (ULOC_FULLNAME_CAPACITY-1)
|
||||
|
||||
#define INTL_CHECK_LOCALE_LEN(locale_len) \
|
||||
if((locale_len) > INTL_MAX_LOCALE_LEN) { \
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Locale string too long, should be no longer than 80 characters", 0 ); \
|
||||
char *_msg; \
|
||||
spprintf(&_msg, 0, "Locale string too long, should be no longer than %d characters", INTL_MAX_LOCALE_LEN); \
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, _msg, 1); \
|
||||
efree(_msg); \
|
||||
RETURN_NULL(); \
|
||||
}
|
||||
|
||||
#define INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len) \
|
||||
if((locale_len) > INTL_MAX_LOCALE_LEN) { \
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, \
|
||||
"Locale string too long, should be no longer than 80 characters", 0 ); \
|
||||
char *_msg; \
|
||||
spprintf(&_msg, 0, "Locale string too long, should be no longer than %d characters", INTL_MAX_LOCALE_LEN); \
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, _msg, 1); \
|
||||
efree(_msg); \
|
||||
return FAILURE; \
|
||||
}
|
||||
|
||||
|
||||
@@ -12,35 +12,29 @@ ini_set("intl.default_locale", "ja");
|
||||
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
|
||||
'createSentenceInstance', 'createTitleInstance');
|
||||
|
||||
$t = 'Frase 1... Frase 2'.
|
||||
$t = 'Frase 1... Frase 2';
|
||||
|
||||
$o1 = $o2 = null;
|
||||
foreach ($m as $method) {
|
||||
echo "===== $method =====\n";
|
||||
$o1 = call_user_func(array('IntlBreakIterator', $method), 'ja');
|
||||
var_dump($o1 == $o2);
|
||||
$o2 = call_user_func(array('IntlBreakIterator', $method), NULL);
|
||||
var_dump($o1 == $o2);
|
||||
$o1 = IntlBreakIterator::$method('ja');
|
||||
$o2 = IntlBreakIterator::$method(NULL);
|
||||
$o3 = IntlBreakIterator::$method();
|
||||
var_dump($o1 == $o2 && $o2 == $o3);
|
||||
echo "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
===== createWordInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createLineInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createCharacterInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createSentenceInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createTitleInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
@@ -22,22 +22,22 @@ Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be strin
|
||||
Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createSentenceInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createCharacterInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createTitleInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createLineInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
@@ -3,6 +3,7 @@ Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
$coll = collator_create('en_US');
|
||||
$res = collator_get_sort_key($coll, $s1);
|
||||
|
||||
echo urlencode($res);
|
||||
--EXPECT--
|
||||
82%40%40F%01%09%01%DC%08
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl')) die('skip intl extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$it = IntlBreakIterator::createCharacterInstance();
|
||||
$it->setText('foo');
|
||||
var_dump($it);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(IntlRuleBasedBreakIterator)#%d (3) {
|
||||
["valid"]=>
|
||||
bool(true)
|
||||
["text"]=>
|
||||
string(3) "foo"
|
||||
["type"]=>
|
||||
string(%d) "%SRuleBasedBreakIterator%S"
|
||||
}
|
||||
===DONE===
|
||||
@@ -22,7 +22,7 @@ function ut_main()
|
||||
'',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
'12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
);
|
||||
|
||||
foreach( $locales as $locale )
|
||||
@@ -79,4 +79,4 @@ Locale: 'uk@currency=EURO'
|
||||
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
Error creating collator with '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than %d characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
@@ -23,7 +23,7 @@ function ut_main()
|
||||
'',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
'12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
);
|
||||
|
||||
foreach( $locales as $locale )
|
||||
@@ -80,4 +80,4 @@ Locale: 'uk@currency=EURO'
|
||||
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
Error creating collator with '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than %d characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
@@ -23,7 +23,7 @@ function ut_main()
|
||||
'',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
'12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
);
|
||||
|
||||
foreach( $locales as $locale )
|
||||
@@ -80,4 +80,4 @@ Locale: 'uk@currency=EURO'
|
||||
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
Error creating collator with '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than %d characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
@@ -22,7 +22,7 @@ function ut_main()
|
||||
'',
|
||||
'root',
|
||||
'uk@currency=EURO',
|
||||
'1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
'12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
|
||||
);
|
||||
|
||||
foreach( $locales as $locale )
|
||||
@@ -76,4 +76,4 @@ Locale: 'uk@currency=EURO'
|
||||
ULOC_REQUESTED_LOCALE = 'uk@currency=EURO'
|
||||
ULOC_VALID_LOCALE = 'uk'
|
||||
ULOC_ACTUAL_LOCALE = 'uk'
|
||||
Error creating collator with '1234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than 80 characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
Error creating collator with '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' locale: Locale string too long, should be no longer than %d characters: U_ILLEGAL_ARGUMENT_ERROR
|
||||
@@ -3,6 +3,7 @@ collator_get_sort_key() icu >= 56.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '56.1') < 0) die('skip for ICU >= 56.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
--TEST--
|
||||
collator_get_sort_key() icu >= 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get sort keys using various locales
|
||||
*/
|
||||
function sort_arrays( $locale, $data )
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
$coll = ut_coll_create( $locale );
|
||||
|
||||
foreach($data as $value) {
|
||||
$res_val = ut_coll_get_sort_key( $coll, $value );
|
||||
$res_str .= "source: ".$value."\n".
|
||||
"key: ".bin2hex($res_val)."\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
|
||||
// Regular strings keys
|
||||
$test_params = array(
|
||||
'abc', 'abd', 'aaa',
|
||||
'аа', 'а', 'z',
|
||||
'', null , '3',
|
||||
'y' , 'i' , 'k'
|
||||
);
|
||||
|
||||
$res_str .= sort_arrays( 'en_US', $test_params );
|
||||
|
||||
// Sort a non-ASCII array using ru_RU locale.
|
||||
$test_params = array(
|
||||
'абг', 'абв', 'жжж', 'эюя'
|
||||
);
|
||||
|
||||
$res_str .= sort_arrays( 'ru_RU', $test_params );
|
||||
|
||||
// Sort an array using Lithuanian locale.
|
||||
$res_str .= sort_arrays( 'lt_LT', $test_params );
|
||||
|
||||
return $res_str . "\n";
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
source: abc
|
||||
key: 2a2c2e01070107
|
||||
source: abd
|
||||
key: 2a2c3001070107
|
||||
source: aaa
|
||||
key: 2a2a2a01070107
|
||||
source: аа
|
||||
key: 61060601060106
|
||||
source: а
|
||||
key: 610601050105
|
||||
source: z
|
||||
key: 5c01050105
|
||||
source:
|
||||
key: 0101
|
||||
source:
|
||||
key: 0101
|
||||
source: 3
|
||||
key: 1901050105
|
||||
source: y
|
||||
key: 5a01050105
|
||||
source: i
|
||||
key: 3a01050105
|
||||
source: k
|
||||
key: 3e01050105
|
||||
source: абг
|
||||
key: 27060c1001070107
|
||||
source: абв
|
||||
key: 27060c0e01070107
|
||||
source: жжж
|
||||
key: 272c2c2c01070107
|
||||
source: эюя
|
||||
key: 27eef0f401070107
|
||||
source: абг
|
||||
key: 61060c1001070107
|
||||
source: абв
|
||||
key: 61060c0e01070107
|
||||
source: жжж
|
||||
key: 612c2c2c01070107
|
||||
source: эюя
|
||||
key: 61eef0f401070107
|
||||
@@ -1,8 +1,9 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 61.1
|
||||
numfmt_format() icu >= 61.1 && < 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '61.1') < 0) die('skip for ICU >= 61.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
--TEST--
|
||||
numfmt_format() icu >= 62.1
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Format a number using misc locales/patterns.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
|
||||
* currency and percent formatting.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$styles = array(
|
||||
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
|
||||
NumberFormatter::DECIMAL => '',
|
||||
NumberFormatter::CURRENCY => '',
|
||||
NumberFormatter::PERCENT => '',
|
||||
NumberFormatter::SCIENTIFIC => '',
|
||||
NumberFormatter::SPELLOUT => '@@@@@@@',
|
||||
NumberFormatter::ORDINAL => '',
|
||||
NumberFormatter::DURATION => '',
|
||||
NumberFormatter::PATTERN_RULEBASED => '#####.###',
|
||||
1234999, // bad one
|
||||
);
|
||||
|
||||
$integer = array(
|
||||
NumberFormatter::ORDINAL => '',
|
||||
NumberFormatter::DURATION => '',
|
||||
);
|
||||
$locales = array(
|
||||
'en_US',
|
||||
'ru_UA',
|
||||
'de',
|
||||
'fr',
|
||||
'en_UK'
|
||||
);
|
||||
|
||||
$str_res = '';
|
||||
$number = 1234567.891234567890000;
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$str_res .= "\nLocale is: $locale\n";
|
||||
foreach( $styles as $style => $pattern )
|
||||
{
|
||||
$fmt = ut_nfmt_create( $locale, $style, $pattern );
|
||||
|
||||
if(!$fmt) {
|
||||
$str_res .= "Bad formatter!\n";
|
||||
continue;
|
||||
}
|
||||
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
|
||||
}
|
||||
}
|
||||
return $str_res;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Locale is: en_US
|
||||
'1234567.8912345\d+'
|
||||
'1,234,567.891'
|
||||
'\$1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.2345678912345\d+E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'USD 1,234,567.89'
|
||||
|
||||
Locale is: ru_UA
|
||||
'1234567.8912345\d+'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 ?(грн\.|₴)'
|
||||
'123 456 789 ?%'
|
||||
'1.2345678912345\d+E6'
|
||||
'один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь целых восемьдесят девять миллионов сто двадцать три тысячи четыреста пятьдесят семь стомиллионных'
|
||||
'1 234 567.?'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 UAH'
|
||||
|
||||
Locale is: de
|
||||
'1234567.8912345\d+'
|
||||
'1.234.567,891'
|
||||
'1.234.567,89 XXX'
|
||||
'123\.456\.789 %'
|
||||
'1.2345678912345\d+E6'
|
||||
'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf( sechs)? sieben( neun)?'
|
||||
'1.234.567.?'
|
||||
'1.234.567'
|
||||
'#####.###'
|
||||
'1.234.567,89 XXX'
|
||||
|
||||
Locale is: fr
|
||||
'1234567.8912345\d+'
|
||||
'1 234 567,891'
|
||||
'1 234 567,89 XXX'
|
||||
'123 456 789 ?%'
|
||||
'1.2345678912345\d+E6'
|
||||
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq( six)? sept( neuf)?'
|
||||
'1 234 567e'
|
||||
'1 234 567'
|
||||
'#####.###'
|
||||
'1 234 567,89 XXX'
|
||||
|
||||
Locale is: en_UK
|
||||
'1234567.8912345\d+'
|
||||
'1,234,567.891'
|
||||
'XXX 1,234,567.89'
|
||||
'123,456,789%'
|
||||
'1.2345678912345\d+E6'
|
||||
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
|
||||
'1,234,567(th|ᵗʰ)'
|
||||
'342:56:07'
|
||||
'#####.###'
|
||||
'XXX 1,234,567.89'
|
||||
@@ -42,9 +42,9 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
en_UK: '£1,234,567.89'
|
||||
en_US: '$1,234,567.89'
|
||||
ru: '1 234 567,89 р.'
|
||||
uk: '1 234 567,89 ₴'
|
||||
en: 'UAH1,234,567.89'
|
||||
en: 'UAH%A1,234,567.89'
|
||||
@@ -3,6 +3,7 @@ numfmt_get_locale()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--TEST--
|
||||
numfmt_get_locale()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get locale.
|
||||
*/
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$locales = array(
|
||||
'en_UK',
|
||||
'en_US',
|
||||
'fr_CA',
|
||||
);
|
||||
|
||||
$loc_types = array(
|
||||
Locale::ACTUAL_LOCALE => 'actual',
|
||||
Locale::VALID_LOCALE => 'valid',
|
||||
);
|
||||
|
||||
$res_str = '';
|
||||
|
||||
foreach( $locales as $locale )
|
||||
{
|
||||
$fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL );
|
||||
$res_str .= "$locale: ";
|
||||
foreach( $loc_types as $loc_type => $loc_type_name )
|
||||
$res_str .= sprintf( " %s=%s",
|
||||
$loc_type_name,
|
||||
dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) );
|
||||
$res_str .= "\n";
|
||||
}
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
|
||||
// Run the test
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
en_UK: actual='en' valid='en'
|
||||
en_US: actual='en_US' valid='en_US'
|
||||
fr_CA: actual='fr_CA' valid='fr_CA'
|
||||
@@ -2,6 +2,7 @@
|
||||
numfmt_get/set_pattern()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--TEST--
|
||||
numfmt_get/set_pattern()
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Get/set pattern.
|
||||
*/
|
||||
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$res_str = '';
|
||||
$test_value = 12345.123456;
|
||||
$fmt = ut_nfmt_create( "en_US", NumberFormatter::PATTERN_DECIMAL );
|
||||
|
||||
// Get default patten.
|
||||
$res_str .= "Default pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatting result: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
// Set a new pattern.
|
||||
$res = ut_nfmt_set_pattern( $fmt, "0.0" );
|
||||
if( $res === false )
|
||||
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
|
||||
|
||||
// Check if the pattern has been changed.
|
||||
$res = ut_nfmt_get_pattern( $fmt );
|
||||
if( $res === false )
|
||||
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
|
||||
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
|
||||
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
|
||||
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
|
||||
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Default pattern: '#'
|
||||
Formatting result: 12345.123456
|
||||
New pattern: '0.0'
|
||||
Formatted number: 12345.1
|
||||
New pattern: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
|
||||
Formatted number: 12345.123456000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
@@ -88,7 +88,7 @@ include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Symbol 'DECIMAL_SEPARATOR_SYMBOL'
|
||||
Default symbol: [.]
|
||||
New symbol: [_._]
|
||||
@@ -132,7 +132,7 @@ A number formatted with the new symbol: 1.2345123456E4
|
||||
Symbol 'CURRENCY_SYMBOL'
|
||||
Default symbol: [$]
|
||||
New symbol: [_$_]
|
||||
A number formatted with the new symbol: _$_12,345.12
|
||||
A number formatted with the new symbol: _$_%A12,345.12
|
||||
|
||||
Symbol 'INTL_CURRENCY_SYMBOL'
|
||||
Default symbol: [USD]
|
||||
|
||||
@@ -24,8 +24,17 @@ $rules = <<<RULES
|
||||
RULES;
|
||||
$rbbi = new IntlRuleBasedBreakIterator($rules);
|
||||
var_dump(get_class($rbbi));
|
||||
|
||||
try {
|
||||
$obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu');
|
||||
} catch (IntlException $e) {
|
||||
var_dump(intl_get_error_code(), intl_get_error_message());
|
||||
}
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(26) "IntlRuleBasedBreakIterator"
|
||||
==DONE==
|
||||
int(1)
|
||||
string(93) "rbbi_create_instance: unable to create instance from compiled rules: U_ILLEGAL_ARGUMENT_ERROR"
|
||||
==DONE==
|
||||
+5
-1
@@ -1242,7 +1242,11 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
|
||||
add_assoc_long(&tmp1, "count", num_attrib);
|
||||
dn = ldap_get_dn(ldap, ldap_result_entry);
|
||||
add_assoc_string(&tmp1, "dn", dn);
|
||||
if (dn) {
|
||||
add_assoc_string(&tmp1, "dn", dn);
|
||||
} else {
|
||||
add_assoc_null(&tmp1, "dn");
|
||||
}
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(dn);
|
||||
#else
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #76248 (Malicious LDAP-Server Response causes Crash)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (!function_exists('pcntl_fork')) die('skip fork not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$pid = pcntl_fork();
|
||||
const PORT = 12345;
|
||||
if ($pid == 0) {
|
||||
// child
|
||||
$server = stream_socket_server("tcp://127.0.0.1:12345");
|
||||
$socket = stream_socket_accept($server, 3);
|
||||
fwrite($socket, base64_decode("MAwCAQFhBwoBAAQABAAweQIBAmR0BJljbj1yb290LGRjPWV4YW1wbGUsZGM9Y29tMFcwIwQLb2JqZWN0Q2xhc3MxFAQSb3JnYW5pemF0aW9uYWxSb2xlMAwEAmNuMQYEBHJvb3QwIgQLZGVzY3JpcHRpb24xEwQRRGlyZWN0b3J5IE1hbmFnZXIwDAIBAmUHCgEABAAEADB5AgEDZHQEmWNuPXJvb3QsZGM9ZXhhbXBsZSxkYz1jb20wVzAjBAtvYmplY3RDbGFzczEUBBJvcmdhbml6YXRpb25hbFJvbGUwDAQCY24xBgQEcm9vdDAiBAtkZXNjcmlwdGlvbjETBBFEaXJlY3RvcnkgTWFuYWdlcjAMAgEDZQcKAQAEAAQA"));
|
||||
fflush($socket);
|
||||
} else {
|
||||
// parent
|
||||
$ds = ldap_connect("127.0.0.1", PORT);
|
||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
$b = ldap_bind($ds, "cn=root,dc=example,dc=com", "secret");
|
||||
|
||||
$s = ldap_search($ds, "dc=example,dc=com", "(cn=root)");
|
||||
$tt = ldap_get_entries($ds, $s);
|
||||
var_dump($tt);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
["dn"]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
@@ -1875,7 +1875,7 @@ mbfl_strimwidth(
|
||||
mbfl_string_init(result);
|
||||
result->no_language = string->no_language;
|
||||
result->no_encoding = string->no_encoding;
|
||||
mbfl_memory_device_init(&pc.device, width, 0);
|
||||
mbfl_memory_device_init(&pc.device, MIN(string->len, width), 0);
|
||||
|
||||
/* output code filter */
|
||||
pc.decoder = mbfl_convert_filter_new(
|
||||
|
||||
@@ -113,6 +113,13 @@
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
|
||||
|
||||
/*
|
||||
* convenience macros
|
||||
*/
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* buffering converter
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #76532 (Integer overflow and excessive memory usage in mb_strimwidth)
|
||||
--SKIPIF--
|
||||
<?php require 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$string_to_trim = '得很幸福。有一天,一个长得很丑的老人带着一只木马来到王';
|
||||
$width = 2147483647;
|
||||
var_dump(mb_strimwidth($string_to_trim, 0, $width));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(81) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
|
||||
+286
-7
@@ -89,6 +89,7 @@ mysqlnd_run_authentication(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
zend_uchar * switch_to_auth_protocol_data = NULL;
|
||||
size_t switch_to_auth_protocol_data_len = 0;
|
||||
@@ -113,10 +114,11 @@ mysqlnd_run_authentication(
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
|
||||
/* The data should be allocated with malloc() */
|
||||
if (auth_plugin) {
|
||||
scrambled_data =
|
||||
auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
|
||||
plugin_data, plugin_data_len, session_options,
|
||||
conn->protocol_frame_codec->data, mysql_flags);
|
||||
scrambled_data = auth_plugin->methods.get_auth_data(
|
||||
NULL, &scrambled_data_len, conn, user, passwd,
|
||||
passwd_len, plugin_data, plugin_data_len,
|
||||
session_options, conn->protocol_frame_codec->data,
|
||||
mysql_flags);
|
||||
}
|
||||
|
||||
if (conn->error_info->error_no) {
|
||||
@@ -127,6 +129,7 @@ mysqlnd_run_authentication(
|
||||
charset_no,
|
||||
first_call,
|
||||
requested_protocol,
|
||||
auth_plugin, plugin_data, plugin_data_len,
|
||||
scrambled_data, scrambled_data_len,
|
||||
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
|
||||
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
|
||||
@@ -248,6 +251,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
@@ -318,6 +324,11 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
conn->charset = mysqlnd_find_charset_nr(auth_packet->charset_no);
|
||||
}
|
||||
|
||||
if (auth_plugin && auth_plugin->methods.handle_server_response) {
|
||||
auth_plugin->methods.handle_server_response(auth_plugin, conn,
|
||||
orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len);
|
||||
}
|
||||
|
||||
if (FAIL == PACKET_READ(auth_resp_packet) || auth_resp_packet->response_code >= 0xFE) {
|
||||
if (auth_resp_packet->response_code == 0xFE) {
|
||||
/* old authentication with new server !*/
|
||||
@@ -613,7 +624,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_native_auth_plugin =
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_native_auth_get_auth_data
|
||||
mysqlnd_native_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
@@ -662,7 +674,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_pam_authentication_plugin
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_pam_auth_get_auth_data
|
||||
mysqlnd_pam_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
@@ -846,17 +859,283 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_sha256_authentication_plu
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_sha256_auth_get_auth_data
|
||||
mysqlnd_sha256_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*************************************** CACHING SHA2 Password *******************************/
|
||||
|
||||
#undef L64
|
||||
|
||||
#include "ext/hash/php_hash.h"
|
||||
#include "ext/hash/php_hash_sha.h"
|
||||
|
||||
#define SHA256_LENGTH 32
|
||||
|
||||
/* {{{ php_mysqlnd_scramble_sha2 */
|
||||
void php_mysqlnd_scramble_sha2(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const password, const size_t password_len)
|
||||
{
|
||||
PHP_SHA256_CTX context;
|
||||
zend_uchar sha1[SHA256_LENGTH];
|
||||
zend_uchar sha2[SHA256_LENGTH];
|
||||
|
||||
/* Phase 1: hash password */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, password, password_len);
|
||||
PHP_SHA256Final(sha1, &context);
|
||||
|
||||
/* Phase 2: hash sha1 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha1, SHA256_LENGTH);
|
||||
PHP_SHA256Final(sha2, &context);
|
||||
|
||||
/* Phase 3: hash scramble + sha2 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha2, SHA256_LENGTH);
|
||||
PHP_SHA256Update(&context, scramble, SCRAMBLE_LENGTH);
|
||||
PHP_SHA256Final(buffer, &context);
|
||||
|
||||
/* let's crypt buffer now */
|
||||
php_mysqlnd_crypt(buffer, (const zend_uchar *)sha1, (const zend_uchar *)buffer, SHA256_LENGTH);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static zend_uchar *
|
||||
mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
|
||||
size_t * auth_data_len,
|
||||
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
|
||||
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
const MYSQLND_PFC_DATA * const pfc_data,
|
||||
zend_ulong mysql_flags
|
||||
)
|
||||
{
|
||||
zend_uchar * ret = NULL;
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_auth_data");
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
|
||||
*auth_data_len = 0;
|
||||
|
||||
DBG_INF("First auth step: send hashed password");
|
||||
/* copy scrambled pass*/
|
||||
if (passwd && passwd_len) {
|
||||
ret = malloc(SHA256_LENGTH + 1);
|
||||
*auth_data_len = SHA256_LENGTH;
|
||||
php_mysqlnd_scramble_sha2((zend_uchar*)ret, auth_plugin_data, (zend_uchar*)passwd, passwd_len);
|
||||
ret[SHA256_LENGTH] = '\0';
|
||||
DBG_INF_FMT("hash(%d)=[%.*s]", *auth_data_len, *auth_data_len, ret);
|
||||
}
|
||||
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *
|
||||
mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
{
|
||||
RSA * ret = NULL;
|
||||
const MYSQLND_PFC_DATA * const pfc_data = conn->protocol_frame_codec->data;
|
||||
const char * fname = (pfc_data->sha256_server_public_key && pfc_data->sha256_server_public_key[0] != '\0')?
|
||||
pfc_data->sha256_server_public_key:
|
||||
MYSQLND_G(sha256_server_public_key);
|
||||
php_stream * stream;
|
||||
DBG_ENTER("mysqlnd_cached_sha2_get_key");
|
||||
DBG_INF_FMT("options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
|
||||
pfc_data->sha256_server_public_key? pfc_data->sha256_server_public_key:"n/a",
|
||||
MYSQLND_G(sha256_server_public_key)? MYSQLND_G(sha256_server_public_key):"n/a");
|
||||
if (!fname || fname[0] == '\0') {
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *req_packet = NULL;
|
||||
MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *pk_resp_packet = NULL;
|
||||
|
||||
do {
|
||||
DBG_INF("requesting the public key from the server");
|
||||
req_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
pk_resp_packet = conn->payload_decoder_factory->m.get_sha256_pk_request_response_packet(conn->payload_decoder_factory, FALSE);
|
||||
req_packet->request = 1;
|
||||
|
||||
if (! PACKET_WRITE(req_packet)) {
|
||||
DBG_ERR_FMT("Error while sending public key request packet");
|
||||
php_error(E_WARNING, "Error while sending public key request packet. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
if (FAIL == PACKET_READ(pk_resp_packet) || NULL == pk_resp_packet->public_key) {
|
||||
DBG_ERR_FMT("Error while receiving public key");
|
||||
php_error(E_WARNING, "Error while receiving public key. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet->public_key_len, pk_resp_packet->public_key);
|
||||
/* now extract the public key */
|
||||
{
|
||||
BIO * bio = BIO_new_mem_buf(pk_resp_packet->public_key, pk_resp_packet->public_key_len);
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
}
|
||||
} while (0);
|
||||
PACKET_FREE(req_packet);
|
||||
PACKET_FREE(pk_resp_packet);
|
||||
|
||||
DBG_INF_FMT("ret=%p", ret);
|
||||
DBG_RETURN(ret);
|
||||
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
|
||||
"caching_sha2_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
|
||||
DBG_ERR("server_public_key is not set");
|
||||
DBG_RETURN(NULL);
|
||||
} else {
|
||||
zend_string * key_str;
|
||||
DBG_INF_FMT("Key in a file. [%s]", fname);
|
||||
stream = php_stream_open_wrapper((char *) fname, "rb", REPORT_ERRORS, NULL);
|
||||
|
||||
if (stream) {
|
||||
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
|
||||
BIO * bio = BIO_new_mem_buf(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
DBG_INF("Successfully loaded");
|
||||
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
|
||||
zend_string_release(key_str);
|
||||
}
|
||||
php_stream_close(stream);
|
||||
}
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_get_key */
|
||||
static size_t
|
||||
mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
unsigned char **crypted,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *server_public_key;
|
||||
server_public_key = mysqlnd_caching_sha2_get_key(conn);
|
||||
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
|
||||
if (server_public_key) {
|
||||
int server_public_key_len;
|
||||
char xor_str[passwd_len + 1];
|
||||
memcpy(xor_str, passwd, passwd_len);
|
||||
xor_str[passwd_len] = '\0';
|
||||
mysqlnd_xor_string(xor_str, passwd_len, (char *) auth_plugin_data, auth_plugin_data_len);
|
||||
|
||||
server_public_key_len = RSA_size(server_public_key);
|
||||
/*
|
||||
Because RSA_PKCS1_OAEP_PADDING is used there is a restriction on the passwd_len.
|
||||
RSA_PKCS1_OAEP_PADDING is recommended for new applications. See more here:
|
||||
http://www.openssl.org/docs/crypto/RSA_public_encrypt.html
|
||||
*/
|
||||
if ((size_t) server_public_key_len - 41 <= passwd_len) {
|
||||
/* password message is to long */
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
|
||||
DBG_ERR("password is too long");
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
||||
*crypted = emalloc(server_public_key_len);
|
||||
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, *crypted, server_public_key, RSA_PKCS1_OAEP_PADDING);
|
||||
DBG_RETURN(server_public_key_len);
|
||||
}
|
||||
DBG_RETURN(0);
|
||||
#else
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
php_error_docref(NULL, E_WARNING, "PHP was built without openssl extension, can't send password encrypted");
|
||||
DBG_RETURN(0);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static void
|
||||
mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plugin *self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *result_packet;
|
||||
result_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
|
||||
if (FAIL == PACKET_READ(result_packet)) {
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
||||
switch (result_packet->response_code) {
|
||||
case 3:
|
||||
DBG_INF("fast path suceeded");
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 4:
|
||||
if (conn->vio->data->ssl || conn->unix_socket.s) {
|
||||
DBG_INF("fast path failed, doing full auth via SSL");
|
||||
result_packet->password = (zend_uchar *)passwd;
|
||||
result_packet->password_len = passwd_len + 1;
|
||||
PACKET_WRITE(result_packet);
|
||||
} else {
|
||||
DBG_INF("fast path failed, doing full auth without SSL");
|
||||
result_packet->password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plugin_data_len, &result_packet->password, passwd, passwd_len);
|
||||
PACKET_WRITE(result_packet);
|
||||
efree(result_packet->password);
|
||||
}
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 2:
|
||||
// The server tried to send a key, which we didn't expect
|
||||
// fall-through
|
||||
default:
|
||||
php_error_docref(NULL, E_WARNING, "Unexpected server respose while doing caching_sha2 auth: %i", result_packet->response_code);
|
||||
}
|
||||
|
||||
PACKET_FREE(result_packet);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static struct st_mysqlnd_authentication_plugin mysqlnd_caching_sha2_auth_plugin =
|
||||
{
|
||||
{
|
||||
MYSQLND_PLUGIN_API_VERSION,
|
||||
"auth_plugin_caching_sha2_password",
|
||||
MYSQLND_VERSION_ID,
|
||||
PHP_MYSQLND_VERSION,
|
||||
"PHP License 3.01",
|
||||
"Johannes Schlüter <johannes.schlueter@php.net>",
|
||||
{
|
||||
NULL, /* no statistics , will be filled later if there are some */
|
||||
NULL, /* no statistics */
|
||||
},
|
||||
{
|
||||
NULL /* plugin shutdown */
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_caching_sha2_get_auth_data,
|
||||
mysqlnd_caching_sha2_handle_server_response
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* {{{ mysqlnd_register_builtin_authentication_plugins */
|
||||
void
|
||||
mysqlnd_register_builtin_authentication_plugins(void)
|
||||
{
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_native_auth_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_pam_authentication_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_caching_sha2_auth_plugin);
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_sha256_authentication_plugin);
|
||||
#endif
|
||||
|
||||
@@ -31,26 +31,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
size_t * switch_to_auth_protocol_len,
|
||||
zend_uchar ** switch_to_auth_protocol_data,
|
||||
size_t * switch_to_auth_protocol_data_len
|
||||
);
|
||||
|
||||
enum_func_status
|
||||
mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
const char * const user,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len,
|
||||
const char * const db,
|
||||
const size_t db_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
zend_ulong mysql_flags,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
|
||||
@@ -678,9 +678,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
|
||||
|
||||
{
|
||||
const MYSQLND_CSTRING scheme = { transport.s, transport.l };
|
||||
/* This will be overwritten below with a copy, but we can use it during authentication */
|
||||
conn->unix_socket.s = (char *)socket_or_pipe.s;
|
||||
if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags)) {
|
||||
conn->unix_socket.s = NULL;
|
||||
goto err;
|
||||
}
|
||||
conn->unix_socket.s = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -631,6 +631,7 @@ enum mysqlnd_packet_type
|
||||
PROT_CHG_USER_RESP_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_RESPONSE_PACKET,
|
||||
PROT_CACHED_SHA2_RESULT_PACKET,
|
||||
PROT_LAST /* should always be last */
|
||||
};
|
||||
|
||||
|
||||
@@ -970,6 +970,7 @@ struct st_mysqlnd_packet_chg_user_resp;
|
||||
struct st_mysqlnd_packet_auth_pam;
|
||||
struct st_mysqlnd_packet_sha256_pk_request;
|
||||
struct st_mysqlnd_packet_sha256_pk_request_response;
|
||||
struct st_mysqlnd_packet_cached_sha2_result;
|
||||
|
||||
typedef struct st_mysqlnd_packet_greet * (*func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_auth * (*func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
@@ -986,6 +987,7 @@ typedef struct st_mysqlnd_packet_prepare_response *(*func_mysqlnd_protocol_paylo
|
||||
typedef struct st_mysqlnd_packet_chg_user_resp*(*func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request_response *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result *(*func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
|
||||
typedef enum_func_status (*func_mysqlnd_protocol_payload_decoder_factory__send_command)(
|
||||
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory,
|
||||
@@ -1043,6 +1045,7 @@ MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory)
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet get_change_user_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet get_sha256_pk_request_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet get_sha256_pk_request_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet get_cached_sha2_result_packet;
|
||||
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command send_command;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command_handle_response send_command_handle_response;
|
||||
@@ -1355,11 +1358,18 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
|
||||
const MYSQLND_PFC_DATA * const pfc_data, zend_ulong mysql_flags
|
||||
);
|
||||
|
||||
typedef void (*func_auth_plugin__handle_server_response)(struct st_mysqlnd_authentication_plugin * self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len);
|
||||
|
||||
struct st_mysqlnd_authentication_plugin
|
||||
{
|
||||
struct st_mysqlnd_plugin_header plugin_header;
|
||||
struct {
|
||||
func_auth_plugin__get_auth_data get_auth_data;
|
||||
func_auth_plugin__handle_server_response handle_server_response;
|
||||
} methods;
|
||||
};
|
||||
|
||||
|
||||
@@ -2273,7 +2273,85 @@ php_mysqlnd_sha256_pk_request_response_free_mem(void * _packet, zend_bool stack_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static
|
||||
size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
#ifndef _MSC_VER
|
||||
zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1];
|
||||
#else
|
||||
ALLOCA_FLAG(use_heap)
|
||||
zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap);
|
||||
#endif
|
||||
size_t sent;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_write");
|
||||
|
||||
if (packet->request == 1) {
|
||||
int1store(buffer + MYSQLND_HEADER_SIZE, '\2');
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, 1, stats, error_info);
|
||||
} else {
|
||||
memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len);
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free_alloca(buffer, use_heap);
|
||||
#endif
|
||||
|
||||
DBG_RETURN(sent);
|
||||
}
|
||||
|
||||
static enum_func_status
|
||||
php_mysqlnd_cached_sha2_result_read(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
MYSQLND_CONNECTION_STATE * connection_state = packet->header.connection_state;
|
||||
zend_uchar buf[SHA256_PK_REQUEST_RESP_BUFFER_SIZE];
|
||||
zend_uchar *p = buf;
|
||||
const zend_uchar * const begin = buf;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_read");
|
||||
if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, connection_state, buf, sizeof(buf), "PROT_CACHED_SHA2_RESULT_PACKET", PROT_CACHED_SHA2_RESULT_PACKET)) {
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->response_code = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->result = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
DBG_RETURN(PASS);
|
||||
|
||||
premature_end:
|
||||
DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
|
||||
php_error_docref(NULL, E_WARNING, "SHA256_PK_REQUEST_RESPONSE packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
|
||||
p - begin - packet->header.size);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
static void
|
||||
php_mysqlnd_cached_sha2_result_free_mem(void * _packet, zend_bool stack_allocation)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * p = (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
|
||||
if (!stack_allocation) {
|
||||
mnd_pefree(p, p->header.persistent);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ packet_methods */
|
||||
static
|
||||
mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
@@ -2367,9 +2445,15 @@ mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
php_mysqlnd_sha256_pk_request_response_read,
|
||||
NULL, /* write */
|
||||
php_mysqlnd_sha256_pk_request_response_free_mem,
|
||||
} /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
}, /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
{
|
||||
sizeof(MYSQLND_PACKET_CACHED_SHA2_RESULT),
|
||||
php_mysqlnd_cached_sha2_result_read,
|
||||
php_mysqlnd_cached_sha2_result_write,
|
||||
php_mysqlnd_cached_sha2_result_free_mem
|
||||
} /* PROT_CACHED_SHA2_RESULT_PACKET */
|
||||
};
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::get_greet_packet */
|
||||
@@ -2718,6 +2802,30 @@ MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet)(MYSQLND_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_protocol::init_cached_sha2_result_packet */
|
||||
static struct st_mysqlnd_packet_cached_sha2_result *
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet)
|
||||
(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent)
|
||||
{
|
||||
struct st_mysqlnd_packet_cached_sha2_result * packet = mnd_pecalloc(1, packet_methods[PROT_CACHED_SHA2_RESULT_PACKET].struct_size, persistent);
|
||||
DBG_ENTER("mysqlnd_protocol::init_cached_sha2_result_packet");
|
||||
if (packet) {
|
||||
memset(packet, 0, sizeof(*packet));
|
||||
packet->header.m = &packet_methods[PROT_CACHED_SHA2_RESULT_PACKET];
|
||||
packet->header.factory = factory;
|
||||
|
||||
packet->header.protocol_frame_codec = factory->conn->protocol_frame_codec;
|
||||
packet->header.vio = factory->conn->vio;
|
||||
packet->header.stats = factory->conn->stats;
|
||||
packet->header.error_info = factory->conn->error_info;
|
||||
packet->header.connection_state = &factory->conn->state;
|
||||
|
||||
packet->header.persistent = persistent;
|
||||
}
|
||||
DBG_RETURN(packet);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::send_command */
|
||||
static enum_func_status
|
||||
@@ -2948,6 +3056,7 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_protocol_payload_decoder_factory)
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_change_user_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet),
|
||||
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command_handle_response),
|
||||
|
||||
@@ -292,6 +292,16 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response {
|
||||
size_t public_key_len;
|
||||
} MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE;
|
||||
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result {
|
||||
MYSQLND_PACKET_HEADER header;
|
||||
uint8_t response_code;
|
||||
uint8_t result;
|
||||
uint8_t request;
|
||||
zend_uchar * password;
|
||||
size_t password_len;
|
||||
} MYSQLND_PACKET_CACHED_SHA2_RESULT;
|
||||
|
||||
|
||||
|
||||
zend_ulong php_mysqlnd_net_field_length(const zend_uchar **packet);
|
||||
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, const uint64_t length);
|
||||
|
||||
@@ -1020,6 +1020,11 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array)
|
||||
}
|
||||
if (i != j) {
|
||||
op_array->last_try_catch = j;
|
||||
if (j == 0) {
|
||||
efree(op_array->try_catch_array);
|
||||
op_array->try_catch_array = NULL;
|
||||
}
|
||||
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
zend_op *opline = new_opcodes;
|
||||
zend_op *end = opline + len;
|
||||
|
||||
@@ -171,12 +171,13 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa)
|
||||
while (i < end) {
|
||||
shiftlist[i] = i - target;
|
||||
if (EXPECTED(op_array->opcodes[i].opcode != ZEND_NOP) ||
|
||||
/*keep NOP to support ZEND_VM_SMART_BRANCH */
|
||||
(i > 0 &&
|
||||
/* Keep NOP to support ZEND_VM_SMART_BRANCH. Using "target-1" instead of
|
||||
* "i-1" here to check the last non-NOP instruction. */
|
||||
(target > 0 &&
|
||||
i + 1 < op_array->last &&
|
||||
(op_array->opcodes[i+1].opcode == ZEND_JMPZ ||
|
||||
op_array->opcodes[i+1].opcode == ZEND_JMPNZ) &&
|
||||
zend_is_smart_branch(op_array->opcodes + i - 1))) {
|
||||
zend_is_smart_branch(op_array->opcodes + target - 1))) {
|
||||
if (i != target) {
|
||||
op_array->opcodes[target] = op_array->opcodes[i];
|
||||
ssa->ops[target] = ssa->ops[i];
|
||||
|
||||
@@ -155,6 +155,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
|
||||
case ZEND_SEND_REF:
|
||||
case ZEND_SEND_VAR_NO_REF:
|
||||
case ZEND_SEND_VAR_NO_REF_EX:
|
||||
case ZEND_SEND_USER:
|
||||
if (call_info) {
|
||||
uint32_t num = opline->op2.num;
|
||||
|
||||
@@ -165,9 +166,11 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
|
||||
}
|
||||
break;
|
||||
case ZEND_SEND_ARRAY:
|
||||
case ZEND_SEND_USER:
|
||||
case ZEND_SEND_UNPACK:
|
||||
/* TODO: set info about var_arg call ??? */
|
||||
if (call_info) {
|
||||
call_info->num_args = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
opline++;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id:$ */
|
||||
|
||||
#include "php.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_extensions.h"
|
||||
@@ -79,9 +77,11 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa
|
||||
tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
}
|
||||
return tmp;
|
||||
} else {
|
||||
} else if (call_info->num_args != -1) {
|
||||
/* warning, and returns NULL */
|
||||
return FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
} else {
|
||||
return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,11 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa
|
||||
if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args &&
|
||||
call_info->num_args == 1) {
|
||||
return MAY_BE_RC1 | MAY_BE_STRING;
|
||||
} else {
|
||||
} else if (call_info->num_args != -1) {
|
||||
/* warning, and returns NULL */
|
||||
return FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
} else {
|
||||
return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2480,7 +2480,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
|
||||
|
||||
if (opline->extended_value == ZEND_ASSIGN_DIM) {
|
||||
if (opline->op1_type == IS_CV) {
|
||||
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op1_type);
|
||||
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op2_type);
|
||||
UPDATE_SSA_TYPE(orig, ssa_ops[i].op1_def);
|
||||
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #76275: Assertion failure in file cache when unserializing empty try_catch_array
|
||||
--INI--
|
||||
opcache.enabled=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_cache=/tmp
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
echo "Done";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_callable('random_bytes')) {
|
||||
try {
|
||||
} catch (com_exception $e) {
|
||||
}
|
||||
|
||||
function random_bytes($length)
|
||||
{
|
||||
throw new Exception(
|
||||
'There is no suitable CSPRNG installed on your system'
|
||||
);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #76281: Opcache causes incorrect "undefined variable" errors
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($r, $action) {
|
||||
$user_sub_resource = in_array($action, array('get_securityquestions', 'get_status', 'get_groupstats'));
|
||||
|
||||
$user_id = null;
|
||||
if ($user_sub_resource && isset($r['user_id'])) {
|
||||
$user_id = $r['user_id'];
|
||||
}
|
||||
else if (isset($r['id'])) {
|
||||
$user_id = $r['id'];
|
||||
}
|
||||
|
||||
if ($user_sub_resource) {
|
||||
return 'foo';
|
||||
}
|
||||
|
||||
return 'bar';
|
||||
}
|
||||
|
||||
var_dump(test(['user_id' => 1, 'id' => 2], 'foo'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "bar"
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #76477 (Opcache causes empty return value)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
testString();
|
||||
function testString()
|
||||
{
|
||||
$token = "ABC";
|
||||
$lengthBytes = strlenb($token);
|
||||
var_dump($lengthBytes == 0);
|
||||
}
|
||||
|
||||
function strlenb() { return call_user_func_array("strlen", func_get_args()); }
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -7,16 +7,22 @@ function php_cli_server_start($ini = "") {
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => array("pipe", "w"),
|
||||
);
|
||||
|
||||
$cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS;
|
||||
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
|
||||
} else {
|
||||
$descriptorspec = array(
|
||||
0 => STDIN,
|
||||
1 => STDOUT,
|
||||
2 => STDERR,
|
||||
);
|
||||
|
||||
$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
|
||||
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
|
||||
}
|
||||
|
||||
@@ -96,8 +96,10 @@ static int zend_file_cache_flock(int fd, int type)
|
||||
|
||||
#define IS_SERIALIZED_INTERNED(ptr) \
|
||||
((size_t)(ptr) & Z_UL(1))
|
||||
|
||||
/* Allowing == here to account for a potential empty allocation at the end of the memory */
|
||||
#define IS_SERIALIZED(ptr) \
|
||||
((char*)(ptr) < (char*)script->size)
|
||||
((char*)(ptr) <= (char*)script->size)
|
||||
#define IS_UNSERIALIZED(ptr) \
|
||||
(((char*)(ptr) >= (char*)script->mem && (char*)(ptr) < (char*)script->mem + script->size) || \
|
||||
IS_ACCEL_INTERNED(ptr))
|
||||
@@ -533,14 +535,13 @@ static void zend_file_cache_serialize_prop_info(zval *zv,
|
||||
prop = Z_PTR_P(zv);
|
||||
UNSERIALIZE_PTR(prop);
|
||||
|
||||
if (prop->ce && !IS_SERIALIZED(prop->ce)) {
|
||||
ZEND_ASSERT(prop->ce != NULL && prop->name != NULL);
|
||||
if (!IS_SERIALIZED(prop->ce)) {
|
||||
SERIALIZE_PTR(prop->ce);
|
||||
}
|
||||
if (prop->name && !IS_SERIALIZED(prop->name)) {
|
||||
SERIALIZE_STR(prop->name);
|
||||
}
|
||||
if (prop->doc_comment && !IS_SERIALIZED(prop->doc_comment)) {
|
||||
SERIALIZE_STR(prop->doc_comment);
|
||||
if (prop->doc_comment) {
|
||||
SERIALIZE_STR(prop->doc_comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,12 +558,15 @@ static void zend_file_cache_serialize_class_constant(zval *z
|
||||
c = Z_PTR_P(zv);
|
||||
UNSERIALIZE_PTR(c);
|
||||
|
||||
zend_file_cache_serialize_zval(&c->value, script, info, buf);
|
||||
if (c->ce && !IS_SERIALIZED(c->ce)) {
|
||||
ZEND_ASSERT(c->ce != NULL);
|
||||
if (!IS_SERIALIZED(c->ce)) {
|
||||
SERIALIZE_PTR(c->ce);
|
||||
}
|
||||
if (c->doc_comment && !IS_SERIALIZED(c->doc_comment)) {
|
||||
SERIALIZE_STR(c->doc_comment);
|
||||
|
||||
zend_file_cache_serialize_zval(&c->value, script, info, buf);
|
||||
|
||||
if (c->doc_comment) {
|
||||
SERIALIZE_STR(c->doc_comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1157,14 +1161,13 @@ static void zend_file_cache_unserialize_prop_info(zval *zv,
|
||||
UNSERIALIZE_PTR(Z_PTR_P(zv));
|
||||
prop = Z_PTR_P(zv);
|
||||
|
||||
if (prop->ce && !IS_UNSERIALIZED(prop->ce)) {
|
||||
ZEND_ASSERT(prop->ce != NULL && prop->name != NULL);
|
||||
if (!IS_UNSERIALIZED(prop->ce)) {
|
||||
UNSERIALIZE_PTR(prop->ce);
|
||||
}
|
||||
if (prop->name && !IS_UNSERIALIZED(prop->name)) {
|
||||
UNSERIALIZE_STR(prop->name);
|
||||
}
|
||||
if (prop->doc_comment && !IS_UNSERIALIZED(prop->doc_comment)) {
|
||||
UNSERIALIZE_STR(prop->doc_comment);
|
||||
if (prop->doc_comment) {
|
||||
UNSERIALIZE_STR(prop->doc_comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1179,12 +1182,15 @@ static void zend_file_cache_unserialize_class_constant(zval *
|
||||
UNSERIALIZE_PTR(Z_PTR_P(zv));
|
||||
c = Z_PTR_P(zv);
|
||||
|
||||
zend_file_cache_unserialize_zval(&c->value, script, buf);
|
||||
if (c->ce && !IS_UNSERIALIZED(c->ce)) {
|
||||
ZEND_ASSERT(c->ce != NULL);
|
||||
if (!IS_UNSERIALIZED(c->ce)) {
|
||||
UNSERIALIZE_PTR(c->ce);
|
||||
}
|
||||
if (c->doc_comment && !IS_UNSERIALIZED(c->doc_comment)) {
|
||||
UNSERIALIZE_STR(c->doc_comment);
|
||||
|
||||
zend_file_cache_unserialize_zval(&c->value, script, buf);
|
||||
|
||||
if (c->doc_comment) {
|
||||
UNSERIALIZE_STR(c->doc_comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -72,7 +72,7 @@
|
||||
#ifdef HAVE_OPENSSL_MD2_H
|
||||
#define OPENSSL_ALGO_MD2 4
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION < 0x10100
|
||||
#define OPENSSL_ALGO_DSS1 5
|
||||
#endif
|
||||
#define OPENSSL_ALGO_SHA224 6
|
||||
@@ -566,7 +566,7 @@ ZEND_GET_MODULE(openssl)
|
||||
#endif
|
||||
|
||||
/* {{{ OpenSSL compatibility functions and macros */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION < 0x10100
|
||||
#define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa
|
||||
#define EVP_PKEY_get0_DH(_pkey) _pkey->pkey.dh
|
||||
#define EVP_PKEY_get0_DSA(_pkey) _pkey->pkey.dsa
|
||||
@@ -683,7 +683,7 @@ static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
|
||||
return M_ASN1_STRING_data(asn1);
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION < 0x10002
|
||||
|
||||
static int X509_get_signature_nid(const X509 *x)
|
||||
{
|
||||
@@ -1243,7 +1243,7 @@ static void php_openssl_dispose_config(struct php_x509_request * req) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if defined(PHP_WIN32) || (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER))
|
||||
#if defined(PHP_WIN32) || PHP_OPENSSL_API_VERSION >= 0x10100
|
||||
#define PHP_OPENSSL_RAND_ADD_TIME() ((void) 0)
|
||||
#else
|
||||
#define PHP_OPENSSL_RAND_ADD_TIME() php_openssl_rand_add_timeval()
|
||||
@@ -1330,7 +1330,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */
|
||||
mdtype = (EVP_MD *) EVP_md2();
|
||||
break;
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION < 0x10100
|
||||
case OPENSSL_ALGO_DSS1:
|
||||
mdtype = (EVP_MD *) EVP_dss1();
|
||||
break;
|
||||
@@ -1461,7 +1461,7 @@ PHP_MINIT_FUNCTION(openssl)
|
||||
#ifdef HAVE_OPENSSL_MD2_H
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION < 0x10100
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
|
||||
@@ -3644,7 +3644,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION >= 0x10100
|
||||
/* Due to changes in OpenSSL 1.1 related to locking when decoding CSR,
|
||||
* the pub key is not changed after assigning. It means if we pass
|
||||
* a private key, it will be returned including the private part.
|
||||
@@ -3655,7 +3655,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
|
||||
/* Retrieve the public key from the CSR */
|
||||
tpubkey = X509_REQ_get_pubkey(csr);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if PHP_OPENSSL_API_VERSION >= 0x10100
|
||||
/* We need to free the CSR as it was duplicated */
|
||||
X509_REQ_free(csr);
|
||||
#endif
|
||||
@@ -3809,6 +3809,9 @@ static EVP_PKEY * php_openssl_evp_from_zval(
|
||||
|
||||
if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
|
||||
filename = Z_STRVAL_P(val) + (sizeof("file://") - 1);
|
||||
if (php_openssl_open_base_dir_chk(filename)) {
|
||||
TMP_CLEAN;
|
||||
}
|
||||
}
|
||||
/* it's an X509 file/cert of some kind, and we need to extract the data from that */
|
||||
if (public_key) {
|
||||
@@ -3835,9 +3838,6 @@ static EVP_PKEY * php_openssl_evp_from_zval(
|
||||
BIO *in;
|
||||
|
||||
if (filename) {
|
||||
if (php_openssl_open_base_dir_chk(filename)) {
|
||||
TMP_CLEAN;
|
||||
}
|
||||
in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
|
||||
} else {
|
||||
in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val));
|
||||
|
||||
@@ -29,6 +29,25 @@ extern zend_module_entry openssl_module_entry;
|
||||
#include "php_version.h"
|
||||
#define PHP_OPENSSL_VERSION PHP_VERSION
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#if defined(LIBRESSL_VERSION_NUMBER)
|
||||
/* LibreSSL version check */
|
||||
#if LIBRESSL_VERSION_NUMBER < 0x20700000L
|
||||
#define PHP_OPENSSL_API_VERSION 0x10001
|
||||
#else
|
||||
#define PHP_OPENSSL_API_VERSION 0x10100
|
||||
#endif
|
||||
#else
|
||||
/* OpenSSL version check */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L
|
||||
#define PHP_OPENSSL_API_VERSION 0x10001
|
||||
#elif OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#define PHP_OPENSSL_API_VERSION 0x10002
|
||||
#else
|
||||
#define PHP_OPENSSL_API_VERSION 0x10100
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define OPENSSL_RAW_DATA 1
|
||||
#define OPENSSL_ZERO_PADDING 2
|
||||
#define OPENSSL_DONT_ZERO_PAD_KEY 4
|
||||
|
||||
+25
-16
@@ -9,28 +9,33 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
|
||||
<?php
|
||||
echo "Creating private key\n";
|
||||
|
||||
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
|
||||
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
|
||||
$privkey = openssl_pkey_new($conf);
|
||||
|
||||
if ($privkey === false)
|
||||
die("failed to create private key");
|
||||
if ($privkey === false) {
|
||||
die("failed to create private key");
|
||||
}
|
||||
|
||||
$passphrase = "banana";
|
||||
$key_file_name = tempnam(sys_get_temp_dir(), "ssl");
|
||||
if ($key_file_name === false)
|
||||
die("failed to get a temporary filename!");
|
||||
$key_file_name = __DIR__ . '/001-tmp.key';
|
||||
if ($key_file_name === false) {
|
||||
die("failed to get a temporary filename!");
|
||||
}
|
||||
|
||||
echo "Export key to file\n";
|
||||
|
||||
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
|
||||
if (!openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf)) {
|
||||
die("failed to export to file $key_file_name");
|
||||
}
|
||||
var_dump(is_resource($privkey));
|
||||
|
||||
echo "Load key from file - array syntax\n";
|
||||
|
||||
$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
|
||||
|
||||
if ($loaded_key === false)
|
||||
die("failed to load key using array syntax");
|
||||
if ($loaded_key === false) {
|
||||
die("failed to load key using array syntax");
|
||||
}
|
||||
|
||||
openssl_pkey_free($loaded_key);
|
||||
|
||||
@@ -38,8 +43,9 @@ echo "Load key using direct syntax\n";
|
||||
|
||||
$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
|
||||
|
||||
if ($loaded_key === false)
|
||||
die("failed to load key using direct syntax");
|
||||
if ($loaded_key === false) {
|
||||
die("failed to load key using direct syntax");
|
||||
}
|
||||
|
||||
openssl_pkey_free($loaded_key);
|
||||
|
||||
@@ -48,15 +54,13 @@ echo "Load key manually and use string syntax\n";
|
||||
$key_content = file_get_contents($key_file_name);
|
||||
$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
|
||||
|
||||
if ($loaded_key === false)
|
||||
die("failed to load key using string syntax");
|
||||
|
||||
if ($loaded_key === false) {
|
||||
die("failed to load key using string syntax");
|
||||
}
|
||||
openssl_pkey_free($loaded_key);
|
||||
|
||||
echo "OK!\n";
|
||||
|
||||
@unlink($key_file_name);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Creating private key
|
||||
@@ -66,3 +70,8 @@ Load key from file - array syntax
|
||||
Load key using direct syntax
|
||||
Load key manually and use string syntax
|
||||
OK!
|
||||
--CLEAN--
|
||||
<?php
|
||||
$key_file_name = __DIR__ . DIRECTORY_SEPARATOR . '001-tmp.key';
|
||||
@unlink($key_file_name);
|
||||
?>
|
||||
Loaded 100 of 330 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user