mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 02:30:50 +00:00
Compare commits
171
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09aa799e64 | ||
|
|
ee87db285f | ||
|
|
095a30e11b | ||
|
|
e111ef5626 | ||
|
|
2870178720 | ||
|
|
d207d6a57f | ||
|
|
cc69950b15 | ||
|
|
ce66492a13 | ||
|
|
ed7e3bc70a | ||
|
|
a96ca13963 | ||
|
|
40bd84d3e3 | ||
|
|
033dac7a6f | ||
|
|
2a181b5ea0 | ||
|
|
38d97557da | ||
|
|
c20a97df6d | ||
|
|
2139c2c2de | ||
|
|
33eb30274f | ||
|
|
99fdf5916e | ||
|
|
2073e96ec5 | ||
|
|
9e54d9d692 | ||
|
|
ca618a4f10 | ||
|
|
0510b47894 | ||
|
|
e5b27b9916 | ||
|
|
1ba3314335 | ||
|
|
b494d94f16 | ||
|
|
dfc2e3a2ac | ||
|
|
d011da9d1a | ||
|
|
c4106d4569 | ||
|
|
1127163996 | ||
|
|
b52c4fcbcd | ||
|
|
e069b0beba | ||
|
|
ebd5f56442 | ||
|
|
a536d6d61b | ||
|
|
4e92cd172a | ||
|
|
bddf8140e4 | ||
|
|
f151e048ed | ||
|
|
b73a108543 | ||
|
|
289cb0f77c | ||
|
|
3462efa386 | ||
|
|
1baeae4270 | ||
|
|
8efd3c3387 | ||
|
|
0f8c1ee76d | ||
|
|
dee191ee07 | ||
|
|
141072a838 | ||
|
|
f28aeaee05 | ||
|
|
99fe18503a | ||
|
|
77ced46dea | ||
|
|
236ae06e0b | ||
|
|
9443c61928 | ||
|
|
cc7b000d2c | ||
|
|
cc266045a5 | ||
|
|
98102648cb | ||
|
|
a766f65ca3 | ||
|
|
c23736216d | ||
|
|
9026562c79 | ||
|
|
ebb590b625 | ||
|
|
08f08858f3 | ||
|
|
474292c3e4 | ||
|
|
a820aab9da | ||
|
|
a6e8c73c43 | ||
|
|
2c43fb49d6 | ||
|
|
545a29d0cb | ||
|
|
ad790bea2e | ||
|
|
77a841db48 | ||
|
|
5d0d812a53 | ||
|
|
47fb17b108 | ||
|
|
d207fd449c | ||
|
|
1ae888d984 | ||
|
|
ea24847620 | ||
|
|
d85651d58d | ||
|
|
246cb03e26 | ||
|
|
3847a6fcb6 | ||
|
|
137f22ad36 | ||
|
|
268e801cb1 | ||
|
|
f3dc67b255 | ||
|
|
791f07e4f0 | ||
|
|
e5ef7cbe87 | ||
|
|
8bf21adb8c | ||
|
|
9bbb9e537c | ||
|
|
c97b8bbf82 | ||
|
|
3a236d0587 | ||
|
|
787593b708 | ||
|
|
09bb2527e9 | ||
|
|
c793885b76 | ||
|
|
26a33a96fa | ||
|
|
f8258325b4 | ||
|
|
39d668e927 | ||
|
|
a72bab1b9a | ||
|
|
ae163d9a36 | ||
|
|
1118fca75d | ||
|
|
0f1726e45d | ||
|
|
9b0df97a42 | ||
|
|
34deda13a8 | ||
|
|
2eb6a541a9 | ||
|
|
e2285eb542 | ||
|
|
ae04110032 | ||
|
|
deb1bad80f | ||
|
|
962706d16c | ||
|
|
15ad5d31d1 | ||
|
|
ef274e0b60 | ||
|
|
fb09f1341f | ||
|
|
486f18f09e | ||
|
|
cb97fd3097 | ||
|
|
00c0d7702c | ||
|
|
bf5a802f5a | ||
|
|
c5276ad380 | ||
|
|
f6430e3fe2 | ||
|
|
e835916f65 | ||
|
|
88b5df91f6 | ||
|
|
b35f45ded2 | ||
|
|
19b4fa17d3 | ||
|
|
809a7b5f8f | ||
|
|
5d7f9dcca7 | ||
|
|
1f6b842af4 | ||
|
|
7b98d056d3 | ||
|
|
3521661bd1 | ||
|
|
d1b1866a3a | ||
|
|
2458dab466 | ||
|
|
6b5597f7d8 | ||
|
|
096fd88dcb | ||
|
|
5af0db88fa | ||
|
|
14b22704c7 | ||
|
|
701460ba84 | ||
|
|
ed9d1b708b | ||
|
|
4a4c72a82a | ||
|
|
1f726c9925 | ||
|
|
d95ee27551 | ||
|
|
77bd405959 | ||
|
|
b20bcbc363 | ||
|
|
3c42f64e6e | ||
|
|
e62c6e7dbe | ||
|
|
939e1095f2 | ||
|
|
6531719da5 | ||
|
|
011be49dda | ||
|
|
bcf2e10ae7 | ||
|
|
44f4d2be01 | ||
|
|
69dee5c732 | ||
|
|
61a4fc4e44 | ||
|
|
5dd1ef90ca | ||
|
|
13e9a471d7 | ||
|
|
f31ba7cb53 | ||
|
|
dad8bd5851 | ||
|
|
11507c0e1b | ||
|
|
d04a1e8d70 | ||
|
|
e77077edeb | ||
|
|
dd622f9ca9 | ||
|
|
bc58ba750f | ||
|
|
ea592e6b6c | ||
|
|
827cb0484e | ||
|
|
87cb883563 | ||
|
|
62554efffe | ||
|
|
5f1190684f | ||
|
|
7212829435 | ||
|
|
eb2a3c6c65 | ||
|
|
075e685439 | ||
|
|
7dcfa839c9 | ||
|
|
3d7284d09e | ||
|
|
6c9db02ff7 | ||
|
|
bca6d373fc | ||
|
|
66badcdc0c | ||
|
|
3fdde65617 | ||
|
|
e029019275 | ||
|
|
ad52ec3db8 | ||
|
|
695b8192c7 | ||
|
|
f9d1d1f36f | ||
|
|
e9b8193b24 | ||
|
|
0bafb530d6 | ||
|
|
f96df64cb2 | ||
|
|
04db3d0f7a | ||
|
|
d6e81f0bfd | ||
|
|
917222f395 |
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.5
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.7
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
dist: trusty
|
||||
language: c
|
||||
sudo: false
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -50,6 +50,8 @@ before_script:
|
||||
- ccache --version
|
||||
- ccache --zero-stats
|
||||
- export USE_CCACHE=1
|
||||
# Enable IPv6
|
||||
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
# Setup Extensions
|
||||
|
||||
@@ -1,6 +1,102 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
07 Jun 2018, PHP 7.2.7RC1
|
||||
02 Aug 2018, PHP 7.2.9RC1
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
|
||||
(cmb)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
|
||||
(ZiHang Gao)
|
||||
|
||||
- PDO_Firebird:
|
||||
. Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis)
|
||||
|
||||
- PDO_PgSQL:
|
||||
. Fixed bug #75402 (Possible Memory Leak using PDO::CURSOR_SCROLL option).
|
||||
(Anatol)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle).
|
||||
(cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
|
||||
. Fixed bug #68553 (array_column: null values in $index_key become incrementing
|
||||
keys in result). (Laruence)
|
||||
. Fixed bug #76643 (Segmentation fault when using `output_add_rewrite_var`).
|
||||
(cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
|
||||
(Timur Ibragimov)
|
||||
|
||||
19 Jul 2018, PHP 7.2.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
|
||||
with an error handler). (Laruence)
|
||||
. Fixed bug #76520 (Object creation leaks memory when executed over HTTP).
|
||||
(Nikita)
|
||||
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
|
||||
properly). (Nikita)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #76409 (heap use after free in _php_stream_free). (cmb)
|
||||
. Fixed bug #76423 (Int Overflow lead to Heap OverFlow in
|
||||
exif_thumbnail_extract of exif.c). (Stas)
|
||||
. Fixed bug #76557 (heap-buffer-overflow (READ of size 48) while reading exif
|
||||
data). (Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
|
||||
non-blocking). (Nikita)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #74670 (Integer Underflow when unserializing GMP and possible
|
||||
other classes). (Nikita)
|
||||
|
||||
- intl:
|
||||
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
|
||||
type). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #76532 (Integer overflow and excessive memory usage
|
||||
in mb_strimwidth). (MarcusSchwarz)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #76477 (Opcache causes empty return value).
|
||||
(Nikita, Laruence)
|
||||
|
||||
- PGSQL:
|
||||
. Fixed bug #76548 (pg_fetch_result did not fetch the next row). (Anatol)
|
||||
|
||||
- phpdbg:
|
||||
. Fix arginfo wrt. optional/required parameters. (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
|
||||
error handler). (Laruence)
|
||||
. Fixed bug #75231 (ReflectionProperty#getValue() incorrectly works with
|
||||
inherited classes). (Nikita)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
|
||||
(Laruence)
|
||||
. Fixed bug #71848 (getimagesize with $imageinfo returns false). (cmb)
|
||||
|
||||
- Win32:
|
||||
. Fixed bug #76459 (windows linkinfo lacks openbasedir check). (Anatol)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).
|
||||
(Dennis Birkholz, Remi)
|
||||
|
||||
07 Jun 2018, PHP 7.2.7
|
||||
|
||||
- Core:
|
||||
. Fixed bug #76337 (segfault when opcache enabled + extension use
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
|
||||
@@ -20,7 +20,7 @@ assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
}));
|
||||
|
||||
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
|
||||
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = "aaa";
|
||||
@@ -161,7 +161,7 @@ Warning: assert(): assert(0 && ($a = function () {
|
||||
yield from $x;
|
||||
})) failed in %sexpect_015.php on line %d
|
||||
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
|
||||
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
|
||||
abstract class A extends B implements C, D {
|
||||
const X = 12;
|
||||
const Y = self::X, Z = 'aaa';
|
||||
|
||||
@@ -0,0 +1,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
|
||||
+8
-1
@@ -195,7 +195,14 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
|
||||
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
|
||||
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
|
||||
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
|
||||
#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
|
||||
#define pefree_size(ptr, size, persistent) do { \
|
||||
if (persistent) { \
|
||||
free(ptr); \
|
||||
} else { \
|
||||
efree_size(ptr, size);\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
|
||||
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
|
||||
#define perealloc2(ptr, size, copy_size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc2((ptr), (size), (copy_size)))
|
||||
|
||||
@@ -1076,6 +1076,9 @@ tail_call:
|
||||
zend_ast_export_ex(str, decl->child[1], 0, indent);
|
||||
if (decl->child[3]) {
|
||||
smart_str_appends(str, ": ");
|
||||
if (decl->child[3]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, decl->child[3], 0, indent);
|
||||
}
|
||||
if (decl->child[2]) {
|
||||
@@ -1610,6 +1613,9 @@ simple_list:
|
||||
break;
|
||||
case ZEND_AST_PARAM:
|
||||
if (ast->child[0]) {
|
||||
if (ast->child[0]->attr & ZEND_TYPE_NULLABLE) {
|
||||
smart_str_appendc(str, '?');
|
||||
}
|
||||
zend_ast_export_ns_name(str, ast->child[0], 0, indent);
|
||||
smart_str_appendc(str, ' ');
|
||||
}
|
||||
|
||||
+2
-2
@@ -968,8 +968,8 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
|
||||
#define ZEND_RETURN_REF 1
|
||||
|
||||
|
||||
#define ZEND_RETURNS_FUNCTION 1<<0
|
||||
#define ZEND_RETURNS_VALUE 1<<1
|
||||
#define ZEND_RETURNS_FUNCTION (1<<0)
|
||||
#define ZEND_RETURNS_VALUE (1<<1)
|
||||
|
||||
#define ZEND_ARRAY_ELEMENT_REF (1<<0)
|
||||
#define ZEND_ARRAY_NOT_PACKED (1<<1)
|
||||
|
||||
@@ -323,7 +323,7 @@ ZEND_METHOD(exception, __wakeup)
|
||||
CHECK_EXC_TYPE(ZEND_STR_TRACE, IS_ARRAY);
|
||||
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
|
||||
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
|
||||
!instanceof_function(Z_OBJCE_P(pvalue), zend_ce_throwable) ||
|
||||
pvalue == object)) {
|
||||
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
|
||||
}
|
||||
|
||||
+9
-4
@@ -990,9 +990,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
|
||||
zend_class_entry *ce = NULL;
|
||||
void *dummy_cache_slot = NULL;
|
||||
|
||||
if (UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
|
||||
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
|
||||
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
|
||||
@@ -1651,7 +1654,9 @@ fetch_from_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
ZVAL_ERROR(result);
|
||||
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
|
||||
@@ -142,6 +142,7 @@ void init_executor(void) /* {{{ */
|
||||
EG(in_autoload) = NULL;
|
||||
EG(autoload_func) = NULL;
|
||||
EG(error_handling) = EH_NORMAL;
|
||||
EG(flags) = EG_FLAGS_INITIAL;
|
||||
|
||||
zend_vm_stack_init();
|
||||
|
||||
|
||||
+3
-1
@@ -916,7 +916,9 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
+24
-8
@@ -17661,7 +17661,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -20685,7 +20687,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -21999,7 +22003,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -24605,7 +24611,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -35400,7 +35408,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -39558,7 +39568,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -41917,7 +41929,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
@@ -45591,7 +45605,9 @@ assign_dim_op_convert_to_array:
|
||||
zend_throw_error(NULL, "[] operator not supported for strings");
|
||||
} else {
|
||||
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
if (EXPECTED(EG(exception) == NULL)) {
|
||||
zend_wrong_string_offset(EXECUTE_DATA_C);
|
||||
}
|
||||
}
|
||||
UNDEF_RESULT();
|
||||
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
|
||||
|
||||
+4
-4
@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#include <math.h>
|
||||
|
||||
#ifndef zend_isnan
|
||||
#if HAVE_DECL_ISNAN
|
||||
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isnan(a) isnan(a)
|
||||
#elif defined(HAVE_FPCLASS)
|
||||
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
|
||||
@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISINF
|
||||
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_isinf(a) isinf(a)
|
||||
#elif defined(INFINITY)
|
||||
/* Might not work, but is required by ISO C99 */
|
||||
@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
#define zend_isinf(a) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_ISFINITE
|
||||
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
|
||||
#define zend_finite(a) isfinite(a)
|
||||
#elif defined(HAVE_FINITE)
|
||||
#define zend_finite(a) finite(a)
|
||||
@@ -107,7 +107,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=7
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="RC1"
|
||||
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`
|
||||
|
||||
+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===
|
||||
+26
-44
@@ -2358,48 +2358,6 @@ static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
|
||||
return &new_obj->std;
|
||||
} /* }}} */
|
||||
|
||||
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
|
||||
{
|
||||
HashTable *props;
|
||||
zval zv;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
|
||||
tzobj = Z_PHPTIMEZONE_P(object);
|
||||
|
||||
props = zend_std_get_properties(object);
|
||||
|
||||
if (!tzobj->initialized) {
|
||||
return props;
|
||||
}
|
||||
|
||||
ZVAL_LONG(&zv, tzobj->type);
|
||||
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
|
||||
|
||||
switch (tzobj->type) {
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
ZVAL_STRING(&zv, tzobj->tzi.tz->name);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
tzobj->tzi.utc_offset < 0 ? '-' : '+',
|
||||
abs(tzobj->tzi.utc_offset / 3600),
|
||||
abs(((tzobj->tzi.utc_offset % 3600) / 60)));
|
||||
|
||||
ZVAL_NEW_STR(&zv, tmpstr);
|
||||
}
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
ZVAL_STRING(&zv, tzobj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
|
||||
|
||||
return props;
|
||||
} /* }}} */
|
||||
|
||||
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
{
|
||||
switch (tzobj->type) {
|
||||
@@ -2412,8 +2370,8 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
utc_offset < 0 ? '-' : '+',
|
||||
abs(utc_offset / 3600),
|
||||
abs(((utc_offset % 3600) / 60)));
|
||||
abs((int)(utc_offset / 3600)),
|
||||
abs((int)(utc_offset % 3600) / 60));
|
||||
|
||||
ZVAL_NEW_STR(zv, tmpstr);
|
||||
}
|
||||
@@ -2424,6 +2382,29 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
|
||||
}
|
||||
}
|
||||
|
||||
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
|
||||
{
|
||||
HashTable *props;
|
||||
zval zv;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
tzobj = Z_PHPTIMEZONE_P(object);
|
||||
|
||||
props = zend_std_get_properties(object);
|
||||
|
||||
if (!tzobj->initialized) {
|
||||
return props;
|
||||
}
|
||||
|
||||
ZVAL_LONG(&zv, tzobj->type);
|
||||
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
|
||||
|
||||
php_timezone_to_string(tzobj, &zv);
|
||||
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
|
||||
|
||||
return props;
|
||||
} /* }}} */
|
||||
|
||||
static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
|
||||
{
|
||||
HashTable *ht, *props;
|
||||
@@ -4298,6 +4279,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int
|
||||
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
|
||||
/* Fallback to read_property. */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #76462 Undefined property: DateInterval::$f
|
||||
--FILE--
|
||||
<?php
|
||||
$buggy = new DateInterval('P0Y');
|
||||
$buggy->f += 0.01;
|
||||
|
||||
$ok = new DateInterval('P0Y');
|
||||
$ok->f = $ok->f + 0.01;
|
||||
|
||||
var_dump($buggy->f);
|
||||
var_dump($ok->f);
|
||||
?>
|
||||
--EXPECT--
|
||||
float(0.01)
|
||||
float(0.01)
|
||||
@@ -42,7 +42,11 @@ struct _notationIterator {
|
||||
xmlNotation *notation;
|
||||
};
|
||||
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name) /* {{{ */
|
||||
#if LIBXML_VERSION >= 20908
|
||||
static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */
|
||||
#else
|
||||
static void itemHashScanner (void *payload, void *data, xmlChar *name)
|
||||
#endif
|
||||
{
|
||||
nodeIterator *priv = (nodeIterator *)data;
|
||||
|
||||
|
||||
+10
-4
@@ -2944,7 +2944,10 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
|
||||
return;
|
||||
}
|
||||
/* Check to make sure we are not going to go past the ExifLength */
|
||||
if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
|
||||
if (ImageInfo->Thumbnail.size > length
|
||||
|| (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length
|
||||
|| ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size
|
||||
) {
|
||||
EXIF_ERRLOG_THUMBEOF(ImageInfo)
|
||||
return;
|
||||
}
|
||||
@@ -3126,7 +3129,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
#endif
|
||||
const maker_note_type *maker_note;
|
||||
char *dir_start;
|
||||
|
||||
int data_len;
|
||||
|
||||
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -3180,6 +3184,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
switch (maker_note->offset_mode) {
|
||||
case MN_OFFSET_MAKER:
|
||||
offset_base = value_ptr;
|
||||
data_len = value_len;
|
||||
break;
|
||||
#ifdef KALLE_0
|
||||
case MN_OFFSET_GUESS:
|
||||
@@ -3197,6 +3202,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
return FALSE;
|
||||
}
|
||||
offset_base = value_ptr + offset_diff;
|
||||
data_len = value_len - offset_diff;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -3211,7 +3217,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
|
||||
offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -4324,7 +4330,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
|
||||
zend_string *base;
|
||||
if ((st.st_mode & S_IFMT) != S_IFREG) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");
|
||||
php_stream_close(ImageInfo->infile);
|
||||
ImageInfo->infile = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #76409 (heap use after free in _php_stream_free)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data('.');
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(): %s in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #76423 (Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,79 @@
|
||||
--TEST--
|
||||
Bug 76557 (heap-buffer-overflow (READ of size 48) while reading exif data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_read_data(dirname(__FILE__) . "/bug76557.jpg"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x010F=Make ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x8769=Exif_IFD_Po): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x927C=MakerNote ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Invalid JPEG file in %sbug76557.php on line %d
|
||||
bool(false)
|
||||
DONE
|
||||
@@ -621,6 +621,9 @@ static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args,
|
||||
}
|
||||
|
||||
if ((option = zend_hash_str_find(HASH_OF(filter_args), "options", sizeof("options") - 1)) != NULL) {
|
||||
/* avoid reference type */
|
||||
ZVAL_DEREF(option);
|
||||
|
||||
if (filter != FILTER_CALLBACK) {
|
||||
if (Z_TYPE_P(option) == IS_ARRAY) {
|
||||
options = option;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #76366 (references in sub-array for filtering breaks the filter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('filter')) die('skip filter extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
#array to filter
|
||||
$data = ['foo' => 6];
|
||||
|
||||
#filter args
|
||||
$args = [
|
||||
'foo'=> [
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'flags' => FILTER_FORCE_ARRAY
|
||||
]
|
||||
];
|
||||
|
||||
$args['foo']['options'] = [];
|
||||
|
||||
#create reference
|
||||
$options = &$args['foo']['options'];
|
||||
|
||||
#set options
|
||||
$options['min_range'] = 1;
|
||||
$options['max_range'] = 5;
|
||||
|
||||
#show the filter result
|
||||
var_dump(filter_var_array($data, $args));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["foo"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
bool(false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #74670: Integer Underflow when unserializing GMP and possible other classes
|
||||
--FILE--
|
||||
<?php
|
||||
$str = 'C:3:"GMP":4:{s:6666666666:""}';
|
||||
var_dump(unserialize($str));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
|
||||
bool(false)
|
||||
@@ -18,7 +18,7 @@ try {
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
try {
|
||||
unserialize('C:3:"GMP":8:{s:2:"42";}');
|
||||
unserialize('C:3:"GMP":9:{s:2:"42";}');
|
||||
} catch (Exception $e) { var_dump($e->getMessage()); }
|
||||
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -12,35 +12,29 @@ ini_set("intl.default_locale", "ja");
|
||||
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
|
||||
'createSentenceInstance', 'createTitleInstance');
|
||||
|
||||
$t = 'Frase 1... Frase 2'.
|
||||
$t = 'Frase 1... Frase 2';
|
||||
|
||||
$o1 = $o2 = null;
|
||||
foreach ($m as $method) {
|
||||
echo "===== $method =====\n";
|
||||
$o1 = call_user_func(array('IntlBreakIterator', $method), 'ja');
|
||||
var_dump($o1 == $o2);
|
||||
$o2 = call_user_func(array('IntlBreakIterator', $method), NULL);
|
||||
var_dump($o1 == $o2);
|
||||
$o1 = IntlBreakIterator::$method('ja');
|
||||
$o2 = IntlBreakIterator::$method(NULL);
|
||||
$o3 = IntlBreakIterator::$method();
|
||||
var_dump($o1 == $o2 && $o2 == $o3);
|
||||
echo "\n";
|
||||
}
|
||||
--EXPECT--
|
||||
===== createWordInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createLineInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createCharacterInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createSentenceInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
===== createTitleInstance =====
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
@@ -22,22 +22,22 @@ Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be strin
|
||||
Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createSentenceInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createCharacterInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createTitleInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: IntlBreakIterator::createLineInstance() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
|
||||
NULL
|
||||
@@ -3,6 +3,7 @@ Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #62070: Collator::getSortKey() returns garbage
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s1 = 'Hello';
|
||||
|
||||
$coll = collator_create('en_US');
|
||||
$res = collator_get_sort_key($coll, $s1);
|
||||
|
||||
echo urlencode($res);
|
||||
--EXPECT--
|
||||
82%40%40F%01%09%01%DC%08
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl')) die('skip intl extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$it = IntlBreakIterator::createCharacterInstance();
|
||||
$it->setText('foo');
|
||||
var_dump($it);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
object(IntlRuleBasedBreakIterator)#%d (3) {
|
||||
["valid"]=>
|
||||
bool(true)
|
||||
["text"]=>
|
||||
string(3) "foo"
|
||||
["type"]=>
|
||||
string(%d) "%SRuleBasedBreakIterator%S"
|
||||
}
|
||||
===DONE===
|
||||
@@ -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]
|
||||
|
||||
@@ -1875,7 +1875,7 @@ mbfl_strimwidth(
|
||||
mbfl_string_init(result);
|
||||
result->no_language = string->no_language;
|
||||
result->no_encoding = string->no_encoding;
|
||||
mbfl_memory_device_init(&pc.device, width, 0);
|
||||
mbfl_memory_device_init(&pc.device, MIN(string->len, width), 0);
|
||||
|
||||
/* output code filter */
|
||||
pc.decoder = mbfl_convert_filter_new(
|
||||
|
||||
@@ -113,6 +113,13 @@
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
|
||||
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
|
||||
|
||||
/*
|
||||
* convenience macros
|
||||
*/
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* buffering converter
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #76532 (Integer overflow and excessive memory usage in mb_strimwidth)
|
||||
--SKIPIF--
|
||||
<?php require 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$string_to_trim = '得很幸福。有一天,一个长得很丑的老人带着一只木马来到王';
|
||||
$width = 2147483647;
|
||||
var_dump(mb_strimwidth($string_to_trim, 0, $width));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(81) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
|
||||
+286
-7
@@ -89,6 +89,7 @@ mysqlnd_run_authentication(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
zend_uchar * switch_to_auth_protocol_data = NULL;
|
||||
size_t switch_to_auth_protocol_data_len = 0;
|
||||
@@ -113,10 +114,11 @@ mysqlnd_run_authentication(
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
|
||||
/* The data should be allocated with malloc() */
|
||||
if (auth_plugin) {
|
||||
scrambled_data =
|
||||
auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
|
||||
plugin_data, plugin_data_len, session_options,
|
||||
conn->protocol_frame_codec->data, mysql_flags);
|
||||
scrambled_data = auth_plugin->methods.get_auth_data(
|
||||
NULL, &scrambled_data_len, conn, user, passwd,
|
||||
passwd_len, plugin_data, plugin_data_len,
|
||||
session_options, conn->protocol_frame_codec->data,
|
||||
mysql_flags);
|
||||
}
|
||||
|
||||
if (conn->error_info->error_no) {
|
||||
@@ -127,6 +129,7 @@ mysqlnd_run_authentication(
|
||||
charset_no,
|
||||
first_call,
|
||||
requested_protocol,
|
||||
auth_plugin, plugin_data, plugin_data_len,
|
||||
scrambled_data, scrambled_data_len,
|
||||
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
|
||||
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
|
||||
@@ -248,6 +251,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
@@ -318,6 +324,11 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
conn->charset = mysqlnd_find_charset_nr(auth_packet->charset_no);
|
||||
}
|
||||
|
||||
if (auth_plugin && auth_plugin->methods.handle_server_response) {
|
||||
auth_plugin->methods.handle_server_response(auth_plugin, conn,
|
||||
orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len);
|
||||
}
|
||||
|
||||
if (FAIL == PACKET_READ(auth_resp_packet) || auth_resp_packet->response_code >= 0xFE) {
|
||||
if (auth_resp_packet->response_code == 0xFE) {
|
||||
/* old authentication with new server !*/
|
||||
@@ -613,7 +624,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_native_auth_plugin =
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_native_auth_get_auth_data
|
||||
mysqlnd_native_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
@@ -662,7 +674,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_pam_authentication_plugin
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_pam_auth_get_auth_data
|
||||
mysqlnd_pam_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
@@ -846,17 +859,283 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_sha256_authentication_plu
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_sha256_auth_get_auth_data
|
||||
mysqlnd_sha256_auth_get_auth_data,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*************************************** CACHING SHA2 Password *******************************/
|
||||
|
||||
#undef L64
|
||||
|
||||
#include "ext/hash/php_hash.h"
|
||||
#include "ext/hash/php_hash_sha.h"
|
||||
|
||||
#define SHA256_LENGTH 32
|
||||
|
||||
/* {{{ php_mysqlnd_scramble_sha2 */
|
||||
void php_mysqlnd_scramble_sha2(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const password, const size_t password_len)
|
||||
{
|
||||
PHP_SHA256_CTX context;
|
||||
zend_uchar sha1[SHA256_LENGTH];
|
||||
zend_uchar sha2[SHA256_LENGTH];
|
||||
|
||||
/* Phase 1: hash password */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, password, password_len);
|
||||
PHP_SHA256Final(sha1, &context);
|
||||
|
||||
/* Phase 2: hash sha1 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha1, SHA256_LENGTH);
|
||||
PHP_SHA256Final(sha2, &context);
|
||||
|
||||
/* Phase 3: hash scramble + sha2 */
|
||||
PHP_SHA256Init(&context);
|
||||
PHP_SHA256Update(&context, (zend_uchar*)sha2, SHA256_LENGTH);
|
||||
PHP_SHA256Update(&context, scramble, SCRAMBLE_LENGTH);
|
||||
PHP_SHA256Final(buffer, &context);
|
||||
|
||||
/* let's crypt buffer now */
|
||||
php_mysqlnd_crypt(buffer, (const zend_uchar *)sha1, (const zend_uchar *)buffer, SHA256_LENGTH);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static zend_uchar *
|
||||
mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
|
||||
size_t * auth_data_len,
|
||||
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
|
||||
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
const MYSQLND_PFC_DATA * const pfc_data,
|
||||
zend_ulong mysql_flags
|
||||
)
|
||||
{
|
||||
zend_uchar * ret = NULL;
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_auth_data");
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
|
||||
*auth_data_len = 0;
|
||||
|
||||
DBG_INF("First auth step: send hashed password");
|
||||
/* copy scrambled pass*/
|
||||
if (passwd && passwd_len) {
|
||||
ret = malloc(SHA256_LENGTH + 1);
|
||||
*auth_data_len = SHA256_LENGTH;
|
||||
php_mysqlnd_scramble_sha2((zend_uchar*)ret, auth_plugin_data, (zend_uchar*)passwd, passwd_len);
|
||||
ret[SHA256_LENGTH] = '\0';
|
||||
DBG_INF_FMT("hash(%d)=[%.*s]", *auth_data_len, *auth_data_len, ret);
|
||||
}
|
||||
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *
|
||||
mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
{
|
||||
RSA * ret = NULL;
|
||||
const MYSQLND_PFC_DATA * const pfc_data = conn->protocol_frame_codec->data;
|
||||
const char * fname = (pfc_data->sha256_server_public_key && pfc_data->sha256_server_public_key[0] != '\0')?
|
||||
pfc_data->sha256_server_public_key:
|
||||
MYSQLND_G(sha256_server_public_key);
|
||||
php_stream * stream;
|
||||
DBG_ENTER("mysqlnd_cached_sha2_get_key");
|
||||
DBG_INF_FMT("options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
|
||||
pfc_data->sha256_server_public_key? pfc_data->sha256_server_public_key:"n/a",
|
||||
MYSQLND_G(sha256_server_public_key)? MYSQLND_G(sha256_server_public_key):"n/a");
|
||||
if (!fname || fname[0] == '\0') {
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *req_packet = NULL;
|
||||
MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *pk_resp_packet = NULL;
|
||||
|
||||
do {
|
||||
DBG_INF("requesting the public key from the server");
|
||||
req_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
pk_resp_packet = conn->payload_decoder_factory->m.get_sha256_pk_request_response_packet(conn->payload_decoder_factory, FALSE);
|
||||
req_packet->request = 1;
|
||||
|
||||
if (! PACKET_WRITE(req_packet)) {
|
||||
DBG_ERR_FMT("Error while sending public key request packet");
|
||||
php_error(E_WARNING, "Error while sending public key request packet. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
if (FAIL == PACKET_READ(pk_resp_packet) || NULL == pk_resp_packet->public_key) {
|
||||
DBG_ERR_FMT("Error while receiving public key");
|
||||
php_error(E_WARNING, "Error while receiving public key. PID=%d", getpid());
|
||||
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
|
||||
break;
|
||||
}
|
||||
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet->public_key_len, pk_resp_packet->public_key);
|
||||
/* now extract the public key */
|
||||
{
|
||||
BIO * bio = BIO_new_mem_buf(pk_resp_packet->public_key, pk_resp_packet->public_key_len);
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
}
|
||||
} while (0);
|
||||
PACKET_FREE(req_packet);
|
||||
PACKET_FREE(pk_resp_packet);
|
||||
|
||||
DBG_INF_FMT("ret=%p", ret);
|
||||
DBG_RETURN(ret);
|
||||
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
|
||||
"caching_sha2_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
|
||||
DBG_ERR("server_public_key is not set");
|
||||
DBG_RETURN(NULL);
|
||||
} else {
|
||||
zend_string * key_str;
|
||||
DBG_INF_FMT("Key in a file. [%s]", fname);
|
||||
stream = php_stream_open_wrapper((char *) fname, "rb", REPORT_ERRORS, NULL);
|
||||
|
||||
if (stream) {
|
||||
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
|
||||
BIO * bio = BIO_new_mem_buf(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
|
||||
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
DBG_INF("Successfully loaded");
|
||||
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
|
||||
zend_string_release(key_str);
|
||||
}
|
||||
php_stream_close(stream);
|
||||
}
|
||||
}
|
||||
DBG_RETURN(ret);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_get_key */
|
||||
static size_t
|
||||
mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
unsigned char **crypted,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
static RSA *server_public_key;
|
||||
server_public_key = mysqlnd_caching_sha2_get_key(conn);
|
||||
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
|
||||
if (server_public_key) {
|
||||
int server_public_key_len;
|
||||
char xor_str[passwd_len + 1];
|
||||
memcpy(xor_str, passwd, passwd_len);
|
||||
xor_str[passwd_len] = '\0';
|
||||
mysqlnd_xor_string(xor_str, passwd_len, (char *) auth_plugin_data, auth_plugin_data_len);
|
||||
|
||||
server_public_key_len = RSA_size(server_public_key);
|
||||
/*
|
||||
Because RSA_PKCS1_OAEP_PADDING is used there is a restriction on the passwd_len.
|
||||
RSA_PKCS1_OAEP_PADDING is recommended for new applications. See more here:
|
||||
http://www.openssl.org/docs/crypto/RSA_public_encrypt.html
|
||||
*/
|
||||
if ((size_t) server_public_key_len - 41 <= passwd_len) {
|
||||
/* password message is to long */
|
||||
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
|
||||
DBG_ERR("password is too long");
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
||||
*crypted = emalloc(server_public_key_len);
|
||||
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, *crypted, server_public_key, RSA_PKCS1_OAEP_PADDING);
|
||||
DBG_RETURN(server_public_key_len);
|
||||
}
|
||||
DBG_RETURN(0);
|
||||
#else
|
||||
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
|
||||
php_error_docref(NULL, E_WARNING, "PHP was built without openssl extension, can't send password encrypted");
|
||||
DBG_RETURN(0);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static void
|
||||
mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plugin *self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT *result_packet;
|
||||
result_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
|
||||
|
||||
if (FAIL == PACKET_READ(result_packet)) {
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
||||
switch (result_packet->response_code) {
|
||||
case 3:
|
||||
DBG_INF("fast path suceeded");
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 4:
|
||||
if (conn->vio->data->ssl || conn->unix_socket.s) {
|
||||
DBG_INF("fast path failed, doing full auth via SSL");
|
||||
result_packet->password = (zend_uchar *)passwd;
|
||||
result_packet->password_len = passwd_len + 1;
|
||||
PACKET_WRITE(result_packet);
|
||||
} else {
|
||||
DBG_INF("fast path failed, doing full auth without SSL");
|
||||
result_packet->password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plugin_data_len, &result_packet->password, passwd, passwd_len);
|
||||
PACKET_WRITE(result_packet);
|
||||
efree(result_packet->password);
|
||||
}
|
||||
PACKET_FREE(result_packet);
|
||||
DBG_VOID_RETURN;
|
||||
case 2:
|
||||
// The server tried to send a key, which we didn't expect
|
||||
// fall-through
|
||||
default:
|
||||
php_error_docref(NULL, E_WARNING, "Unexpected server respose while doing caching_sha2 auth: %i", result_packet->response_code);
|
||||
}
|
||||
|
||||
PACKET_FREE(result_packet);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static struct st_mysqlnd_authentication_plugin mysqlnd_caching_sha2_auth_plugin =
|
||||
{
|
||||
{
|
||||
MYSQLND_PLUGIN_API_VERSION,
|
||||
"auth_plugin_caching_sha2_password",
|
||||
MYSQLND_VERSION_ID,
|
||||
PHP_MYSQLND_VERSION,
|
||||
"PHP License 3.01",
|
||||
"Johannes Schlüter <johannes.schlueter@php.net>",
|
||||
{
|
||||
NULL, /* no statistics , will be filled later if there are some */
|
||||
NULL, /* no statistics */
|
||||
},
|
||||
{
|
||||
NULL /* plugin shutdown */
|
||||
}
|
||||
},
|
||||
{/* methods */
|
||||
mysqlnd_caching_sha2_get_auth_data,
|
||||
mysqlnd_caching_sha2_handle_server_response
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* {{{ mysqlnd_register_builtin_authentication_plugins */
|
||||
void
|
||||
mysqlnd_register_builtin_authentication_plugins(void)
|
||||
{
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_native_auth_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_pam_authentication_plugin);
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_caching_sha2_auth_plugin);
|
||||
#ifdef MYSQLND_HAVE_SSL
|
||||
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_sha256_authentication_plugin);
|
||||
#endif
|
||||
|
||||
@@ -31,26 +31,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
size_t * switch_to_auth_protocol_len,
|
||||
zend_uchar ** switch_to_auth_protocol_data,
|
||||
size_t * switch_to_auth_protocol_data_len
|
||||
);
|
||||
|
||||
enum_func_status
|
||||
mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
|
||||
const char * const user,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len,
|
||||
const char * const db,
|
||||
const size_t db_len,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
zend_ulong mysql_flags,
|
||||
unsigned int server_charset_no,
|
||||
zend_bool use_full_blown_auth_packet,
|
||||
const char * const auth_protocol,
|
||||
struct st_mysqlnd_authentication_plugin * auth_plugin,
|
||||
const zend_uchar * const orig_auth_plugin_data,
|
||||
const size_t orig_auth_plugin_data_len,
|
||||
const zend_uchar * const auth_plugin_data,
|
||||
const size_t auth_plugin_data_len,
|
||||
char ** switch_to_auth_protocol,
|
||||
|
||||
@@ -678,9 +678,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
|
||||
|
||||
{
|
||||
const MYSQLND_CSTRING scheme = { transport.s, transport.l };
|
||||
/* This will be overwritten below with a copy, but we can use it during authentication */
|
||||
conn->unix_socket.s = (char *)socket_or_pipe.s;
|
||||
if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags)) {
|
||||
conn->unix_socket.s = NULL;
|
||||
goto err;
|
||||
}
|
||||
conn->unix_socket.s = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -631,6 +631,7 @@ enum mysqlnd_packet_type
|
||||
PROT_CHG_USER_RESP_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_PACKET,
|
||||
PROT_SHA256_PK_REQUEST_RESPONSE_PACKET,
|
||||
PROT_CACHED_SHA2_RESULT_PACKET,
|
||||
PROT_LAST /* should always be last */
|
||||
};
|
||||
|
||||
|
||||
@@ -970,6 +970,7 @@ struct st_mysqlnd_packet_chg_user_resp;
|
||||
struct st_mysqlnd_packet_auth_pam;
|
||||
struct st_mysqlnd_packet_sha256_pk_request;
|
||||
struct st_mysqlnd_packet_sha256_pk_request_response;
|
||||
struct st_mysqlnd_packet_cached_sha2_result;
|
||||
|
||||
typedef struct st_mysqlnd_packet_greet * (*func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_auth * (*func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
@@ -986,6 +987,7 @@ typedef struct st_mysqlnd_packet_prepare_response *(*func_mysqlnd_protocol_paylo
|
||||
typedef struct st_mysqlnd_packet_chg_user_resp*(*func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_sha256_pk_request_response *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result *(*func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
|
||||
|
||||
typedef enum_func_status (*func_mysqlnd_protocol_payload_decoder_factory__send_command)(
|
||||
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory,
|
||||
@@ -1043,6 +1045,7 @@ MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory)
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet get_change_user_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet get_sha256_pk_request_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet get_sha256_pk_request_response_packet;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet get_cached_sha2_result_packet;
|
||||
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command send_command;
|
||||
func_mysqlnd_protocol_payload_decoder_factory__send_command_handle_response send_command_handle_response;
|
||||
@@ -1355,11 +1358,18 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
|
||||
const MYSQLND_PFC_DATA * const pfc_data, zend_ulong mysql_flags
|
||||
);
|
||||
|
||||
typedef void (*func_auth_plugin__handle_server_response)(struct st_mysqlnd_authentication_plugin * self,
|
||||
MYSQLND_CONN_DATA * conn,
|
||||
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len);
|
||||
|
||||
struct st_mysqlnd_authentication_plugin
|
||||
{
|
||||
struct st_mysqlnd_plugin_header plugin_header;
|
||||
struct {
|
||||
func_auth_plugin__get_auth_data get_auth_data;
|
||||
func_auth_plugin__handle_server_response handle_server_response;
|
||||
} methods;
|
||||
};
|
||||
|
||||
|
||||
@@ -2273,7 +2273,85 @@ php_mysqlnd_sha256_pk_request_response_free_mem(void * _packet, zend_bool stack_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static
|
||||
size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
#ifndef _MSC_VER
|
||||
zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1];
|
||||
#else
|
||||
ALLOCA_FLAG(use_heap)
|
||||
zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap);
|
||||
#endif
|
||||
size_t sent;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_write");
|
||||
|
||||
if (packet->request == 1) {
|
||||
int1store(buffer + MYSQLND_HEADER_SIZE, '\2');
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, 1, stats, error_info);
|
||||
} else {
|
||||
memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len);
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free_alloca(buffer, use_heap);
|
||||
#endif
|
||||
|
||||
DBG_RETURN(sent);
|
||||
}
|
||||
|
||||
static enum_func_status
|
||||
php_mysqlnd_cached_sha2_result_read(void * _packet)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
|
||||
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = packet->header.vio;
|
||||
MYSQLND_STATS * stats = packet->header.stats;
|
||||
MYSQLND_CONNECTION_STATE * connection_state = packet->header.connection_state;
|
||||
zend_uchar buf[SHA256_PK_REQUEST_RESP_BUFFER_SIZE];
|
||||
zend_uchar *p = buf;
|
||||
const zend_uchar * const begin = buf;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cached_sha2_result_read");
|
||||
if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, connection_state, buf, sizeof(buf), "PROT_CACHED_SHA2_RESULT_PACKET", PROT_CACHED_SHA2_RESULT_PACKET)) {
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->response_code = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
p++;
|
||||
packet->result = uint1korr(p);
|
||||
BAIL_IF_NO_MORE_DATA;
|
||||
|
||||
DBG_RETURN(PASS);
|
||||
|
||||
premature_end:
|
||||
DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
|
||||
php_error_docref(NULL, E_WARNING, "SHA256_PK_REQUEST_RESPONSE packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
|
||||
p - begin - packet->header.size);
|
||||
DBG_RETURN(FAIL);
|
||||
}
|
||||
|
||||
static void
|
||||
php_mysqlnd_cached_sha2_result_free_mem(void * _packet, zend_bool stack_allocation)
|
||||
{
|
||||
MYSQLND_PACKET_CACHED_SHA2_RESULT * p = (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
|
||||
|
||||
if (!stack_allocation) {
|
||||
mnd_pefree(p, p->header.persistent);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ packet_methods */
|
||||
static
|
||||
mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
@@ -2367,9 +2445,15 @@ mysqlnd_packet_methods packet_methods[PROT_LAST] =
|
||||
php_mysqlnd_sha256_pk_request_response_read,
|
||||
NULL, /* write */
|
||||
php_mysqlnd_sha256_pk_request_response_free_mem,
|
||||
} /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
}, /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
|
||||
{
|
||||
sizeof(MYSQLND_PACKET_CACHED_SHA2_RESULT),
|
||||
php_mysqlnd_cached_sha2_result_read,
|
||||
php_mysqlnd_cached_sha2_result_write,
|
||||
php_mysqlnd_cached_sha2_result_free_mem
|
||||
} /* PROT_CACHED_SHA2_RESULT_PACKET */
|
||||
};
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::get_greet_packet */
|
||||
@@ -2718,6 +2802,30 @@ MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet)(MYSQLND_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_protocol::init_cached_sha2_result_packet */
|
||||
static struct st_mysqlnd_packet_cached_sha2_result *
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet)
|
||||
(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent)
|
||||
{
|
||||
struct st_mysqlnd_packet_cached_sha2_result * packet = mnd_pecalloc(1, packet_methods[PROT_CACHED_SHA2_RESULT_PACKET].struct_size, persistent);
|
||||
DBG_ENTER("mysqlnd_protocol::init_cached_sha2_result_packet");
|
||||
if (packet) {
|
||||
memset(packet, 0, sizeof(*packet));
|
||||
packet->header.m = &packet_methods[PROT_CACHED_SHA2_RESULT_PACKET];
|
||||
packet->header.factory = factory;
|
||||
|
||||
packet->header.protocol_frame_codec = factory->conn->protocol_frame_codec;
|
||||
packet->header.vio = factory->conn->vio;
|
||||
packet->header.stats = factory->conn->stats;
|
||||
packet->header.error_info = factory->conn->error_info;
|
||||
packet->header.connection_state = &factory->conn->state;
|
||||
|
||||
packet->header.persistent = persistent;
|
||||
}
|
||||
DBG_RETURN(packet);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ mysqlnd_protocol::send_command */
|
||||
static enum_func_status
|
||||
@@ -2948,6 +3056,7 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_protocol_payload_decoder_factory)
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_change_user_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet),
|
||||
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command),
|
||||
MYSQLND_METHOD(mysqlnd_protocol, send_command_handle_response),
|
||||
|
||||
@@ -292,6 +292,16 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response {
|
||||
size_t public_key_len;
|
||||
} MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE;
|
||||
|
||||
typedef struct st_mysqlnd_packet_cached_sha2_result {
|
||||
MYSQLND_PACKET_HEADER header;
|
||||
uint8_t response_code;
|
||||
uint8_t result;
|
||||
uint8_t request;
|
||||
zend_uchar * password;
|
||||
size_t password_len;
|
||||
} MYSQLND_PACKET_CACHED_SHA2_RESULT;
|
||||
|
||||
|
||||
|
||||
zend_ulong php_mysqlnd_net_field_length(const zend_uchar **packet);
|
||||
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, const uint64_t length);
|
||||
|
||||
@@ -155,6 +155,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
|
||||
case ZEND_SEND_REF:
|
||||
case ZEND_SEND_VAR_NO_REF:
|
||||
case ZEND_SEND_VAR_NO_REF_EX:
|
||||
case ZEND_SEND_USER:
|
||||
if (call_info) {
|
||||
uint32_t num = opline->op2.num;
|
||||
|
||||
@@ -165,9 +166,11 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
|
||||
}
|
||||
break;
|
||||
case ZEND_SEND_ARRAY:
|
||||
case ZEND_SEND_USER:
|
||||
case ZEND_SEND_UNPACK:
|
||||
/* TODO: set info about var_arg call ??? */
|
||||
if (call_info) {
|
||||
call_info->num_args = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
opline++;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id:$ */
|
||||
|
||||
#include "php.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_extensions.h"
|
||||
@@ -79,9 +77,11 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa
|
||||
tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
}
|
||||
return tmp;
|
||||
} else {
|
||||
} else if (call_info->num_args != -1) {
|
||||
/* warning, and returns NULL */
|
||||
return FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
} else {
|
||||
return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,11 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa
|
||||
if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args &&
|
||||
call_info->num_args == 1) {
|
||||
return MAY_BE_RC1 | MAY_BE_STRING;
|
||||
} else {
|
||||
} else if (call_info->num_args != -1) {
|
||||
/* warning, and returns NULL */
|
||||
return FUNC_MAY_WARN | MAY_BE_NULL;
|
||||
} else {
|
||||
return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2480,7 +2480,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
|
||||
|
||||
if (opline->extended_value == ZEND_ASSIGN_DIM) {
|
||||
if (opline->op1_type == IS_CV) {
|
||||
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op1_type);
|
||||
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op2_type);
|
||||
UPDATE_SSA_TYPE(orig, ssa_ops[i].op1_def);
|
||||
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #76477 (Opcache causes empty return value)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
testString();
|
||||
function testString()
|
||||
{
|
||||
$token = "ABC";
|
||||
$lengthBytes = strlenb($token);
|
||||
var_dump($lengthBytes == 0);
|
||||
}
|
||||
|
||||
function strlenb() { return call_user_func_array("strlen", func_get_args()); }
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
+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
|
||||
@@ -4,7 +4,7 @@ Bug #48182: ssl handshake fails during asynchronous socket connection
|
||||
<?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'
|
||||
@@ -44,6 +44,7 @@ echo "Running bug48182\n";
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Running bug48182
|
||||
Sending bug48182
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #54992: Stream not closed and error not returned when SSL CN_match fails
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -36,6 +37,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_socket_client(): Peer certificate CN=`bug54992.local' did not match expected CN=`buga_buga' in %s on line %d
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ Bug #55259 (openssl extension does not get the DH parameters from DH key resourc
|
||||
<?php
|
||||
|
||||
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
|
||||
'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
|
||||
'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
|
||||
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
|
||||
$dh_details = array( 'p' => $phex, 'g' => '2' );
|
||||
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, 'g' => '2' )));
|
||||
'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
|
||||
'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
|
||||
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
|
||||
$dh_details = array('p' => $phex, 'g' => '2');
|
||||
$dh = openssl_pkey_new(array('dh'=> array('p' => $phex, 'g' => '2')));
|
||||
var_dump($dh);
|
||||
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => hex2bin($phex), 'g' => '2' )));
|
||||
$dh = openssl_pkey_new(array('dh'=> array( 'p' => hex2bin($phex), 'g' => '2')));
|
||||
$details = openssl_pkey_get_details($dh);
|
||||
var_dump(bin2hex($details['dh']['p']));
|
||||
var_dump($details['dh']['g']);
|
||||
|
||||
@@ -1,28 +1,43 @@
|
||||
--TEST--
|
||||
Bug #55646: textual input in openssl_csr_new() is not expected in UTF-8
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists('openssl_csr_new'))
|
||||
die('skip no openssl extension');
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function stringAsHex($string){$unpacked = unpack("H*", $string);return implode(" ", str_split($unpacked[1],2));}
|
||||
|
||||
$config = array("digest_alg" => "sha1","x509_extensions" => "v3_ca","req_extensions" => "v3_req","private_key_bits" => 2048,"private_key_type" => OPENSSL_KEYTYPE_RSA,"encrypt_key" => false,);
|
||||
function stringAsHex($string) {
|
||||
$unpacked = unpack("H*", $string);
|
||||
return implode(" ", str_split($unpacked[1],2));
|
||||
}
|
||||
|
||||
$config = array(
|
||||
"digest_alg" => "sha1",
|
||||
"x509_extensions" => "v3_ca",
|
||||
"req_extensions" => "v3_req",
|
||||
"private_key_bits" => 2048,
|
||||
"private_key_type" => OPENSSL_KEYTYPE_RSA,
|
||||
"encrypt_key" => false,
|
||||
);
|
||||
$csr_info = array(
|
||||
"countryName" => "US",
|
||||
"stateOrProvinceName" => "Utah",
|
||||
"localityName" => "Lindon",
|
||||
"organizationName" => "Chinese",
|
||||
"organizationalUnitName" => "IT \xe4\xba\x92",
|
||||
"commonName" => "www.example.com",);
|
||||
"countryName" => "US",
|
||||
"stateOrProvinceName" => "Utah",
|
||||
"localityName" => "Lindon",
|
||||
"organizationName" => "Chinese",
|
||||
"organizationalUnitName" => "IT \xe4\xba\x92",
|
||||
"commonName" => "www.example.com",
|
||||
);
|
||||
$private = openssl_pkey_new($config);
|
||||
while (openssl_error_string()) {}
|
||||
$csr_res = openssl_csr_new($csr_info, $private,
|
||||
['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]);
|
||||
$csr_res = openssl_csr_new(
|
||||
$csr_info,
|
||||
$private,
|
||||
['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]
|
||||
);
|
||||
if (!$csr_res) {
|
||||
while ($e = openssl_error_string()) { $err = $e; }
|
||||
die("Failed; last error: $err");
|
||||
while ($e = openssl_error_string()) {
|
||||
$err = $e;
|
||||
}
|
||||
die("Failed; last error: $err");
|
||||
}
|
||||
openssl_csr_export($csr_res, $csr);
|
||||
$output = openssl_csr_get_subject($csr);
|
||||
@@ -31,6 +46,7 @@ echo "A: ".$csr_info["organizationalUnitName"]."\n";
|
||||
echo "B: ".stringAsHex($csr_info["organizationalUnitName"])."\n";
|
||||
echo "C: ".$output['OU']."\n";
|
||||
echo "D: ".stringAsHex($output['OU'])."\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
A: IT 互
|
||||
B: 49 54 20 e4 ba 92
|
||||
|
||||
@@ -12,7 +12,9 @@ $data = <<<DATA
|
||||
Please verify me
|
||||
DATA;
|
||||
|
||||
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
|
||||
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptl' .
|
||||
'AODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2' .
|
||||
'LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
|
||||
|
||||
$key = openssl_get_publickey($cert);
|
||||
var_dump(openssl_get_publickey($key));
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #65538: SSL context "cafile" supports stream wrappers
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -48,5 +49,6 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(12) "Hello World!"
|
||||
@@ -8,12 +8,12 @@ if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
|
||||
--FILE--
|
||||
<?php
|
||||
$clientCtx = stream_context_create(['ssl' => [
|
||||
// We don't get any ca list from php.net but it does not matter as we
|
||||
// care about the fact that the external stream is not allowed.
|
||||
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
|
||||
// as it is redirected to https which means the test would depend
|
||||
// on system cafile when opening stream.
|
||||
'cafile' => 'http://www.php.net',
|
||||
// We don't get any ca list from php.net but it does not matter as we
|
||||
// care about the fact that the external stream is not allowed.
|
||||
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
|
||||
// as it is redirected to https which means the test would depend
|
||||
// on system cafile when opening stream.
|
||||
'cafile' => 'http://www.php.net',
|
||||
]]);
|
||||
file_get_contents('https://github.com', false, $clientCtx);
|
||||
?>
|
||||
|
||||
@@ -5,6 +5,7 @@ Bug #65538: SSL context "cafile" supports phar wrapper
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!extension_loaded("phar")) die("skip phar not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -49,5 +50,6 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(12) "Hello World!"
|
||||
@@ -1,9 +1,7 @@
|
||||
--TEST--
|
||||
Bug #65689 (GeneralizedTime format parsing)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$crt = substr(__FILE__, 0, -4).'.crt';
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #65729: CN_match gives false positive when wildcard is used
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -42,6 +43,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in %s on line %d
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #66501: EC private key support in openssl_sign
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
@@ -18,5 +19,6 @@ sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
|
||||
$key = openssl_pkey_get_private($pkey);
|
||||
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
|
||||
var_dump($res);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
@@ -1,8 +1,7 @@
|
||||
--TEST--
|
||||
Bug #67403: Add signatureType to openssl_x509_parse
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$r = openssl_x509_parse(file_get_contents(__DIR__.'/bug64802.pem'));
|
||||
@@ -14,6 +13,7 @@ $r = openssl_x509_parse(file_get_contents(__DIR__.'/bug37820cert.pem'));
|
||||
var_dump($r['signatureTypeSN']);
|
||||
var_dump($r['signatureTypeLN']);
|
||||
var_dump($r['signatureTypeNID']);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(8) "RSA-SHA1"
|
||||
string(21) "sha1WithRSAEncryption"
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #68265: SAN match fails with trailing DNS dot
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -36,6 +37,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #68879: Match IP address fields in subjectAltName checks
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -36,6 +37,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #68920: peer_fingerprint input checks should be strict
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -47,6 +48,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_socket_client(): Expected peer fingerprint must be a string or an array in %s on line %d
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #69215: Crypto servers should send client CA list
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
@@ -43,6 +44,7 @@ CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
Request #70438: Add IV parameter for openssl_seal and openssl_open
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) {
|
||||
print "skip";
|
||||
}
|
||||
if (!extension_loaded("openssl")) print "skip";
|
||||
if (!in_array('AES-128-CBC', openssl_get_cipher_methods(true))) {
|
||||
print "skip";
|
||||
print "skip";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
@@ -7,12 +7,16 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
--FILE--
|
||||
<?php
|
||||
function test($envkey) {
|
||||
$publicKey = "file://" . dirname(__FILE__) . "/public.key";
|
||||
$privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
|
||||
openssl_public_encrypt($envkey, $envelope, $publicKey);
|
||||
$sealed = openssl_encrypt('plaintext', 'rc4', $envkey, OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY);
|
||||
openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
|
||||
var_dump($output === 'plaintext');
|
||||
$publicKey = "file://" . dirname(__FILE__) . "/public.key";
|
||||
$privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
|
||||
openssl_public_encrypt($envkey, $envelope, $publicKey);
|
||||
$sealed = openssl_encrypt(
|
||||
'plaintext',
|
||||
'rc4', $envkey,
|
||||
OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
|
||||
);
|
||||
openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
|
||||
var_dump($output === 'plaintext');
|
||||
}
|
||||
|
||||
// works - key of 16 bytes
|
||||
|
||||
@@ -8,56 +8,56 @@ if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
$context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
|
||||
$context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
|
||||
|
||||
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
|
||||
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
|
||||
phpt_notify();
|
||||
$conn = stream_socket_accept($fp);
|
||||
$total = 100000;
|
||||
$result = fread($conn, $total);
|
||||
stream_set_blocking($conn, false);
|
||||
usleep(50000);
|
||||
$read = [$conn];
|
||||
while (stream_select($read, $write, $except, 1)) {
|
||||
$result = fread($conn, 100000);
|
||||
if (!$result) {
|
||||
break;
|
||||
}
|
||||
$total += strlen($result);
|
||||
if ($total >= 4000000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
phpt_wait();
|
||||
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
|
||||
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
|
||||
phpt_notify();
|
||||
$conn = stream_socket_accept($fp);
|
||||
$total = 100000;
|
||||
$result = fread($conn, $total);
|
||||
stream_set_blocking($conn, false);
|
||||
usleep(50000);
|
||||
$read = [$conn];
|
||||
while (stream_select($read, $write, $except, 1)) {
|
||||
$result = fread($conn, 100000);
|
||||
if (!$result) {
|
||||
break;
|
||||
}
|
||||
$total += strlen($result);
|
||||
if ($total >= 4000000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
phpt_wait();
|
||||
CODE;
|
||||
|
||||
$clientCode = <<<'CODE'
|
||||
$context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
|
||||
|
||||
phpt_wait();
|
||||
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
|
||||
stream_set_blocking($fp, false);
|
||||
|
||||
function blocking_fwrite($fp, $buf) {
|
||||
$write = [$fp];
|
||||
$total = 0;
|
||||
while (stream_select($read, $write, $except, 1)) {
|
||||
$result = fwrite($fp, $buf);
|
||||
if (!$result) {
|
||||
break;
|
||||
}
|
||||
$total += $result;
|
||||
if ($total >= strlen($buf)) {
|
||||
return $total;
|
||||
}
|
||||
$buf = substr($buf, $total);
|
||||
}
|
||||
}
|
||||
$str1 = str_repeat("a", 4000000);
|
||||
blocking_fwrite($fp, $str1);
|
||||
phpt_notify();
|
||||
echo "done";
|
||||
$context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
|
||||
|
||||
phpt_wait();
|
||||
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
|
||||
stream_set_blocking($fp, false);
|
||||
|
||||
function blocking_fwrite($fp, $buf) {
|
||||
$write = [$fp];
|
||||
$total = 0;
|
||||
while (stream_select($read, $write, $except, 1)) {
|
||||
$result = fwrite($fp, $buf);
|
||||
if (!$result) {
|
||||
break;
|
||||
}
|
||||
$total += $result;
|
||||
if ($total >= strlen($buf)) {
|
||||
return $total;
|
||||
}
|
||||
$buf = substr($buf, $total);
|
||||
}
|
||||
}
|
||||
$str1 = str_repeat("a", 4000000);
|
||||
blocking_fwrite($fp, $str1);
|
||||
phpt_notify();
|
||||
echo "done";
|
||||
CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
|
||||
@@ -5,18 +5,18 @@ Bug #72336 (openssl_pkey_new does not fail for invalid DSA params)
|
||||
--FILE--
|
||||
<?php
|
||||
$p = '00f8000ae45b2dacb47dd977d58b719d097bdf07cb2c17660ad898518c08' .
|
||||
'1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
|
||||
'24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
|
||||
'1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
|
||||
'996def90090303b7ad';
|
||||
'1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
|
||||
'24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
|
||||
'1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
|
||||
'996def90090303b7ad';
|
||||
|
||||
$q = '009b3734fc9f7a4a9d6437ec314e0a78c2889af64b';
|
||||
|
||||
$g = '00b320300a0bc55b8f0ec6edc218e2185250f38fbb8291db8a89227f6e41' .
|
||||
'00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
|
||||
'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
|
||||
'4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
|
||||
'b81747c4c447a941f3';
|
||||
'00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
|
||||
'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
|
||||
'4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
|
||||
'b81747c4c447a941f3';
|
||||
|
||||
var_dump(openssl_pkey_new(array('dsa' => array('p' => $p, 'q' => $q, 'g' => $g))));
|
||||
?>
|
||||
|
||||
@@ -6,8 +6,26 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","12345678", OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY)));
|
||||
var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","1234567812345678" , OPENSSL_RAW_DATA)));
|
||||
var_dump(
|
||||
bin2hex(
|
||||
openssl_encrypt(
|
||||
"this is a test string",
|
||||
"bf-ecb",
|
||||
"12345678",
|
||||
OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
|
||||
)
|
||||
)
|
||||
);
|
||||
var_dump(
|
||||
bin2hex(
|
||||
openssl_encrypt(
|
||||
"this is a test string",
|
||||
"bf-ecb",
|
||||
"1234567812345678",
|
||||
OPENSSL_RAW_DATA
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
|
||||
|
||||
@@ -3,39 +3,40 @@ Bug #73072: Invalid path SNI_server_certs causes segfault
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$serverCode = <<<'CODE'
|
||||
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
|
||||
$ctx = stream_context_create(['ssl' => [
|
||||
'local_cert' => __DIR__ . '/domain1.pem',
|
||||
'SNI_server_certs' => [
|
||||
"domain1.com" => __DIR__ . "/sni_server_domain1.pem",
|
||||
"domain2.com" => __DIR__ . "/not_existing.pem",
|
||||
]
|
||||
]]);
|
||||
|
||||
$ctx = stream_context_create(['ssl' => [
|
||||
'local_cert' => __DIR__ . '/domain1.pem',
|
||||
'SNI_server_certs' => [
|
||||
"domain1.com" => __DIR__ . "/sni_server_domain1.pem",
|
||||
"domain2.com" => __DIR__ . "/not_existing.pem",
|
||||
]
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server('tls://127.0.0.1:64322', $errno, $errstr, $flags, $ctx);
|
||||
|
||||
|
||||
phpt_notify();
|
||||
@stream_socket_accept($server, 3);
|
||||
// if there is a segfault, this won't be called
|
||||
fwrite(STDERR, "done\n");
|
||||
@stream_socket_accept($server, 3);
|
||||
// if there is a segfault, this won't be called
|
||||
fwrite(STDERR, "done\n");
|
||||
CODE;
|
||||
|
||||
$clientCode = <<<'CODE'
|
||||
$flags = STREAM_CLIENT_CONNECT;
|
||||
$ctxArr = [
|
||||
'cafile' => __DIR__ . '/sni_server_ca.pem',
|
||||
'capture_peer_cert' => true
|
||||
];
|
||||
$ctxArr = [
|
||||
'cafile' => __DIR__ . '/sni_server_ca.pem',
|
||||
'capture_peer_cert' => true
|
||||
];
|
||||
|
||||
phpt_wait();
|
||||
|
||||
$ctxArr['peer_name'] = 'domain1.com';
|
||||
$ctx = stream_context_create(['ssl' => $ctxArr]);
|
||||
@stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
|
||||
$ctx = stream_context_create(['ssl' => $ctxArr]);
|
||||
@stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
|
||||
CODE;
|
||||
|
||||
include 'ServerClientTestCase.inc';
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
--TEST--
|
||||
Bug #73478: openssl_pkey_new() generates wrong pub/priv keys with Diffie Hellman
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
<?php if (!extension_loaded("openssl")) die("skip openssl not loaded"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$details = [
|
||||
'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
|
||||
'g' => base64_decode('Ag=='),
|
||||
'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
|
||||
'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
|
||||
'g' => base64_decode('Ag=='),
|
||||
'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
|
||||
];
|
||||
|
||||
$opensslKeyResource = openssl_pkey_new(['dh' => $details]);
|
||||
|
||||
@@ -10,18 +10,18 @@ $passwords = ["abc\x00defghijkl", "abcdefghikjl"];
|
||||
$conf = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
|
||||
|
||||
foreach($passwords as $password) {
|
||||
$key = openssl_pkey_new($conf);
|
||||
$key = openssl_pkey_new($conf);
|
||||
|
||||
if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
|
||||
echo "Failed to encrypt.\n";
|
||||
} else {
|
||||
echo "Encrypted!\n";
|
||||
}
|
||||
if (openssl_pkey_get_private($privatePEM, $password) === false) {
|
||||
echo "Failed to decrypt.\n";
|
||||
} else {
|
||||
echo "Decrypted!\n";
|
||||
}
|
||||
if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
|
||||
echo "Failed to encrypt.\n";
|
||||
} else {
|
||||
echo "Encrypted!\n";
|
||||
}
|
||||
if (openssl_pkey_get_private($privatePEM, $password) === false) {
|
||||
echo "Failed to decrypt.\n";
|
||||
} else {
|
||||
echo "Decrypted!\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
|
||||
@@ -7,9 +7,9 @@ if (!extension_loaded("openssl")) die("skip");
|
||||
--FILE--
|
||||
<?php
|
||||
function test($p12_contents, $password) {
|
||||
openssl_pkcs12_read($p12_contents, $cert_data, $password);
|
||||
openssl_error_string();
|
||||
var_dump(count($cert_data['extracerts']));
|
||||
openssl_pkcs12_read($p12_contents, $cert_data, $password);
|
||||
openssl_error_string();
|
||||
var_dump(count($cert_data['extracerts']));
|
||||
}
|
||||
|
||||
$p12_base64 = 'MIIW+QIBAzCCFr8GCSqGSIb3DQEHAaCCFrAEghasMIIWqDCCEV8GCSqGSIb3DQEHBqCCEVAwghFMAgEAMIIRRQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIQOfCxIAgGIICAggAgIIRGFTkvHpJjCtFjukXYVlhyOIqKiS8Zvg84dX244hhI0S51Uyn/tlXM2GD/3hDNVxcVKwP/fKN21lEkoXoK4h2/5BY3qCdZa3Ef3vk44b/+FGCUAqvsOo1ZjD2P/sBGhLu3aFnQ6ktUXlKV4cnqhlF62AqY4e5efQzmJXn+gI8cSNI5c+qQ0RQgGoRY4nJfvMSZG0/DAkirjGikU/2TZd8LwLkxVUBYbF5/T0fNtA3o99+4tF+8ZRv6ArYjplRdwcBbMbzGhn3ytCq6cmVid9iLjwHJFmvAPXKbmu0Lh5eRRznX9gBWlzGd08Q/ch0MW2ehZTu1A2VrNWl+FKWSk8l0MlSoTPJFutFiejRvMr6VzbQItyJ/mtrNa9b1Hicgoj9HaBB6arx4wKORlbSOxFNOWdTCUhFdqthK5o7b9i/owyVgyY0s7BFEZChc0zGpRq7BLrynY79b+pHKzpil9isuisp1++piHZx9Y/bpC7OP5FlYF9+3TJL0EpEFQD8FqEoqcMFRxIDWGpCQiLGcmL14OH1JKSgOJEAgogsIF/KQhvWeKcUSJlai+0sskl8mOrCt2EJwuRvzmemuzebYN3JMOiBXKONYR0yU8AeAyNTgSBimWhACtikUyfpgZXlIeXyFMvj9fmd0I/zqjaW4upqrCudCOj/CWx7+e+8udfJxI7agWwrZMf1BEkOhRFOHOIuV+IEbaoMP6vVrGlhK71oN+gnoes5ivohpFDJWSZ3+1fMh56vfNynuM2wLJO7FTROPla+4ug33V/2ubGpoIyXn2lTSbuXaYDfsXMa1inakOMW9Q+PHGdIjZrwQU/u9Q2H0IlwFd4uQojZo15SRf4xh5FOuUrrfGRAnp1mWHALTBqd2VnkgqtBl8rXZXqA+CiEhEDhTAQmvf+wCKd3FklrhV+p65YcfRK9OJv5aFQM1/+WbJozF4/Wi5j4rtIDPrgMMEflOyoZIxGxDOaklyAvaasRU2TT8E2LIEvGKOzlrhIZqWyRESjgXdh6l0UBMaVAidIZ0JLf+8fqSZ0Zia5iAaJpm82MQr/PVXC4lqqxDlHhefwM3OKfZVkfAw0a2eePM5YkIxAgMpAstBt32UIixlj/5l4MwqzP8Reb4MsV6Fph2e14vsV1diLBaJI3hrU5UBVEDWV0GSbwdhZLtdubSaBHcv5v9aZ1cdFKL6d2rHksW9ooNnh/ljPxmVlfHbb8sPYDXmLmBNJdNV1gQouhKKrt0ov1J9+sqE53D9+9dfRwf/myYlnyNgqU4vNMrZI2flyugkYoUxIC8stVF46zfL5QkSg3GqdLQC4gpeJ0WdTSyOBaOgUvqGdSARb5bXm1VXF5IxVg1B4v+puNIHS9yuphXUJvw6xWWPjbQAllDrPjMqAbxmF465vFyQP0qEvMjRD+SaFIgW4KjMqfteKo4MgqKTRF4UP9r0HkwRErOznxWDfSxzXYztY6U72NdifN9IIFiBikKQqZvfvaN+1jukehSRpGQHQB5OxeeKThJZJGiUC5Fgvl7lPb6Djx8Rfba/FJvVsR2KFS64sArtUKmC6LcJxEY9WcsiJTHek817zvYej7FD1NxuttNp+ue9ArOoIhOEf08HIOu3d2yjeRlN5CJ/jIdKYlZW6m6Ap1M+OUHhJTF73K6lKKD9Diwa3s6FoqOwtZF4uYwHnCG218BMY8GgEVD73x5KjDOP02Y6EakZNp/9QIqQT4WkMWXMaqAPADtoh8X1FJLlnvs2Ko+hLlPxuPaIA4KvSuuocnWx/6HJbdqHUS/Se+JJo0Igt4Svax1R2kvoIPuQmPmHJ6l7CeZZiNbe+baFSx+V6g/6AgHUsUOSqGvUIEns1uIE9CQ8w0G3yLVonjERJLrdj+em3Pt7fxrxoOI4nwjplX0wJk0rkQREiS8ULQDHueptUcxJxMKpugAc4CL+BsHohkhm4kpOEmviKDwzxytQhDp2Fj2PRO9kqyNrNfzNGCN5709blEIVYTtonELI2vR5Ap+O2pH+AlqrnHWgeOYAKAyWT13xCNRsGNdv2sCDDiHqxq01IBzYhPvoWzECOmGbJRRSGOVzYCJJpVjl0NNKv9ucmftSQRjm6xgLIqv1xrehDYuJ/IMsYQ5QwXBGxy7nkeRg+onWzA0ZnEWgzLs3T/Pj7z/TPQWiN03MH24RvQXTWBqp9iBwXpsCZVgUIM/VLCQJn0/V5gfRy9Ne0rk2/tHMnzGHvll5Spoy6WkxSfQ8c8CjTilaoPWV6fOcNB2Z6ZuTqX0fbnxcEAu2fOK7e6ryGipEgaxrdiopDTlgPEFMdGUETbUh0ACrv/gNsS+m5MtNisWnhxFEiXrsWoWIgW/6TgRJGo+l52bh/xxC0bwHbYuHK62sxDVeXpBOnA4VE+WckWsC0CKYJvv4vfTbLI46fyd3lnlcSuHYM4SdbND7THNeK+KB5GyuUFLgAhhtZv8ceEo63IOlBUUy1NlWnr0cbidxvVnOugFLExCV5QGr+xbrssIibQxs8AfOBK8Cxh83IlzJVe7dX1mZVG1c6AM6SKSC6F0LBOeNEvcLlz4PBMIciubCE6ecdXCzJYFbj9ERDlnrZMKrnATRMsgCPaWdyYgQwkDuCj5uqf4aiKLzA61918hLY3MB7mSyJcCkXDYKr11Br0YSAdu8uG6IjpiUQS2PFz8E8XHBmO/uobhEuCPR2LnUv+xFN8zoPQlA5ueRz1yBF8L+CsvDGp/N3KF26ETWlvmnEdt7foE+o/J7aG6xO/CNB+/+yGbVPZRVAntZec9nbqlQ55qECnWtQNnShW7+3RSGamWeTtE2DyRSfd/62JkPNEY25jbBUIkMNtKolA5dbYa+u50S3lvakMmvQvzcSC3PONajKHgk4mBn3qf9X2uM5RDL83M7489r6JPcxTnNK27rQoxplkxLiN8HuB+AB5hp82WoyvLydR4hoBnJPIYKMcmEfIR+SgLoCyNIQLjzk5Iyk1ZwdwsjyNPXi1/HHZq8+NhoTCupjGfWgXghoz89MTYAjpMvOlES2rgFuCdphSc8Nd1uQtZx4CLMOU0gut0PI81ePBBI0iG74PWMEcp5HlHHY/hPTaRkBFLYkq9CWmJc1PfjiCWf3pwRmT7dUnmcptynexIMOZt2Nd76jc+g7k5MmEK+Qdz7/c1un4sVLquxdY6nUY/znLz+2zC/OTSsF39+rak3p8TXR0kBNsHl8UTioi4CGhCMsWsQy9me25TDHzbtIvBPVp9xXufsOe2wqPLjq3iNEGXTsagx3sLvl7BJ6WW/YMC7sUpjx1Ai3zkqViW0jQB+BzMZjfYM/8Yj31EEE+WssxY+NfitBgZzeMGGjNOAKp7XN0glwhuo1G2/APyU/Zopx3gMYj5OExgkZ7kvK++7+NlPmE+8AEuZ/uf30TtKwvRXOSvAMqqm26kb/WQPCj1xFQ0AEDl0Sbyfgk1E51Cd/ujL0t32FNkSoE8pe3IaTnwAnW7NHTZ/RByh2nsr0ThfFg4pFFuSD4dzU8r2J/4YJG3B06eyyTRLoyLBQwzwIgzGBAU8USdD8CXlA8SkfBbF39500ZRNcMIt6wdQa1CHAUHDLPw9JF9Q0FwCspgkjc9+lTRZMtumN5ChgypSkUB1dzLV2hqeQzDngVjcco/CoxM0Svm8gGrM9qobCTGzGF8/wZljv1yRiqu6HGFYWDAQ/p+wWx6ScstxEAB+5R5GrOedgd4zPXi2NMvyeN+ACFRBSPkhXIXpLZADvBi/WQMYbHia1wL8WUrSGQuB4P46cWGyseaxl//6GQ9IoGbK3XuLIPeE+BpPLB0H9LSLY+5f3qOEkKzCCW0z+68ZMlanlsThLKhqk8yrmJhV4788Tr7BC3eGbAie1urrrfUR613Jsp5peLSJuWQHdWCE/fdKgoSsRJ+DYkPoyS1YNz4BF4yz1Oem9Mti7gvgTQNX6g6PCu0rN8B6HIgY9TvWy5OCoZjJKasb+OgTMld7TJDnyK5/JcvDKHNVwcpK74lxcVX7IRorP/eh4IQ1+P/Gh06A62RHp2dEh/fNuKeCiRM2vGH0gdIN/Ca6MX8MqazgJq2EONyWiqRoGPqqZpAVTa8l5kgGvxQE/CQ4x0uAxwresRRTUZ+fJEanAhTWYgI5mRoEkG88UZjyCWmCnpNMQRYHoq7iY0So5qUdkHvpUA48cNMyztPEEHsUyWC36ZCyNsQN26FoJrG9TqXedBrhcki0sPOWugvKtGsdTT354wJTDe5OCo0AH3eFo/auuuAk/DF7yu614UCmKtXHYJ61GpIkjBu9WrPAIJhndMqfGMD/yU4UMEPHyojqHvU0BSgv1k76vI3K2lqERkaNYFfzRNj+e7k+NNos8w7XCzilWBL2ePB3pG5xfivcH4tYFm0FbnIkSz52VIy+PTiK7QQuBPDRTcn1k41+9vxQxRWpsqM/NP+4gqGozNyANXLQ64Y+QXSnWrD+xMjL/kVFwUBJ2HaAIJHjZ7ZqLRzXVOUbQ9pivJiBkXvLptSo72Iw4zsbRd1x8WNEaihx1MBAj+s+4MNdC5MBkQMlSB0PTJzs9xlz0gN+Oz0lohH6JO7ngPJUYbo2AIWEYZN+9kn/RyHblQTElrJeLf1jGNi4anBfzbsIXQuVm/nsrE5MH23X66+rJzUk8Fc5JAIDGBslkDPg3UNnElcE3cYbcB/ZzjFtgz8ducWKQmI+Yqv4p7BVXji/rHPim8vL6P5xZc95tbIonp5bQH+PPSmcfDk3rrf5mS58dJvWh/UpwcfdVvUAsWLJEV1lUBg1qecVbCsa6Oy7tJ2ZK7e3KdtZrmXiYpSAnSzRNJotr4g4H99brG6IwUx3qk5BE4Line truncated
|
||||
|
||||
@@ -4,7 +4,6 @@ Bug #74159: Writing a large buffer to non-blocking encrypted streams fails
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -13,93 +12,93 @@ if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
|
||||
// scenarios which might be useful. More reliable test is bug72333.phpt
|
||||
$serverCode = <<<'CODE'
|
||||
$serverUri = "ssl://127.0.0.1:10012";
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => __DIR__ . '/bug54992.pem',
|
||||
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
|
||||
]]);
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
$serverCtx = stream_context_create(['ssl' => [
|
||||
'local_cert' => __DIR__ . '/bug54992.pem',
|
||||
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
|
||||
]]);
|
||||
|
||||
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
|
||||
phpt_notify();
|
||||
phpt_notify();
|
||||
|
||||
$client = stream_socket_accept($server, 1);
|
||||
|
||||
if (!$client) {
|
||||
exit();
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
$data = '';
|
||||
while (strlen($data) < 0xfffff) {
|
||||
$buffer = fread($client, 8192);
|
||||
if (empty($buffer)) {
|
||||
exit();
|
||||
}
|
||||
$data .= $buffer;
|
||||
usleep(100);
|
||||
}
|
||||
while (strlen($data) < 0xfffff) {
|
||||
$buffer = fread($client, 8192);
|
||||
if (empty($buffer)) {
|
||||
exit();
|
||||
}
|
||||
$data .= $buffer;
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
fclose($client);
|
||||
CODE;
|
||||
|
||||
$clientCode = <<<'CODE'
|
||||
function streamRead($stream) : int {
|
||||
return strlen(fread($stream, 8192));
|
||||
}
|
||||
return strlen(fread($stream, 8192));
|
||||
}
|
||||
|
||||
function streamWrite($stream, $data) : int {
|
||||
return fwrite($stream, $data);
|
||||
}
|
||||
return fwrite($stream, $data);
|
||||
}
|
||||
|
||||
function waitForWrite(...$streams) : bool {
|
||||
$read = null;
|
||||
$except = null;
|
||||
while($streams && !($n = stream_select($read, $streams, $except, 1)));
|
||||
return $n > 0;
|
||||
}
|
||||
$read = null;
|
||||
$except = null;
|
||||
while($streams && !($n = stream_select($read, $streams, $except, 1)));
|
||||
return $n > 0;
|
||||
}
|
||||
|
||||
function waitForRead(...$streams) : bool {
|
||||
$write = null;
|
||||
$except = null;
|
||||
while ($streams && !($n = stream_select($streams, $write, $except, 1)));
|
||||
return $n > 0;
|
||||
}
|
||||
$write = null;
|
||||
$except = null;
|
||||
while ($streams && !($n = stream_select($streams, $write, $except, 1)));
|
||||
return $n > 0;
|
||||
}
|
||||
|
||||
set_error_handler(function ($errno, $errstr) {
|
||||
exit("$errstr\n");
|
||||
});
|
||||
exit("$errstr\n");
|
||||
});
|
||||
|
||||
$serverUri = "tcp://127.0.0.1:10012";
|
||||
$clientFlags = STREAM_CLIENT_CONNECT;
|
||||
$clientCtx = stream_context_create(['ssl' => [
|
||||
'verify_peer' => true,
|
||||
'cafile' => __DIR__ . '/bug54992-ca.pem',
|
||||
'peer_name' => 'bug54992.local',
|
||||
]]);
|
||||
$clientFlags = STREAM_CLIENT_CONNECT;
|
||||
$clientCtx = stream_context_create(['ssl' => [
|
||||
'verify_peer' => true,
|
||||
'cafile' => __DIR__ . '/bug54992-ca.pem',
|
||||
'peer_name' => 'bug54992.local',
|
||||
]]);
|
||||
|
||||
phpt_wait();
|
||||
|
||||
$fp = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
|
||||
|
||||
stream_set_blocking($fp, false);
|
||||
while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
|
||||
while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
|
||||
|
||||
$data = str_repeat("a", 0xfffff);
|
||||
$written = 0;
|
||||
$total = $written;
|
||||
while(!empty($data)) {
|
||||
$written = streamWrite($fp, $data);
|
||||
$total += $written;
|
||||
$data = substr($data, $written);
|
||||
waitForWrite($fp);
|
||||
}
|
||||
printf("Written %d bytes\n", $total);
|
||||
$written = 0;
|
||||
$total = $written;
|
||||
while(!empty($data)) {
|
||||
$written = streamWrite($fp, $data);
|
||||
$total += $written;
|
||||
$data = substr($data, $written);
|
||||
waitForWrite($fp);
|
||||
}
|
||||
printf("Written %d bytes\n", $total);
|
||||
|
||||
while(waitForRead($fp)) {
|
||||
streamRead($fp);
|
||||
if (feof($fp)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamRead($fp);
|
||||
if (feof($fp)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
exit("DONE\n");
|
||||
CODE;
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
Bug #74402 (segfault on random_bytes, bin3hex, openssl_seal)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) {
|
||||
print "skip";
|
||||
}
|
||||
if (!in_array('AES256', openssl_get_cipher_methods(true))) {
|
||||
print "skip";
|
||||
}
|
||||
if (!extension_loaded("openssl")) print "skip";
|
||||
if (!in_array('AES256', openssl_get_cipher_methods(true))) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
--TEST--
|
||||
Bug #74720 pkcs7_en/decrypt does not work if \x1a is used in content, variant 1
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
--TEST--
|
||||
Bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
?>
|
||||
<?php if (!extension_loaded("openssl")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
Loaded 100 of 261 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user