mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-22 16:35:43 +00:00
Compare commits
145
Commits
php-7.1.18
...
php-7.1.22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f6558bf5d | ||
|
|
c1372ebdf1 | ||
|
|
318a5402c1 | ||
|
|
b791f429db | ||
|
|
7d16058be7 | ||
|
|
b7df57c9f6 | ||
|
|
f669490c58 | ||
|
|
ae5e1923ec | ||
|
|
efb86aef12 | ||
|
|
e29c946c29 | ||
|
|
8754d44167 | ||
|
|
6e1980e152 | ||
|
|
b9bf9ddce6 | ||
|
|
6644bd005f | ||
|
|
32a728d351 | ||
|
|
5fb01a3a42 | ||
|
|
70b2fca220 | ||
|
|
cf2fc66b02 | ||
|
|
4c542e6c13 | ||
|
|
4c448334bd | ||
|
|
3257d22fea | ||
|
|
837ed71c65 | ||
|
|
04c4854fdf | ||
|
|
64c88c1e16 | ||
|
|
8c92442b49 | ||
|
|
1f2f2c6b96 | ||
|
|
e20baee136 | ||
|
|
859f7fce1f | ||
|
|
45a05f3841 | ||
|
|
935625f1b8 | ||
|
|
a3e3d914ed | ||
|
|
4d5edcb4ac | ||
|
|
c8a90606c1 | ||
|
|
b4b14d2106 | ||
|
|
45a3c0e596 | ||
|
|
169a98319a | ||
|
|
0f557756dd | ||
|
|
fd0fc20d35 | ||
|
|
c00f5e6531 | ||
|
|
b71a503844 | ||
|
|
91996e7ee5 | ||
|
|
41c69766a4 | ||
|
|
19592519c2 | ||
|
|
74988eed99 | ||
|
|
2870178720 | ||
|
|
cc69950b15 | ||
|
|
ed7e3bc70a | ||
|
|
40bd84d3e3 | ||
|
|
38d97557da | ||
|
|
2139c2c2de | ||
|
|
99fdf5916e | ||
|
|
9e54d9d692 | ||
|
|
0510b47894 | ||
|
|
e5b27b9916 | ||
|
|
1ba3314335 | ||
|
|
dfc2e3a2ac | ||
|
|
d011da9d1a | ||
|
|
1127163996 | ||
|
|
b52c4fcbcd | ||
|
|
4e92cd172a | ||
|
|
bddf8140e4 | ||
|
|
f151e048ed | ||
|
|
b73a108543 | ||
|
|
289cb0f77c | ||
|
|
3462efa386 | ||
|
|
1baeae4270 | ||
|
|
0f8c1ee76d | ||
|
|
141072a838 | ||
|
|
99fe18503a | ||
|
|
236ae06e0b | ||
|
|
cc7b000d2c | ||
|
|
98102648cb | ||
|
|
9026562c79 | ||
|
|
08f08858f3 | ||
|
|
a820aab9da | ||
|
|
2c43fb49d6 | ||
|
|
ad790bea2e | ||
|
|
47fb17b108 | ||
|
|
ea24847620 | ||
|
|
246cb03e26 | ||
|
|
3847a6fcb6 | ||
|
|
137f22ad36 | ||
|
|
268e801cb1 | ||
|
|
791f07e4f0 | ||
|
|
c97b8bbf82 | ||
|
|
787593b708 | ||
|
|
c793885b76 | ||
|
|
f8258325b4 | ||
|
|
a72bab1b9a | ||
|
|
1118fca75d | ||
|
|
9b0df97a42 | ||
|
|
2eb6a541a9 | ||
|
|
ae04110032 | ||
|
|
962706d16c | ||
|
|
fb09f1341f | ||
|
|
cb97fd3097 | ||
|
|
bf5a802f5a | ||
|
|
f6430e3fe2 | ||
|
|
88b5df91f6 | ||
|
|
19b4fa17d3 | ||
|
|
1f6b842af4 | ||
|
|
d1b1866a3a | ||
|
|
6b5597f7d8 | ||
|
|
5af0db88fa | ||
|
|
701460ba84 | ||
|
|
b20bcbc363 | ||
|
|
3c42f64e6e | ||
|
|
6531719da5 | ||
|
|
bcf2e10ae7 | ||
|
|
69dee5c732 | ||
|
|
5dd1ef90ca | ||
|
|
11507c0e1b | ||
|
|
e77077edeb | ||
|
|
ea592e6b6c | ||
|
|
62554efffe | ||
|
|
7212829435 | ||
|
|
6c9db02ff7 | ||
|
|
f9d1d1f36f | ||
|
|
e9b8193b24 | ||
|
|
f96df64cb2 | ||
|
|
04db3d0f7a | ||
|
|
d6e81f0bfd | ||
|
|
73bf238507 | ||
|
|
5bf8032112 | ||
|
|
97a8483143 | ||
|
|
34fb42970a | ||
|
|
974c46b89b | ||
|
|
be11b354f4 | ||
|
|
8f221bdec0 | ||
|
|
68c3d09c2c | ||
|
|
bc6ddb7f45 | ||
|
|
83626ef97a | ||
|
|
589f8107e8 | ||
|
|
6043a2d6f7 | ||
|
|
33382dc7ee | ||
|
|
798e707eb3 | ||
|
|
d6bc266ba0 | ||
|
|
b2429259af | ||
|
|
ee0ca6470d | ||
|
|
2d9836a579 | ||
|
|
9b8d8cac04 | ||
|
|
4dedccd8e2 | ||
|
|
ad787626a4 | ||
|
|
d21612401f | ||
|
|
6c3b70e9a5 |
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.8
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
#MYSQL_TEST_USER: root
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -274,6 +274,7 @@ sapi/fpm/fpm/php-cgi
|
||||
sapi/phpdbg/phpdbg_parser.c
|
||||
sapi/phpdbg/phpdbg_parser.h
|
||||
sapi/phpdbg/phpdbg
|
||||
sapi/phpdbg/phpdbg.1
|
||||
scripts/php-config
|
||||
scripts/phpize
|
||||
scripts/man1/*.1
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
dist: trusty
|
||||
language: c
|
||||
sudo: false
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -47,6 +47,8 @@ env:
|
||||
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
|
||||
before_script:
|
||||
# Enable IPv6
|
||||
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
# Setup Extensions
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f php7.spec main/build-defs.h scripts/phpize
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
|
||||
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
|
||||
rm -f ext/phar/phar.phar ext/phar/phar.php
|
||||
|
||||
@@ -1,6 +1,164 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 7.1.18
|
||||
13 Sep 2018, PHP 7.1.22
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76754 (parent private constant in extends class memory leak).
|
||||
(Laruence)
|
||||
. Fixed bug #72443 (Generate enabled extension). (petk)
|
||||
|
||||
- Apache2:
|
||||
. Fixed bug #76582 (Apache bucket brigade sometimes becomes invalid). (stas)
|
||||
|
||||
- Bz2:
|
||||
. Fixed arginfo for bzcompress. (Tyson Andre)
|
||||
|
||||
- gettext:
|
||||
. Fixed bug #76517 (incorrect restoring of LDFLAGS). (sji)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #68180 (iconv_mime_decode can return extra characters in a
|
||||
header). (cmb)
|
||||
. Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers).
|
||||
(cmb)
|
||||
. Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb)
|
||||
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #74484 (MessageFormatter::formatMessage memory corruption with
|
||||
11+ named placeholders). (Anatol)
|
||||
|
||||
- libxml:
|
||||
. Fixed bug #76777 ("public id" parameter of libxml_set_external_entity_loader
|
||||
callback undefined). (Ville Hukkamäki)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #76704 (mb_detect_order return value varies based on argument
|
||||
type). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76747 (Opcache treats path containing "test.pharma.tld" as a phar
|
||||
file). (Laruence)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #76705 (unusable ssl => peer_fingerprint in
|
||||
stream_context_create()). (Jakub Zelenka)
|
||||
|
||||
- phpdbg:
|
||||
. Fixed bug #76595 (phpdbg man page contains outdated information).
|
||||
(Kevin Abel)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #68825 (Exception in DirectoryIterator::getLinkTarget()). (cmb)
|
||||
. Fixed bug #68175 (RegexIterator pregFlags are NULL instead of 0). (Tim
|
||||
Siebels)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76778 (array_reduce leaks memory if callback throws exception).
|
||||
(cmb)
|
||||
|
||||
- zlib:
|
||||
. Fixed bug #65988 (Zlib version check fails when an include/zlib/ style dir
|
||||
is passed to the --with-zlib configure option). (Jay Bonci)
|
||||
. Fixed bug #76709 (Minimal required zlib library is 1.2.0.4). (petk)
|
||||
|
||||
16 Aug 2018, PHP 7.1.21
|
||||
|
||||
- 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 #68553 (array_column: null values in $index_key become incrementing
|
||||
keys in result). (Laruence)
|
||||
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
|
||||
. 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)
|
||||
|
||||
07 Jul 2018, PHP 7.1.20
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
|
||||
with an error handler). (Laruence)
|
||||
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
|
||||
properly). (Nikita)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
|
||||
|
||||
- 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)
|
||||
|
||||
- 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)
|
||||
|
||||
22 Jun 2018, PHP 7.1.19
|
||||
|
||||
- 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 #76335 ("link(): Bad file descriptor" with non-ASCII path).
|
||||
(Anatol)
|
||||
. Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT). (Bob)
|
||||
|
||||
24 May 2018, PHP 7.1.18
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #76075 --with-fpm-acl wrongly tries to find libacl on FreeBSD.
|
||||
|
||||
+3
-3
@@ -70,7 +70,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
|
||||
#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))
|
||||
@@ -79,7 +79,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 */
|
||||
@@ -90,7 +90,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,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
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #76754 (parent private constant in extends class memory leak)
|
||||
--INI--
|
||||
opcache.enable=0
|
||||
opcache.enable_cli=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class FOO
|
||||
{
|
||||
private const FOO = 'BAR';
|
||||
}
|
||||
|
||||
class BAR extends FOO { }
|
||||
?>
|
||||
okey
|
||||
--EXPECT--
|
||||
okey
|
||||
+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)))
|
||||
|
||||
@@ -1080,6 +1080,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]) {
|
||||
@@ -1614,6 +1617,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, ' ');
|
||||
}
|
||||
|
||||
@@ -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
@@ -1042,9 +1042,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1;
|
||||
zend_class_entry *ce = NULL;
|
||||
|
||||
if (UNEXPECTED(ret_info->type_hint == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
if (ret_info->type_hint == 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_internal_type(zf, ret_info, ret, &ce, 1))) {
|
||||
@@ -1700,7 +1703,9 @@ fetch_from_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, type);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
ZVAL_ERROR(result);
|
||||
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
|
||||
+1
-1
@@ -296,8 +296,8 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
}
|
||||
zend_hash_destroy(&ce->constants_table);
|
||||
if (ce->num_interfaces > 0 && ce->interfaces) {
|
||||
efree(ce->interfaces);
|
||||
}
|
||||
|
||||
+3
-1
@@ -891,7 +891,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
|
||||
|
||||
+24
-8
@@ -17596,7 +17596,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -21014,7 +21016,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -22385,7 +22389,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -25330,7 +25336,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -37055,7 +37063,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -41665,7 +41675,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -44149,7 +44161,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
@@ -48220,7 +48234,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);
|
||||
zend_wrong_string_offset();
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset();
|
||||
}
|
||||
}
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
goto assign_dim_op_convert_to_array;
|
||||
|
||||
+5
-5
@@ -75,7 +75,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
|
||||
#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))
|
||||
@@ -84,7 +84,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 */
|
||||
@@ -95,7 +95,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)
|
||||
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=1
|
||||
PHP_RELEASE_VERSION=18
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=22
|
||||
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--
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_bzerror, 0)
|
||||
ZEND_ARG_INFO(0, bz)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 2)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, source)
|
||||
ZEND_ARG_INFO(0, blocksize)
|
||||
ZEND_ARG_INFO(0, workfactor)
|
||||
|
||||
+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===
|
||||
@@ -82,7 +82,7 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key)
|
||||
}
|
||||
}
|
||||
|
||||
static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
static void com_iter_move_forwards(zend_object_iterator *iter)
|
||||
{
|
||||
struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data);
|
||||
unsigned long n_fetched;
|
||||
@@ -103,18 +103,18 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
} else {
|
||||
/* indicate that there are no more items */
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* safe array */
|
||||
if (I->key >= (ULONG) I->sa_max) {
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
I->key++;
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key) == 0) {
|
||||
I->key = (ulong)-1;
|
||||
return FAILURE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
|
||||
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
|
||||
/* php_com_wrap_variant(ptr, &I->v, I->code_page); */
|
||||
ZVAL_COPY_VALUE(&I->zdata, &ptr);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -514,15 +514,13 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key)
|
||||
}
|
||||
}
|
||||
|
||||
static int saproxy_iter_move_forwards(zend_object_iterator *iter)
|
||||
static void saproxy_iter_move_forwards(zend_object_iterator *iter)
|
||||
{
|
||||
php_com_saproxy_iter *I = (php_com_saproxy_iter*)Z_PTR(iter->data);
|
||||
|
||||
if (++I->key >= I->imax) {
|
||||
I->key = -1;
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static zend_object_iterator_funcs saproxy_iter_funcs = {
|
||||
|
||||
@@ -223,9 +223,9 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
|
||||
}
|
||||
|
||||
/* Type-library stuff */
|
||||
void php_com_typelibrary_dtor(void *pDest)
|
||||
void php_com_typelibrary_dtor(zval *pDest)
|
||||
{
|
||||
ITypeLib **Lib = (ITypeLib**)pDest;
|
||||
ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
|
||||
ITypeLib_Release(*Lib);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage);
|
||||
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
|
||||
int codepage);
|
||||
void php_com_typelibrary_dtor(void *pDest);
|
||||
void php_com_typelibrary_dtor(zval *pDest);
|
||||
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink);
|
||||
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage);
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -4276,6 +4276,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;
|
||||
|
||||
|
||||
+8
-2
@@ -2536,7 +2536,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;
|
||||
}
|
||||
@@ -2715,6 +2718,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
int NumDirEntries, old_motorola_intel, offset_diff;
|
||||
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)) {
|
||||
@@ -2769,6 +2773,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;
|
||||
case MN_OFFSET_GUESS:
|
||||
if (maker_note->offset + 10 + 4 >= value_len) {
|
||||
@@ -2785,6 +2790,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;
|
||||
default:
|
||||
case MN_OFFSET_NORMAL:
|
||||
@@ -2798,7 +2804,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;
|
||||
}
|
||||
}
|
||||
|
||||
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(count(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
|
||||
int(1)
|
||||
DONE
|
||||
+3
-3
@@ -120,9 +120,9 @@ dnl [ --with-$extname Include $extname support])
|
||||
|
||||
dnl Otherwise use enable:
|
||||
|
||||
dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
|
||||
PHP_ARG_ENABLE($extname, whether to enable $extname support,
|
||||
dnl Make sure that the comment is aligned:
|
||||
dnl [ --enable-$extname Enable $extname support])
|
||||
[ --enable-$extname Enable $extname support])
|
||||
|
||||
if test "\$PHP_$EXTNAME" != "no"; then
|
||||
dnl Write more examples of tests here...
|
||||
@@ -179,7 +179,7 @@ cat >config.w32 <<eof
|
||||
// ARG_WITH("$extname", "for $extname support", "no");
|
||||
|
||||
// Otherwise, use ARG_ENABLE
|
||||
// ARG_ENABLE("$extname", "enable $extname support", "no");
|
||||
ARG_ENABLE("$extname", "enable $extname support", "no");
|
||||
|
||||
if (PHP_$EXTNAME != "no") {
|
||||
EXTENSION("$extname", "$extname.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,6 @@ if test "$PHP_GETTEXT" != "no"; then
|
||||
PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
|
||||
PHP_SUBST(GETTEXT_SHARED_LIBADD)
|
||||
|
||||
if test -n "$GETTEXT_LIBS"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($GETTEXT_INCDIR)
|
||||
|
||||
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext, [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])])
|
||||
@@ -47,4 +43,7 @@ if test "$PHP_GETTEXT" != "no"; then
|
||||
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset, [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])])
|
||||
LDFLAGS=$O_LDFLAGS
|
||||
|
||||
if test -n "$GETTEXT_LIBS"; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
|
||||
fi
|
||||
fi
|
||||
@@ -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()); }
|
||||
|
||||
?>
|
||||
|
||||
+26
-3
@@ -466,7 +466,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
|
||||
|
||||
if (in_p != NULL) {
|
||||
while (in_left > 0) {
|
||||
out_left = buf_growth - out_left;
|
||||
out_left = buf_growth;
|
||||
smart_str_alloc(d, out_left, 0);
|
||||
|
||||
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
|
||||
@@ -500,7 +500,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
out_left = buf_growth - out_left;
|
||||
out_left = buf_growth;
|
||||
smart_str_alloc(d, out_left, 0);
|
||||
|
||||
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
|
||||
@@ -1544,7 +1544,10 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
break;
|
||||
|
||||
default: /* first letter of a non-encoded word */
|
||||
_php_iconv_appendc(pretval, *p1, cd_pl);
|
||||
err = _php_iconv_appendc(pretval, *p1, cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
encoded_word = NULL;
|
||||
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
|
||||
scan_stat = 12;
|
||||
@@ -1555,6 +1558,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
|
||||
case 1: /* expecting a delimiter */
|
||||
if (*p1 != '?') {
|
||||
if (*p1 == '\r' || *p1 == '\n') {
|
||||
--p1;
|
||||
}
|
||||
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
@@ -1580,6 +1586,23 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
case '*': /* new style delimiter: locale id follows */
|
||||
scan_stat = 10;
|
||||
break;
|
||||
|
||||
case '\r': case '\n': /* not an encoded-word */
|
||||
--p1;
|
||||
_php_iconv_appendc(pretval, '=', cd_pl);
|
||||
_php_iconv_appendc(pretval, '?', cd_pl);
|
||||
err = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl);
|
||||
if (err != PHP_ICONV_ERR_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
csname = NULL;
|
||||
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
|
||||
scan_stat = 12;
|
||||
}
|
||||
else {
|
||||
scan_stat = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (scan_stat != 2) {
|
||||
char tmpbuf[80];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #55146 (iconv_mime_decode_headers() skips some headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: H4sIAAAAAAAAA+NgFlsCAAA=
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
|
||||
|
||||
$headers = <<< HEADERS
|
||||
X-Header-One: =
|
||||
X-Header-Two: XtLePq6GTMn8G68F0
|
||||
HEADERS;
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(24) "H4sIAAAAAAAAA+NgFlsCAAA="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
array(2) {
|
||||
["X-Header-One"]=>
|
||||
string(1) "="
|
||||
["X-Header-Two"]=>
|
||||
string(17) "XtLePq6GTMn8G68F0"
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #60494 (iconv_mime_decode does ignore special characters)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(iconv_mime_decode('ä'));
|
||||
var_dump(iconv_mime_decode('ö'));
|
||||
var_dump(iconv_mime_decode('ß'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
Bug #63839 (iconv_mime_decode_headers function is skipping headers)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$headers = 'From: "xyz" <xyz@xyz.com>
|
||||
To: <xyz@xyz.com>
|
||||
Subject: Reply Is? white side-LED =? in Help
|
||||
Date: Sat, 22 Dec 2012
|
||||
Message-ID: <006f01cde00e$d9f79da0$8de6d8e0>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/alternative;
|
||||
boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
|
||||
X-Mailer: Microsoft Office Outlook 12.0
|
||||
Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
|
||||
Content-Language: en-us
|
||||
|
||||
';
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
|
||||
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(10) {
|
||||
["From"]=>
|
||||
string(19) ""xyz" <xyz@xyz.com>"
|
||||
["To"]=>
|
||||
string(13) "<xyz@xyz.com>"
|
||||
["Subject"]=>
|
||||
string(35) "Reply Is? white side-LED =? in Help"
|
||||
["Date"]=>
|
||||
string(16) "Sat, 22 Dec 2012"
|
||||
["Message-ID"]=>
|
||||
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
|
||||
["MIME-Version"]=>
|
||||
string(3) "1.0"
|
||||
["Content-Type"]=>
|
||||
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
|
||||
["X-Mailer"]=>
|
||||
string(29) "Microsoft Office Outlook 12.0"
|
||||
["Thread-Index"]=>
|
||||
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
|
||||
["Content-Language"]=>
|
||||
string(5) "en-us"
|
||||
}
|
||||
array(10) {
|
||||
["From"]=>
|
||||
string(19) ""xyz" <xyz@xyz.com>"
|
||||
["To"]=>
|
||||
string(13) "<xyz@xyz.com>"
|
||||
["Subject"]=>
|
||||
string(35) "Reply Is? white side-LED =? in Help"
|
||||
["Date"]=>
|
||||
string(16) "Sat, 22 Dec 2012"
|
||||
["Message-ID"]=>
|
||||
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
|
||||
["MIME-Version"]=>
|
||||
string(3) "1.0"
|
||||
["Content-Type"]=>
|
||||
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
|
||||
["X-Mailer"]=>
|
||||
string(29) "Microsoft Office Outlook 12.0"
|
||||
["Thread-Index"]=>
|
||||
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
|
||||
["Content-Language"]=>
|
||||
string(5) "en-us"
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #68180 (iconv_mime_decode can return extra characters in a header)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip iconv extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$original = "=?UTF-8?Q?=E3=80=8E=E3=80=90=E5=A4=96=E8=B3=87=E7=B3=BB=E6=88=A6=E7=95=A5=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=81=8C=E9=9B=86=E7=B5=90=E3=80=91=E3=83=88=E3=83=83=E3=83=97=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=82=BF=E3=83=B3=E3=83=88=E3=81=A8=E8=A9=B1=E3=81=9B=E3=82=8B=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E6=A5=AD=E7=95=8C=E7=A0=94=E7=A9=B6=E3=82=BB=E3=83=9F=E3=83=8A=E3=83=BC=E3=80=8F=E3=81=B8=E3=81=AE=E3=82=A8=E3=83=B3=E3=83=88=E3=83=AA=E3=83=BC=E3=81=82=E3=82=8A=E3=81=8C=E3=81=A8=E3=81=86=E3=81=94=E3=81=96=E3=81=84=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?=";
|
||||
$decoded = iconv_mime_decode($original, ICONV_MIME_DECODE_STRICT, 'utf-8');
|
||||
var_dump($decoded);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(183) "『【外資系戦略コンサルが集結】トップコンサルタントと話せるコンサル業界研究セミナー』へのエントリーありがとうございました。"
|
||||
===DONE===
|
||||
@@ -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);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <unicode/timezone.h>
|
||||
#include <unicode/datefmt.h>
|
||||
#include <unicode/calendar.h>
|
||||
#include <unicode/strenum.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -333,6 +334,24 @@ static void umsg_set_timezone(MessageFormatter_object *mfo,
|
||||
return; /* already done */
|
||||
}
|
||||
|
||||
/* There is a bug in ICU which prevents MessageFormatter::getFormats()
|
||||
to handle more than 10 formats correctly. The enumerator could be
|
||||
used to walk through the present formatters using getFormat(), which
|
||||
however seems to provide just a readonly access. This workaround
|
||||
prevents crash when there are > 10 formats but doesn't set any error.
|
||||
As a result, only DateFormatters with > 10 subformats are affected.
|
||||
This workaround should be ifdef'd out, when the bug has been fixed
|
||||
in ICU. */
|
||||
icu::StringEnumeration* fnames = mf->getFormatNames(err.code);
|
||||
if (!fnames || U_FAILURE(err.code)) {
|
||||
return;
|
||||
}
|
||||
count = fnames->count(err.code);
|
||||
delete fnames;
|
||||
if (count > 10) {
|
||||
return;
|
||||
}
|
||||
|
||||
formats = mf->getFormats(count);
|
||||
|
||||
if (formats == NULL) {
|
||||
|
||||
@@ -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,33 @@
|
||||
--TEST--
|
||||
Bug #74484 MessageFormatter::formatMessage memory corruption with 11+ named placeholder
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$text = "{a} {b} {c} {d} {e} {f} {g} {h} {i} {j} {k} {l}";
|
||||
|
||||
$vars = array(
|
||||
'a' => 1,
|
||||
'b' => 2,
|
||||
'c' => 3,
|
||||
'd' => 4,
|
||||
'e' => 5,
|
||||
'f' => 6,
|
||||
'g' => 7,
|
||||
'h' => 8,
|
||||
'i' => 9,
|
||||
'j' => 10,
|
||||
'k' => 11,
|
||||
'l' => 12
|
||||
);
|
||||
|
||||
var_dump(MessageFormatter::formatMessage('en_US', $text, $vars));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
string(26) "1 2 3 4 5 6 7 8 9 10 11 12"
|
||||
==DONE==
|
||||
@@ -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===
|
||||
@@ -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]
|
||||
|
||||
+2
-2
@@ -591,12 +591,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
|
||||
if (ID != NULL) {
|
||||
ZVAL_STRING(¶ms[0], ID);
|
||||
} else {
|
||||
ZVAL_UNDEF(¶ms[0]);
|
||||
ZVAL_NULL(¶ms[0]);
|
||||
}
|
||||
if (URL != NULL) {
|
||||
ZVAL_STRING(¶ms[1], URL);
|
||||
} else {
|
||||
ZVAL_UNDEF(¶ms[1]);
|
||||
ZVAL_NULL(¶ms[1]);
|
||||
}
|
||||
ctxzv = ¶ms[2];
|
||||
array_init_size(ctxzv, 4);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('libxml')) die('skip');
|
||||
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml=<<<EOF
|
||||
<?xml version="1.0"?>
|
||||
<test/>
|
||||
EOF;
|
||||
|
||||
$xsd=<<<EOF
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="nonexistent.xsd"/>
|
||||
<xs:element name="test"/>
|
||||
</xs:schema>
|
||||
EOF;
|
||||
|
||||
libxml_set_external_entity_loader(function($p,$s,$c) {
|
||||
var_dump($p,$s,$c);
|
||||
die();
|
||||
});
|
||||
|
||||
$dom=new DOMDocument($xml);
|
||||
$dom->schemaValidateSource($xsd);
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
string(15) "nonexistent.xsd"
|
||||
array(4) {
|
||||
["directory"]=>
|
||||
NULL
|
||||
["intSubName"]=>
|
||||
NULL
|
||||
["extSubURI"]=>
|
||||
NULL
|
||||
["extSubSystem"]=>
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -681,7 +681,7 @@ static sapi_post_entry mbstr_post_entries[] = {
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_list()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
@@ -762,7 +762,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
*entry++ = encoding;
|
||||
n++;
|
||||
} else {
|
||||
ret = 0;
|
||||
ret = FAILURE;
|
||||
}
|
||||
}
|
||||
p1 = p2 + 1;
|
||||
@@ -778,7 +778,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
if (return_list) {
|
||||
*return_list = NULL;
|
||||
}
|
||||
ret = 0;
|
||||
ret = FAILURE;
|
||||
}
|
||||
if (return_size) {
|
||||
*return_size = n;
|
||||
@@ -790,7 +790,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
if (return_size) {
|
||||
*return_size = 0;
|
||||
}
|
||||
ret = 0;
|
||||
ret = FAILURE;
|
||||
}
|
||||
efree(tmpstr);
|
||||
}
|
||||
@@ -800,7 +800,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
|
||||
/* }}} */
|
||||
|
||||
/* {{{ static int php_mb_parse_encoding_array()
|
||||
* Return 0 if input contains any illegal encoding, otherwise 1.
|
||||
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
|
||||
* Even if any illegal encoding is detected the result may contain a list
|
||||
* of parsed encodings.
|
||||
*/
|
||||
|
||||
@@ -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) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #76704 (mb_detect_order return value varies based on argument type)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_detect_order('Foo, UTF-8'));
|
||||
var_dump(mb_detect_order(['Foo', 'UTF-8']))
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE===
|
||||
+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;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -618,6 +618,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;
|
||||
};
|
||||
|
||||
|
||||
@@ -2269,7 +2269,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] =
|
||||
@@ -2363,9 +2441,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 */
|
||||
@@ -2714,6 +2798,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
|
||||
@@ -2944,6 +3052,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);
|
||||
|
||||
@@ -2372,7 +2372,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);
|
||||
}
|
||||
|
||||
@@ -1216,6 +1216,13 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zend_bool is_phar_file(zend_string *filename)
|
||||
{
|
||||
return filename && ZSTR_LEN(filename) >= sizeof(".phar") &&
|
||||
!memcmp(ZSTR_VAL(filename) + ZSTR_LEN(filename) - (sizeof(".phar")-1), ".phar", sizeof(".phar")-1) &&
|
||||
!strstr(ZSTR_VAL(filename), "://");
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPCACHE_FILE_CACHE
|
||||
static zend_persistent_script *store_script_in_file_cache(zend_persistent_script *new_persistent_script)
|
||||
{
|
||||
@@ -1240,10 +1247,7 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script
|
||||
|
||||
zend_shared_alloc_destroy_xlat_table();
|
||||
|
||||
new_persistent_script->is_phar =
|
||||
new_persistent_script->script.filename &&
|
||||
strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
|
||||
!strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
|
||||
new_persistent_script->is_phar = is_phar_file(new_persistent_script->script.filename);
|
||||
|
||||
/* Consistency check */
|
||||
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
|
||||
@@ -1359,10 +1363,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
|
||||
|
||||
zend_shared_alloc_destroy_xlat_table();
|
||||
|
||||
new_persistent_script->is_phar =
|
||||
new_persistent_script->script.filename &&
|
||||
strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
|
||||
!strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
|
||||
new_persistent_script->is_phar = is_phar_file(new_persistent_script->script.filename);
|
||||
|
||||
/* Consistency check */
|
||||
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+11
-11
@@ -73,7 +73,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
|
||||
@@ -560,7 +560,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
|
||||
@@ -677,7 +677,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)
|
||||
{
|
||||
@@ -1237,7 +1237,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()
|
||||
@@ -1324,7 +1324,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;
|
||||
@@ -1450,7 +1450,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);
|
||||
@@ -3620,7 +3620,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.
|
||||
@@ -3631,7 +3631,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
|
||||
@@ -3785,6 +3785,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) {
|
||||
@@ -3811,9 +3814,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);
|
||||
?>
|
||||
@@ -2,8 +2,7 @@
|
||||
Bug #28382 (openssl_x509_parse extensions support)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (OPENSSL_VERSION_NUMBER<0x009070af) die("skip");
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -3,22 +3,21 @@ Bug #36732 (add support for req_extensions in openss_csr_new and sign)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$configargs = array(
|
||||
"req_extensions" => "v3_req",
|
||||
"x509_extensions" => "usr_cert",
|
||||
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
|
||||
"req_extensions" => "v3_req",
|
||||
"x509_extensions" => "usr_cert",
|
||||
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
|
||||
);
|
||||
|
||||
$dn = array(
|
||||
"countryName" => "GB",
|
||||
"stateOrProvinceName" => "Berkshire",
|
||||
"localityName" => "Newbury",
|
||||
"organizationName" => "My Company Ltd",
|
||||
"commonName" => "Demo Cert"
|
||||
"countryName" => "GB",
|
||||
"stateOrProvinceName" => "Berkshire",
|
||||
"localityName" => "Newbury",
|
||||
"organizationName" => "My Company Ltd",
|
||||
"commonName" => "Demo Cert"
|
||||
);
|
||||
|
||||
$key = openssl_pkey_new();
|
||||
@@ -29,11 +28,11 @@ $str = '';
|
||||
openssl_csr_export($csr, $str, false);
|
||||
|
||||
if (strpos($str, 'Requested Extensions:')) {
|
||||
echo "Ok\n";
|
||||
echo "Ok\n";
|
||||
}
|
||||
openssl_x509_export($crt, $str, false);
|
||||
if (strpos($str, 'X509v3 extensions:')) {
|
||||
echo "Ok\n";
|
||||
echo "Ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
@@ -3,7 +3,6 @@ openssl_sign/verify: accept different algos
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -15,19 +14,18 @@ $priv_key = file_get_contents($file_key);
|
||||
$priv_key_id = openssl_get_privatekey($priv_key);
|
||||
|
||||
|
||||
|
||||
$pub_key = file_get_contents($file_pub);
|
||||
$pub_key_id = openssl_get_publickey($pub_key);
|
||||
$data = "some custom data";
|
||||
if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
|
||||
echo "openssl_sign failed.";
|
||||
echo "openssl_sign failed.";
|
||||
}
|
||||
|
||||
$ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5);
|
||||
if ($ok == 1) {
|
||||
echo "Ok";
|
||||
echo "Ok";
|
||||
} elseif ($ok == 0) {
|
||||
echo "openssl_verify failed.";
|
||||
echo "openssl_verify failed.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ $signature = '';
|
||||
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
|
||||
|
||||
class test {
|
||||
function __toString() {
|
||||
return "test object";
|
||||
}
|
||||
function __toString() {
|
||||
return "test object";
|
||||
}
|
||||
}
|
||||
$t = new test;
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ if (!extension_loaded("openssl")) die("skip");
|
||||
<?php
|
||||
$cert = false;
|
||||
class test {
|
||||
function __toString() {
|
||||
return "test object";
|
||||
}
|
||||
function __toString() {
|
||||
return "test object";
|
||||
}
|
||||
}
|
||||
$t = new test;
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ if (!extension_loaded("openssl")) die("skip");
|
||||
$dir = dirname(__FILE__);
|
||||
$certs = array('bug39217cert2.txt', 'bug39217cert1.txt');
|
||||
foreach($certs as $cert) {
|
||||
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
|
||||
print_r($res['serialNumber']);
|
||||
echo "\n";
|
||||
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
|
||||
print_r($res['serialNumber']);
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip, openssl required");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -38,5 +38,6 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECT--
|
||||
Sending bug 46127
|
||||
Loaded 100 of 306 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user