mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 10:40:50 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bc56dbdba | ||
|
|
9d63514d35 | ||
|
|
b97a9718c8 | ||
|
|
e73d8e2627 | ||
|
|
ead40a6678 | ||
|
|
7acaa4020d | ||
|
|
7241973608 |
No files matched your search
@@ -27,7 +27,6 @@ addons:
|
||||
- libpspell-dev
|
||||
- libsasl2-dev
|
||||
- libsqlite3-dev
|
||||
- libsodium-dev
|
||||
- libtidy-dev
|
||||
- libwebp-dev
|
||||
- libxml2-dev
|
||||
|
||||
@@ -1,81 +1,5 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
05 Mar 2020, PHP 7.4.4RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #79244 (php crashes during parsing INI file). (Laruence)
|
||||
. Fixed bug #63206 (restore_error_handler does not restore previous errors
|
||||
mask). (Mark Plomer)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
|
||||
(cmb)
|
||||
. Fixed bug #79242 (COM error constants don't match com_exception codes on
|
||||
x86). (cmb)
|
||||
. Fixed bug #79247 (Garbage collecting variant objects segfaults). (cmb)
|
||||
. Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (cmb)
|
||||
. Fixed bug #79299 (com_print_typeinfo prints duplicate variables). (Litiano
|
||||
Moura)
|
||||
. Fixed bug #79332 (php_istreams are never freed). (cmb)
|
||||
. Fixed bug #79333 (com_print_typeinfo() leaks memory). (cmb)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)
|
||||
. Fixed bug #79013 (Content-Length missing when posting a curlFile with
|
||||
curl). (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #77569: (Write Access Violation in DomImplementation). (Nikita,
|
||||
cmb)
|
||||
. Fixed bug #79271 (DOMDocumentType::$childNodes is NULL). (cmb)
|
||||
|
||||
- Enchant:
|
||||
. Fixed bug #79311 (enchant_dict_suggest() fails on big endian architecture).
|
||||
(cmb)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #77653 (operator displayed instead of the real error message).
|
||||
(Jakub Zelenka)
|
||||
. Fixed bug #79014 (PHP-FPM & Primary script unknown). (Jakub Zelenka)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #64032 (mysqli reports different client_version). (cmb)
|
||||
|
||||
- MySQLnd:
|
||||
. Implemented FR #79275 (Support auth_plugin_caching_sha2_password on
|
||||
Windows). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #79252 (preloading causes php-fpm to segfault during exit).
|
||||
(Nikita)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
|
||||
and unicode). (Nikita)
|
||||
. Fixed bug #79241 (Segmentation fault on preg_match()). (Nikita)
|
||||
. Fixed bug #79257 (Duplicate named groups (?J) prefer last alternative even
|
||||
if not matched). (Nikita)
|
||||
|
||||
- PDO_ODBC:
|
||||
. Fixed bug #79038 (PDOStatement::nextRowset() leaks column values). (cmb)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #79062 (Property with heredoc default value returns false for
|
||||
getDocComment). (Nikita)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed bug #79294 (::columnType() may fail after SQLite3Stmt::reset()). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #79254 (getenv() w/o arguments not showing changes). (cmb)
|
||||
. Fixed bug #79265 (Improper injection of Host header when using fopen for
|
||||
http requests). (Miguel Xavier Penha Neto)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #79315 (ZipArchive::addFile doesn't honor start/length
|
||||
parameters). (Remi)
|
||||
|
||||
20 Feb 2020, PHP 7.4.3
|
||||
|
||||
- Core:
|
||||
@@ -89,6 +13,9 @@ PHP NEWS
|
||||
. Fixed bug #76047 (Use-after-free when accessing already destructed
|
||||
backtrace arguments). (Nikita)
|
||||
|
||||
- COM:
|
||||
. Fixed bug #79247 (Garbage collecting variant objects segfaults). (cmb)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()).
|
||||
(cmb)
|
||||
@@ -100,7 +27,7 @@ PHP NEWS
|
||||
. Fixed bug #79112 (IMAP extension can't find OpenSSL libraries at configure
|
||||
time). (Nikita)
|
||||
|
||||
- Intl:
|
||||
-Intl:
|
||||
. Fixed bug #79212 (NumberFormatter::format() may detect wrong type). (cmb)
|
||||
|
||||
- Libxml:
|
||||
|
||||
@@ -69,12 +69,6 @@ PHP 7.4 UPGRADE NOTES
|
||||
a warning and always return false. Previously all DateInterval objects were
|
||||
considered equal, unless they had properties.
|
||||
|
||||
DOM:
|
||||
. As of PHP 7.4.4, the value of the $childNodes property of DOMDocument,
|
||||
DOMNode, DOMProcessingInstruction, DOMComment, DOMText, DOMCdataSection and
|
||||
DOMNotation is now an empty DOMNodeList instead of NULL, according to the
|
||||
W3C and WHATWG standards and the PHP manual.
|
||||
|
||||
- Intl:
|
||||
. The default parameter value of idn_to_ascii() and idn_to_utf8() is now
|
||||
INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003.
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #60161: Implementing an interface extending Traversable is order dependent
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface Foo extends Traversable {
|
||||
}
|
||||
|
||||
class Example implements Foo, IteratorAggregate {
|
||||
public function getIterator() {
|
||||
return new ArrayIterator([]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63206 Fully support error_handler stacking, even inside the error_handler
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'First handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'Second handler' . PHP_EOL;
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'Internal handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
$triggerInternalNotice++; // warnings while handling the error should go into internal handler
|
||||
|
||||
restore_error_handler();
|
||||
});
|
||||
|
||||
$triggerNotice1++;
|
||||
$triggerNotice2++;
|
||||
?>
|
||||
--EXPECTF--
|
||||
Second handler
|
||||
Internal handler
|
||||
Second handler
|
||||
Internal handler
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63206 Fully support error_handler stacking, even with null
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'First handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'Second handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
set_error_handler(null);
|
||||
|
||||
set_error_handler(function() {
|
||||
echo 'Fourth handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
restore_error_handler();
|
||||
restore_error_handler();
|
||||
|
||||
$triggerNotice++;
|
||||
?>
|
||||
--EXPECTF--
|
||||
Second handler
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Bug #63206 Fully support exception_handler stacking, even with null
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_exception_handler(function() {
|
||||
echo 'First handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
set_exception_handler(function() {
|
||||
echo 'Second handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
set_exception_handler(null);
|
||||
|
||||
set_exception_handler(function() {
|
||||
echo 'Fourth handler' . PHP_EOL;
|
||||
});
|
||||
|
||||
restore_exception_handler();
|
||||
restore_exception_handler();
|
||||
|
||||
throw new Exception();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Second handler
|
||||
@@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
BUG #77589 (Core dump using parse_ini_string with numeric sections)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(
|
||||
parse_ini_string(<<<INI
|
||||
[0]
|
||||
a = 1
|
||||
b = on
|
||||
c = true
|
||||
|
||||
["true"]
|
||||
a = 100
|
||||
b = null
|
||||
c = yes
|
||||
INI
|
||||
, TRUE, INI_SCANNER_TYPED));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
["b"]=>
|
||||
bool(true)
|
||||
["c"]=>
|
||||
bool(true)
|
||||
}
|
||||
["true"]=>
|
||||
array(3) {
|
||||
["a"]=>
|
||||
int(100)
|
||||
["b"]=>
|
||||
NULL
|
||||
["c"]=>
|
||||
bool(true)
|
||||
}
|
||||
}
|
||||
@@ -2065,7 +2065,6 @@ static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, uint32
|
||||
}
|
||||
}
|
||||
p = p->next;
|
||||
i = ZEND_MM_FIRST_PAGE;
|
||||
} while (p != heap->main_chunk);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -1645,10 +1645,10 @@ ZEND_FUNCTION(set_error_handler)
|
||||
|
||||
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
|
||||
ZVAL_COPY(return_value, &EG(user_error_handler));
|
||||
}
|
||||
|
||||
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
|
||||
zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
|
||||
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
|
||||
zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
|
||||
ZVAL_UNDEF(&EG(user_error_handler));
|
||||
@@ -1712,9 +1712,9 @@ ZEND_FUNCTION(set_exception_handler)
|
||||
|
||||
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
|
||||
ZVAL_COPY(return_value, &EG(user_exception_handler));
|
||||
}
|
||||
|
||||
zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
|
||||
zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
|
||||
ZVAL_UNDEF(&EG(user_exception_handler));
|
||||
|
||||
+2
-2
@@ -1740,11 +1740,11 @@ static void zend_pre_incdec_property_zval(zval *prop, zend_property_info *prop_i
|
||||
do {
|
||||
if (Z_ISREF_P(prop)) {
|
||||
zend_reference *ref = Z_REF_P(prop);
|
||||
prop = Z_REFVAL_P(prop);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_incdec_typed_ref(ref, NULL OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
prop = Z_REFVAL_P(prop);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(prop_info)) {
|
||||
@@ -1777,11 +1777,11 @@ static void zend_post_incdec_property_zval(zval *prop, zend_property_info *prop_
|
||||
} else {
|
||||
if (Z_ISREF_P(prop)) {
|
||||
zend_reference *ref = Z_REF_P(prop);
|
||||
prop = Z_REFVAL_P(prop);
|
||||
if (ZEND_REF_HAS_TYPE_SOURCES(ref)) {
|
||||
zend_incdec_typed_ref(ref, EX_VAR(opline->result.var) OPLINE_CC EXECUTE_DATA_CC);
|
||||
return;
|
||||
}
|
||||
prop = Z_REFVAL_P(prop);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(prop_info)) {
|
||||
|
||||
@@ -141,14 +141,13 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
ZVAL_NEW_STR(retval, zend_string_init(str, len, ZEND_SYSTEM_INI))
|
||||
|
||||
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED && \
|
||||
(YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW))) {\
|
||||
zend_ini_copy_typed_value(ini_lval, type, str, len); \
|
||||
} else { \
|
||||
zend_ini_copy_value(ini_lval, str, len); \
|
||||
} \
|
||||
return type; \
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
|
||||
zend_ini_copy_typed_value(ini_lval, type, str, len); \
|
||||
} else { \
|
||||
zend_ini_copy_value(ini_lval, str, len); \
|
||||
} \
|
||||
return type; \
|
||||
}
|
||||
|
||||
static inline int convert_to_number(zval *retval, const char *str, const int str_len)
|
||||
|
||||
@@ -2434,7 +2434,6 @@ skip_escape_conversion:
|
||||
|
||||
if (is_heredoc && !SCNG(heredoc_scan_ahead)) {
|
||||
zend_lex_state current_state;
|
||||
zend_string *saved_doc_comment = CG(doc_comment);
|
||||
int heredoc_nesting_level = 1;
|
||||
int first_token = 0;
|
||||
int error = 0;
|
||||
@@ -2445,7 +2444,6 @@ skip_escape_conversion:
|
||||
SCNG(heredoc_indentation) = 0;
|
||||
SCNG(heredoc_indentation_uses_spaces) = 0;
|
||||
LANG_SCNG(on_event) = NULL;
|
||||
CG(doc_comment) = NULL;
|
||||
|
||||
zend_ptr_stack_reverse_apply(¤t_state.heredoc_label_stack, copy_heredoc_label_stack);
|
||||
|
||||
@@ -2495,7 +2493,6 @@ skip_escape_conversion:
|
||||
zend_restore_lexical_state(¤t_state);
|
||||
SCNG(heredoc_scan_ahead) = 0;
|
||||
CG(increment_lineno) = 0;
|
||||
CG(doc_comment) = saved_doc_comment;
|
||||
|
||||
if (PARSER_MODE() && error) {
|
||||
RETURN_TOKEN(T_ERROR);
|
||||
|
||||
+12
-18
@@ -500,15 +500,9 @@ ZEND_API void zend_update_current_locale(void);
|
||||
#define ZVAL_OFFSETOF_TYPE \
|
||||
(offsetof(zval, u1.type_info) - offsetof(zval, value))
|
||||
|
||||
#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer)
|
||||
# define ZEND_USE_ASM_ARITHMETIC 1
|
||||
#else
|
||||
# define ZEND_USE_ASM_ARITHMETIC 0
|
||||
#endif
|
||||
|
||||
static zend_always_inline void fast_long_increment_function(zval *op1)
|
||||
{
|
||||
#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
__asm__ goto(
|
||||
"addl $1,(%0)\n\t"
|
||||
"jo %l1\n"
|
||||
@@ -519,7 +513,7 @@ static zend_always_inline void fast_long_increment_function(zval *op1)
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
|
||||
__asm__ goto(
|
||||
"addq $1,(%0)\n\t"
|
||||
"jo %l1\n"
|
||||
@@ -530,7 +524,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
|
||||
__asm__ goto (
|
||||
"ldr x5, [%0]\n\t"
|
||||
"adds x5, x5, 1\n\t"
|
||||
@@ -571,7 +565,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
|
||||
static zend_always_inline void fast_long_decrement_function(zval *op1)
|
||||
{
|
||||
#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
__asm__ goto(
|
||||
"subl $1,(%0)\n\t"
|
||||
"jo %l1\n"
|
||||
@@ -582,7 +576,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1)
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
|
||||
__asm__ goto(
|
||||
"subq $1,(%0)\n\t"
|
||||
"jo %l1\n"
|
||||
@@ -593,7 +587,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
|
||||
__asm__ goto (
|
||||
"ldr x5, [%0]\n\t"
|
||||
"subs x5 ,x5, 1\n\t"
|
||||
@@ -634,7 +628,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
|
||||
static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
__asm__ goto(
|
||||
"movl (%1), %%eax\n\t"
|
||||
"addl (%2), %%eax\n\t"
|
||||
@@ -652,7 +646,7 @@ static zend_always_inline void fast_long_add_function(zval *result, zval *op1, z
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
|
||||
__asm__ goto(
|
||||
"movq (%1), %%rax\n\t"
|
||||
"addq (%2), %%rax\n\t"
|
||||
@@ -670,7 +664,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
|
||||
__asm__ goto(
|
||||
"ldr x5, [%1]\n\t"
|
||||
"ldr x6, [%2]\n\t"
|
||||
@@ -744,7 +738,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
|
||||
|
||||
static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
|
||||
__asm__ goto(
|
||||
"movl (%1), %%eax\n\t"
|
||||
"subl (%2), %%eax\n\t"
|
||||
@@ -762,7 +756,7 @@ static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, z
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
|
||||
__asm__ goto(
|
||||
"movq (%1), %%rax\n\t"
|
||||
"subq (%2), %%rax\n\t"
|
||||
@@ -780,7 +774,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
return;
|
||||
overflow: ZEND_ATTRIBUTE_COLD_LABEL
|
||||
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
|
||||
#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
|
||||
#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
|
||||
__asm__ goto(
|
||||
"ldr x5, [%1]\n\t"
|
||||
"ldr x6, [%2]\n\t"
|
||||
|
||||
+3
-3
@@ -1113,11 +1113,11 @@ ZEND_VM_C_LABEL(assign_op_object):
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
@@ -1174,11 +1174,11 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(prop))) {
|
||||
ref = Z_REF_P(prop);
|
||||
prop = Z_REFVAL_P(prop);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
prop = Z_REFVAL_P(prop);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(prop_info->type)) {
|
||||
@@ -1302,11 +1302,11 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
|
||||
+16
-16
@@ -816,11 +816,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(prop))) {
|
||||
ref = Z_REF_P(prop);
|
||||
prop = Z_REFVAL_P(prop);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
prop = Z_REFVAL_P(prop);
|
||||
}
|
||||
|
||||
if (UNEXPECTED(prop_info->type)) {
|
||||
@@ -22087,11 +22087,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CONST == IS_CONST) {
|
||||
@@ -22227,11 +22227,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CONST_HANDL
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
@@ -24384,11 +24384,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
|
||||
@@ -24525,11 +24525,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_TMPVAR_HAND
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
@@ -28078,11 +28078,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CV == IS_CONST) {
|
||||
@@ -28218,11 +28218,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CV_HANDLER(
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
@@ -30556,11 +30556,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CONST == IS_CONST) {
|
||||
@@ -32395,11 +32395,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
|
||||
@@ -34919,11 +34919,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CV == IS_CONST) {
|
||||
@@ -39034,11 +39034,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CONST == IS_CONST) {
|
||||
@@ -39174,11 +39174,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLE
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
@@ -42541,11 +42541,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
|
||||
@@ -42682,11 +42682,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_TMPVAR_HANDL
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
@@ -47639,11 +47639,11 @@ assign_op_object:
|
||||
do {
|
||||
if (UNEXPECTED(Z_ISREF_P(zptr))) {
|
||||
ref = Z_REF_P(zptr);
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
zptr = Z_REFVAL_P(zptr);
|
||||
}
|
||||
|
||||
if (IS_CV == IS_CONST) {
|
||||
@@ -47779,11 +47779,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(Z
|
||||
do {
|
||||
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
|
||||
zend_reference *ref = Z_REF_P(var_ptr);
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
|
||||
zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
|
||||
break;
|
||||
}
|
||||
var_ptr = Z_REFVAL_P(var_ptr);
|
||||
}
|
||||
zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
|
||||
} while (0);
|
||||
|
||||
@@ -30,7 +30,6 @@ steps:
|
||||
libreadline-dev \
|
||||
libldap2-dev \
|
||||
libsasl2-dev \
|
||||
libsodium-dev \
|
||||
libargon2-0-dev \
|
||||
postgresql \
|
||||
postgresql-contrib \
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-16.04'
|
||||
variables:
|
||||
ubsan_options: 'print_stacktrace=1'
|
||||
steps:
|
||||
|
||||
@@ -55,7 +55,6 @@ steps:
|
||||
--with-ldap-sasl \
|
||||
--with-password-argon2 \
|
||||
--with-mhash \
|
||||
--with-sodium \
|
||||
--enable-werror \
|
||||
--with-config-file-path=/etc \
|
||||
--with-config-file-scan-dir=/etc/php.d
|
||||
|
||||
+1
-2
@@ -13,7 +13,7 @@ steps:
|
||||
locales \
|
||||
language-pack-de \
|
||||
libglib2.0-dev:i386 \
|
||||
libssl-dev:i386 \
|
||||
openssl:i386 \
|
||||
zlib1g-dev:i386 \
|
||||
libxml2-dev:i386 \
|
||||
libgmp-dev:i386 \
|
||||
@@ -40,7 +40,6 @@ steps:
|
||||
libreadline-dev:i386 \
|
||||
libffi-dev:i386 \
|
||||
libfreetype6-dev:i386 \
|
||||
libsodium-dev:i386 \
|
||||
postgresql \
|
||||
postgresql-contrib \
|
||||
${{ parameters.packages }}
|
||||
|
||||
+1
-2
@@ -5,7 +5,7 @@ parameters:
|
||||
jobs:
|
||||
- job: ${{ parameters.configurationName }}
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
vmImage: 'ubuntu-16.04'
|
||||
steps:
|
||||
- template: apt.yml
|
||||
- script: |
|
||||
@@ -62,7 +62,6 @@ jobs:
|
||||
--with-ffi \
|
||||
--enable-zend-test \
|
||||
--with-mhash \
|
||||
--with-sodium \
|
||||
--enable-werror \
|
||||
--with-config-file-path=/etc \
|
||||
--with-config-file-scan-dir=/etc/php.d
|
||||
|
||||
+2
-3
@@ -25,8 +25,8 @@ jobs:
|
||||
--enable-fpm \
|
||||
--with-pdo-mysql=mysqlnd \
|
||||
--with-mysqli=mysqlnd \
|
||||
--with-pgsql=/usr/local/opt/libpq \
|
||||
--with-pdo-pgsql=/usr/local/opt/libpq \
|
||||
--with-pgsql \
|
||||
--with-pdo-pgsql \
|
||||
--with-pdo-sqlite \
|
||||
--without-pear \
|
||||
--enable-gd \
|
||||
@@ -65,7 +65,6 @@ jobs:
|
||||
--enable-zend-test \
|
||||
--enable-intl \
|
||||
--with-mhash \
|
||||
--with-sodium \
|
||||
--enable-werror \
|
||||
--with-config-file-path=/etc \
|
||||
--with-config-file-scan-dir=/etc/php.d
|
||||
|
||||
@@ -87,7 +87,6 @@ dnl
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
@@ -150,13 +149,11 @@ namespace cxx11
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual ~Base() {}
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual ~Derived() override {}
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
|
||||
+15
-1
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([PHP],[7.4.4RC1],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_INIT([PHP],[7.4.3],[https://bugs.php.net],[php],[https://www.php.net])
|
||||
AC_CONFIG_SRCDIR([main/php_version.h])
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
@@ -737,6 +737,20 @@ if test "$ac_cv__asm_goto" = yes; then
|
||||
AC_DEFINE(HAVE_ASM_GOTO,1,[Define if asm goto support])
|
||||
fi
|
||||
|
||||
dnl Check for variable length array support.
|
||||
AC_CACHE_CHECK([whether compiler supports VLA], ac_cv__compiler_c99_vla,
|
||||
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
int main(void) {
|
||||
int i[rand()%10];
|
||||
return 0;
|
||||
}
|
||||
]])],[ac_cv__compiler_c99_vla=yes], [ac_cv__compiler_c99_vla=no], [ac_cv__compiler_c99_vla=no])])
|
||||
|
||||
if test "$ac_cv__compiler_c99_vla" = yes; then
|
||||
AC_DEFINE(HAVE_COMPILER_C99_VLA, 1, [Compiler supports VLA])
|
||||
fi
|
||||
|
||||
dnl Check valgrind support.
|
||||
PHP_ARG_WITH([valgrind],
|
||||
[whether to enable valgrind support],
|
||||
|
||||
@@ -341,15 +341,11 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||
|
||||
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
|
||||
|
||||
#if SIZEOF_ZEND_LONG == 8
|
||||
# define COM_ERR_CONST(x) { \
|
||||
#define COM_ERR_CONST(x) { \
|
||||
zend_long __tmp; \
|
||||
ULongToIntPtr(x, &__tmp); \
|
||||
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
|
||||
}
|
||||
#else
|
||||
# define COM_ERR_CONST COM_CONST
|
||||
#endif
|
||||
|
||||
COM_CONST(CLSCTX_INPROC_SERVER);
|
||||
COM_CONST(CLSCTX_INPROC_HANDLER);
|
||||
|
||||
@@ -187,7 +187,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
|
||||
SafeArrayGetUBound(V_ARRAY(&I->safe_array), 1, &I->sa_max);
|
||||
|
||||
/* pre-fetch the element */
|
||||
if (I->sa_max >= bound && php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
|
||||
I->key = bound;
|
||||
ZVAL_NULL(&ptr);
|
||||
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
|
||||
|
||||
@@ -248,6 +248,13 @@ static struct IStreamVtbl php_istream_vtbl = {
|
||||
|
||||
static void istream_destructor(php_istream *stm)
|
||||
{
|
||||
if (stm->res) {
|
||||
zend_resource *res = stm->res;
|
||||
stm->res = NULL;
|
||||
zend_list_delete(res);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stm->refcount > 0) {
|
||||
CoDisconnectObject((IUnknown*)stm, 0);
|
||||
}
|
||||
@@ -261,6 +268,7 @@ static void istream_destructor(php_istream *stm)
|
||||
PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
|
||||
{
|
||||
php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
|
||||
zval *tmp;
|
||||
|
||||
if (stm == NULL)
|
||||
return NULL;
|
||||
@@ -272,7 +280,8 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
|
||||
stm->stream = stream;
|
||||
|
||||
GC_ADDREF(stream->res);
|
||||
stm->res = zend_register_resource(stm, le_istream);
|
||||
tmp = zend_list_insert(stm, le_istream);
|
||||
stm->res = Z_RES_P(tmp);
|
||||
|
||||
return (IStream*)stm;
|
||||
}
|
||||
@@ -389,7 +398,7 @@ CPH_METHOD(SaveToFile)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage);
|
||||
olefilename = php_com_string_to_olestring(filename, strlen(fullpath), helper->codepage);
|
||||
efree(fullpath);
|
||||
}
|
||||
res = IPersistFile_Save(helper->ipf, olefilename, remember);
|
||||
|
||||
@@ -480,7 +480,6 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
|
||||
char *ansiname = NULL;
|
||||
size_t ansinamelen;
|
||||
int ret = 0;
|
||||
DISPID lastid = 0; /* for props */
|
||||
|
||||
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
|
||||
return 0;
|
||||
@@ -514,6 +513,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
|
||||
/* So we've got the dispatch interface; lets list the event methods */
|
||||
for (i = 0; i < attr->cFuncs; i++) {
|
||||
zval tmp;
|
||||
DISPID lastid = 0; /* for props */
|
||||
int isprop;
|
||||
|
||||
if (FAILED(ITypeInfo_GetFuncDesc(typeinfo, i, &func)))
|
||||
@@ -626,8 +626,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
|
||||
ZVAL_STRINGL(&tmp, ansiname, ansinamelen);
|
||||
zend_hash_index_update(id_to_name, func->memid, &tmp);
|
||||
// TODO: avoid reallocation???
|
||||
efree(ansiname);
|
||||
}
|
||||
efree(ansiname);
|
||||
}
|
||||
ITypeInfo_ReleaseFuncDesc(typeinfo, func);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #66322 (COMPersistHelper::SaveToFile can save to wrong location)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
try {
|
||||
new COM('Word.Application');
|
||||
} catch (com_exception $ex) {
|
||||
die('skip MS Word not available');
|
||||
}
|
||||
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$w = new COM('Word.Application');
|
||||
$doc = $w->Documents->Add();
|
||||
$ph = new COMPersistHelper($doc);
|
||||
$filename = __DIR__ . '\\..\\' . basename(__DIR__) . '\\66322.docx';
|
||||
$ph->SaveToFile($filename);
|
||||
var_dump(file_exists($filename));
|
||||
$w->Quit();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -2,9 +2,7 @@
|
||||
Bug #73679 DOTNET read access violation using invalid codepage
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
|
||||
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
|
||||
?>
|
||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79242 (COM error constants don't match com_exception codes)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(
|
||||
DISP_E_DIVBYZERO,
|
||||
DISP_E_OVERFLOW,
|
||||
DISP_E_BADINDEX,
|
||||
MK_E_UNAVAILABLE
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(-2147352558)
|
||||
int(-2147352566)
|
||||
int(-2147352565)
|
||||
int(-2147221021)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79248 (Traversing empty VT_ARRAY throws com_exception)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$v = new variant([], VT_ARRAY);
|
||||
foreach ($v as $el) {
|
||||
var_dump($el);
|
||||
}
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79299 (com_print_typeinfo prints duplicate variables)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dict = new COM("Scripting.Dictionary");
|
||||
ob_start();
|
||||
com_print_typeinfo($dict);
|
||||
$typeinfo = ob_get_clean();
|
||||
preg_match_all('/\/\* DISPID=9 \*\//', $typeinfo, $matches);
|
||||
var_dump($matches[0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(14) "/* DISPID=9 */"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79332 (php_istreams are never freed)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ph = new COMPersistHelper(null);
|
||||
try {
|
||||
$ph->LoadFromStream(fopen(__FILE__, 'r'));
|
||||
} catch (com_exception $ex) {
|
||||
// use hard-coded message to avoid localization issues
|
||||
echo "A com_exception has been thrown\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
A com_exception has been thrown
|
||||
+54
-116
@@ -1795,20 +1795,11 @@ static void curl_free_post(void **post)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
struct mime_data_cb_arg {
|
||||
zend_string *filename;
|
||||
php_stream *stream;
|
||||
};
|
||||
|
||||
/* {{{ curl_free_cb_arg
|
||||
/* {{{ curl_free_stream
|
||||
*/
|
||||
static void curl_free_cb_arg(void **cb_arg_p)
|
||||
static void curl_free_stream(void **post)
|
||||
{
|
||||
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) *cb_arg_p;
|
||||
|
||||
ZEND_ASSERT(cb_arg->stream == NULL);
|
||||
zend_string_release(cb_arg->filename);
|
||||
efree(cb_arg);
|
||||
php_stream_close((php_stream *)*post);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1909,13 +1900,11 @@ php_curl *alloc_curl_handle()
|
||||
|
||||
zend_llist_init(&ch->to_free->str, sizeof(char *), (llist_dtor_func_t)curl_free_string, 0);
|
||||
zend_llist_init(&ch->to_free->post, sizeof(struct HttpPost *), (llist_dtor_func_t)curl_free_post, 0);
|
||||
zend_llist_init(&ch->to_free->stream, sizeof(struct mime_data_cb_arg *), (llist_dtor_func_t)curl_free_cb_arg, 0);
|
||||
zend_llist_init(&ch->to_free->stream, sizeof(php_stream *), (llist_dtor_func_t)curl_free_stream, 0);
|
||||
|
||||
ch->to_free->slist = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0);
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
ZVAL_UNDEF(&ch->postfields);
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2105,21 +2094,47 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
|
||||
(*source->clone)++;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
/* {{{ proto resource curl_copy_handle(resource ch)
|
||||
Copy a cURL handle along with all of it's preferences */
|
||||
PHP_FUNCTION(curl_copy_handle)
|
||||
{
|
||||
CURL *cp;
|
||||
zval *zid;
|
||||
php_curl *ch, *dupch;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1,1)
|
||||
Z_PARAM_RESOURCE(zid)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
cp = curl_easy_duphandle(ch->cp);
|
||||
if (!cp) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot duplicate cURL handle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dupch = alloc_curl_handle();
|
||||
dupch->cp = cp;
|
||||
|
||||
_php_setup_easy_copy_handlers(dupch, ch);
|
||||
|
||||
Z_ADDREF_P(zid);
|
||||
|
||||
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
|
||||
dupch->res = Z_RES_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800
|
||||
static size_t read_cb(char *buffer, size_t size, size_t nitems, void *arg) /* {{{ */
|
||||
{
|
||||
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
|
||||
ssize_t numread;
|
||||
php_stream *stream = (php_stream *) arg;
|
||||
ssize_t numread = php_stream_read(stream, buffer, nitems * size);
|
||||
|
||||
if (cb_arg->stream == NULL) {
|
||||
if (!(cb_arg->stream = php_stream_open_wrapper(ZSTR_VAL(cb_arg->filename), "rb", IGNORE_PATH, NULL))) {
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
numread = php_stream_read(cb_arg->stream, buffer, nitems * size);
|
||||
if (numread < 0) {
|
||||
php_stream_close(cb_arg->stream);
|
||||
cb_arg->stream = NULL;
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
return numread;
|
||||
@@ -2128,25 +2143,13 @@ static size_t read_cb(char *buffer, size_t size, size_t nitems, void *arg) /* {{
|
||||
|
||||
static int seek_cb(void *arg, curl_off_t offset, int origin) /* {{{ */
|
||||
{
|
||||
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
|
||||
int res;
|
||||
php_stream *stream = (php_stream *) arg;
|
||||
int res = php_stream_seek(stream, offset, origin);
|
||||
|
||||
if (cb_arg->stream == NULL) {
|
||||
if (res) {
|
||||
return CURL_SEEKFUNC_CANTSEEK;
|
||||
}
|
||||
res = php_stream_seek(cb_arg->stream, offset, origin);
|
||||
return res == SUCCESS ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_CANTSEEK;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void free_cb(void *arg) /* {{{ */
|
||||
{
|
||||
struct mime_data_cb_arg *cb_arg = (struct mime_data_cb_arg *) arg;
|
||||
|
||||
if (cb_arg->stream != NULL) {
|
||||
php_stream_close(cb_arg->stream);
|
||||
cb_arg->stream = NULL;
|
||||
}
|
||||
return CURL_SEEKFUNC_OK;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
@@ -2157,7 +2160,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
zval *current;
|
||||
HashTable *postfields;
|
||||
zend_string *string_key;
|
||||
zend_ulong num_key;
|
||||
zend_ulong num_key;
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
curl_mime *mime = NULL;
|
||||
curl_mimepart *part;
|
||||
@@ -2199,11 +2202,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
zval *prop, rv;
|
||||
char *type = NULL, *filename = NULL;
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
struct mime_data_cb_arg *cb_arg;
|
||||
php_stream *stream;
|
||||
php_stream_statbuf ssb;
|
||||
size_t filesize = -1;
|
||||
curl_seek_callback seekfunc = seek_cb;
|
||||
#endif
|
||||
|
||||
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
|
||||
@@ -2226,33 +2225,24 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
zval_ptr_dtor(&ch->postfields);
|
||||
ZVAL_COPY(&ch->postfields, zpostfields);
|
||||
|
||||
if ((stream = php_stream_open_wrapper(ZSTR_VAL(postval), "rb", STREAM_MUST_SEEK, NULL))) {
|
||||
if (!stream->readfilters.head && !php_stream_stat(stream, &ssb)) {
|
||||
filesize = ssb.sb.st_size;
|
||||
}
|
||||
} else {
|
||||
seekfunc = NULL;
|
||||
if (!(stream = php_stream_open_wrapper(ZSTR_VAL(postval), "rb", IGNORE_PATH, NULL))) {
|
||||
zend_string_release_ex(string_key, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
cb_arg = emalloc(sizeof *cb_arg);
|
||||
cb_arg->filename = zend_string_copy(postval);
|
||||
cb_arg->stream = stream;
|
||||
|
||||
part = curl_mime_addpart(mime);
|
||||
if (part == NULL) {
|
||||
php_stream_close(stream);
|
||||
zend_string_release_ex(string_key, 0);
|
||||
return FAILURE;
|
||||
}
|
||||
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|
||||
|| (form_error = curl_mime_data_cb(part, filesize, read_cb, seekfunc, free_cb, cb_arg)) != CURLE_OK
|
||||
|| (form_error = curl_mime_data_cb(part, -1, read_cb, seek_cb, NULL, stream)) != CURLE_OK
|
||||
|| (form_error = curl_mime_filename(part, filename ? filename : ZSTR_VAL(postval))) != CURLE_OK
|
||||
|| (form_error = curl_mime_type(part, type ? type : "application/octet-stream")) != CURLE_OK) {
|
||||
php_stream_close(stream);
|
||||
error = form_error;
|
||||
}
|
||||
zend_llist_add_element(&ch->to_free->stream, &cb_arg);
|
||||
zend_llist_add_element(&ch->to_free->stream, &stream);
|
||||
#else
|
||||
form_error = curl_formadd(&first, &last,
|
||||
CURLFORM_COPYNAME, ZSTR_VAL(string_key),
|
||||
@@ -2320,60 +2310,11 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
|
||||
zend_llist_add_element(&ch->to_free->post, &first);
|
||||
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
|
||||
#endif
|
||||
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
return error == CURLE_OK ? SUCCESS : FAILURE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource curl_copy_handle(resource ch)
|
||||
Copy a cURL handle along with all of it's preferences */
|
||||
PHP_FUNCTION(curl_copy_handle)
|
||||
{
|
||||
CURL *cp;
|
||||
zval *zid;
|
||||
php_curl *ch, *dupch;
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
zval *postfields;
|
||||
#endif
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1,1)
|
||||
Z_PARAM_RESOURCE(zid)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
cp = curl_easy_duphandle(ch->cp);
|
||||
if (!cp) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot duplicate cURL handle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
dupch = alloc_curl_handle();
|
||||
dupch->cp = cp;
|
||||
|
||||
_php_setup_easy_copy_handlers(dupch, ch);
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
postfields = &ch->postfields;
|
||||
if (Z_TYPE_P(postfields) != IS_UNDEF) {
|
||||
if (build_mime_structure_from_hash(dupch, postfields) != SUCCESS) {
|
||||
_php_curl_close_ex(dupch);
|
||||
php_error_docref(NULL, E_WARNING, "Cannot rebuild mime structure");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Z_ADDREF_P(zid);
|
||||
|
||||
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
|
||||
dupch->res = Z_RES_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ */
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
@@ -3672,9 +3613,6 @@ static void _php_curl_close_ex(php_curl *ch)
|
||||
#endif
|
||||
|
||||
efree(ch->handlers);
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
zval_ptr_dtor(&ch->postfields);
|
||||
#endif
|
||||
efree(ch);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -183,9 +183,6 @@ typedef struct {
|
||||
struct _php_curl_error err;
|
||||
zend_bool in_callback;
|
||||
uint32_t* clone;
|
||||
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
|
||||
zval postfields;
|
||||
#endif
|
||||
} php_curl;
|
||||
|
||||
#define CURLOPT_SAFE_UPLOAD -1
|
||||
|
||||
@@ -38,7 +38,7 @@ var_dump(curl_exec($ch));
|
||||
curl_close($ch);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream|6"
|
||||
string(%d) "curl_testdata1.txt|text/plain|6"
|
||||
string(%d) "foo.txt|application/octet-stream|6"
|
||||
string(%d) "foo.txt|text/plain|6"
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream"
|
||||
string(%d) "curl_testdata1.txt|text/plain"
|
||||
string(%d) "foo.txt|application/octet-stream"
|
||||
string(%d) "foo.txt|text/plain"
|
||||
@@ -24,7 +24,7 @@ curl_close($ch);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
string(%d) "АБВ.txt|application/octet-stream|5"
|
||||
string(%d) "АБВ.txt|application/octet-stream"
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
@@ -29,8 +29,8 @@ curl_close($ch2);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
string(%d) "АБВ.txt|application/octet-stream|5"
|
||||
string(%d) "АБВ.txt|application/octet-stream|5"
|
||||
string(%d) "АБВ.txt|application/octet-stream"
|
||||
string(%d) "АБВ.txt|application/octet-stream"
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
curl_copy_handle() allows to post CURLFile multiple times with curl_multi_exec()
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$ch1 = curl_init();
|
||||
curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1);
|
||||
curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
// curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$filename = __DIR__ . '/АБВ.txt';
|
||||
file_put_contents($filename, "Test.");
|
||||
$file = curl_file_create($filename);
|
||||
$params = array('file' => $file);
|
||||
var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params));
|
||||
|
||||
$ch2 = curl_copy_handle($ch1);
|
||||
$ch3 = curl_copy_handle($ch1);
|
||||
|
||||
$mh = curl_multi_init();
|
||||
curl_multi_add_handle($mh, $ch1);
|
||||
curl_multi_add_handle($mh, $ch2);
|
||||
do {
|
||||
$status = curl_multi_exec($mh, $active);
|
||||
if ($active) {
|
||||
curl_multi_select($mh);
|
||||
}
|
||||
} while ($active && $status == CURLM_OK);
|
||||
|
||||
curl_multi_remove_handle($mh, $ch1);
|
||||
curl_multi_remove_handle($mh, $ch2);
|
||||
curl_multi_remove_handle($mh, $ch3);
|
||||
curl_multi_close($mh);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
АБВ.txt|application/octet-stream|5АБВ.txt|application/octet-stream|5===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/АБВ.txt');
|
||||
?>
|
||||
@@ -1,52 +0,0 @@
|
||||
--TEST--
|
||||
curl_copy_handle() allows to post CURLFile multiple times if postfields change
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
|
||||
$ch1 = curl_init();
|
||||
curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1);
|
||||
curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file");
|
||||
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$filename = __DIR__ . '/abc.txt';
|
||||
file_put_contents($filename, "Test.");
|
||||
$file = curl_file_create($filename);
|
||||
$params = array('file' => $file);
|
||||
var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params));
|
||||
|
||||
$ch2 = curl_copy_handle($ch1);
|
||||
|
||||
$filename = __DIR__ . '/def.txt';
|
||||
file_put_contents($filename, "Other test.");
|
||||
$file = curl_file_create($filename);
|
||||
$params = array('file' => $file);
|
||||
var_dump(curl_setopt($ch2, CURLOPT_POSTFIELDS, $params));
|
||||
|
||||
$ch3 = curl_copy_handle($ch2);
|
||||
|
||||
var_dump(curl_exec($ch1));
|
||||
curl_close($ch1);
|
||||
|
||||
var_dump(curl_exec($ch2));
|
||||
curl_close($ch2);
|
||||
|
||||
var_dump(curl_exec($ch3));
|
||||
curl_close($ch3);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "abc.txt|application/octet-stream|5"
|
||||
string(%d) "def.txt|application/octet-stream|11"
|
||||
string(%d) "def.txt|application/octet-stream|11"
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/abc.txt');
|
||||
@unlink(__DIR__ . '/def.txt');
|
||||
?>
|
||||
@@ -60,15 +60,15 @@ var_dump(curl_exec($ch));
|
||||
curl_close($ch);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream|6"
|
||||
string(%d) "curl_testdata1.txt|text/plain|6"
|
||||
string(%d) "foo.txt|application/octet-stream|6"
|
||||
string(%d) "foo.txt|text/plain|6"
|
||||
string(%d) "curl_testdata1.txt|application/octet-stream"
|
||||
string(%d) "curl_testdata1.txt|text/plain"
|
||||
string(%d) "foo.txt|application/octet-stream"
|
||||
string(%d) "foo.txt|text/plain"
|
||||
string(%d) "text/plain"
|
||||
string(%d) "%s/curl_testdata1.txt"
|
||||
string(%d) "curl_testdata1.txt|text/plain|6"
|
||||
string(%d) "curl_testdata1.txt|text/plain"
|
||||
string(%d) "foo.txt"
|
||||
string(%d) "foo.txt|application/octet-stream|6"
|
||||
string(%d) "foo.txt|application/octet-stream"
|
||||
|
||||
Warning: curl_setopt(): Disabling safe uploads is no longer supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
@@ -24,5 +24,5 @@ curl_close($ch);
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
string(24) "i-love-php|text/plain|11"
|
||||
string(21) "i-love-php|text/plain"
|
||||
===DONE===
|
||||
@@ -28,7 +28,7 @@
|
||||
break;
|
||||
case 'file':
|
||||
if (isset($_FILES['file'])) {
|
||||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'] . '|' . $_FILES['file']['size'];
|
||||
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
|
||||
}
|
||||
break;
|
||||
case 'method':
|
||||
|
||||
+1
-1
@@ -342,7 +342,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
|
||||
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
|
||||
|
||||
if (handler != NULL) {
|
||||
xmlCharEncCloseFunc(handler);
|
||||
|
||||
+7
-3
@@ -431,9 +431,13 @@ int dom_node_child_nodes_read(dom_object *obj, zval *retval)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
php_dom_create_interator(retval, DOM_NODELIST);
|
||||
intern = Z_DOMOBJ_P(retval);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
|
||||
if (dom_node_children_valid(nodep) == FAILURE) {
|
||||
ZVAL_NULL(retval);
|
||||
} else {
|
||||
php_dom_create_interator(retval, DOM_NODELIST);
|
||||
intern = Z_DOMOBJ_P(retval);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ object(DOMText)#%d (19) {
|
||||
["parentNode"]=>
|
||||
NULL
|
||||
["childNodes"]=>
|
||||
string(22) "(object value omitted)"
|
||||
NULL
|
||||
["firstChild"]=>
|
||||
NULL
|
||||
["lastChild"]=>
|
||||
@@ -140,7 +140,7 @@ object(DOMText)#%d (19) {
|
||||
["parentNode"]=>
|
||||
NULL
|
||||
["childNodes"]=>
|
||||
string(22) "(object value omitted)"
|
||||
NULL
|
||||
["firstChild"]=>
|
||||
NULL
|
||||
["lastChild"]=>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Bug #77569 (Write Access Violation in DomImplementation)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$imp = new DOMImplementation;
|
||||
$dom = $imp->createDocument("", "");
|
||||
$dom->encoding = null;
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: main(): Invalid Document Encoding in %s on line %d
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79271 (DOMDocumentType::$childNodes is NULL)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dom = new DOMImplementation();
|
||||
$type = $dom->createDocumentType('html');
|
||||
var_dump($type->childNodes);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DOMNodeList)#%d (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
+10
-6
@@ -725,16 +725,18 @@ PHP_FUNCTION(enchant_dict_quick_check)
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
|
||||
size_t n_sugg;
|
||||
int n_sugg;
|
||||
size_t n_sugg_st;
|
||||
char **suggs;
|
||||
|
||||
if (!sugg && ZEND_NUM_ARGS() == 2) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
|
||||
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
|
||||
if (suggs && n_sugg) {
|
||||
size_t i;
|
||||
int i;
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
add_next_index_string(sugg, suggs[i]);
|
||||
}
|
||||
@@ -776,7 +778,8 @@ PHP_FUNCTION(enchant_dict_suggest)
|
||||
size_t wordlen;
|
||||
char **suggs;
|
||||
enchant_dict *pdict;
|
||||
size_t n_sugg;
|
||||
int n_sugg;
|
||||
size_t n_sugg_st;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -784,9 +787,10 @@ PHP_FUNCTION(enchant_dict_suggest)
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
|
||||
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
|
||||
if (suggs && n_sugg) {
|
||||
size_t i;
|
||||
int i;
|
||||
|
||||
array_init(return_value);
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
|
||||
@@ -3685,12 +3685,6 @@ ZEND_METHOD(FFI, new) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
if (type->size == 0) {
|
||||
zend_throw_error(zend_ffi_exception_ce, "Cannot instantiate FFI\\CData of zero size");
|
||||
zend_ffi_type_dtor(type_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = pemalloc(type->size, flags & ZEND_FFI_FLAG_PERSISTENT);
|
||||
memset(ptr, 0, type->size);
|
||||
|
||||
|
||||
@@ -6,17 +6,13 @@ FFI 023: GCC struct extensions
|
||||
ffi.enable=1
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
var_dump(FFI::sizeof(FFI::new("struct {}")));
|
||||
} catch (Throwable $e) {
|
||||
echo get_class($e) . ": " . $e->getMessage() . "\n";
|
||||
}
|
||||
var_dump(FFI::sizeof(FFI::new("struct {}")));
|
||||
var_dump(FFI::sizeof(FFI::new("struct {int a}")));
|
||||
var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
|
||||
?>
|
||||
ok
|
||||
--EXPECT--
|
||||
FFI\Exception: Cannot instantiate FFI\CData of zero size
|
||||
int(0)
|
||||
int(4)
|
||||
int(8)
|
||||
ok
|
||||
@@ -81,7 +81,7 @@ FFI\ParserException: '[*]' not allowed in other than function prototype scope at
|
||||
FFI\ParserException: '[*]' not allowed in other than function prototype scope at line 1
|
||||
FFI\ParserException: '[*]' not allowed in other than function prototype scope at line 1
|
||||
ok
|
||||
FFI\Exception: Cannot instantiate FFI\CData of zero size
|
||||
int(0)
|
||||
FFI\ParserException: '[]' not allowed at line 1
|
||||
FFI\ParserException: '[]' not allowed at line 1
|
||||
ok
|
||||
|
||||
@@ -26,4 +26,4 @@ bool(false)
|
||||
|
||||
Warning: FFI::isNull() expects parameter 1 to be FFI\CData, null given in %s045.php on line %d
|
||||
NULL
|
||||
FFI\Exception: Cannot instantiate FFI\CData of zero size
|
||||
FFI\Exception: FFI\Cdata is not a pointer
|
||||
@@ -4,5 +4,4 @@ if [[ ! -d libmagic.orig ]]; then
|
||||
wget -O - ftp://ftp.astron.com/pub/file/file-$VERSION.tar.gz \
|
||||
| tar -xz --strip-components=2 -C libmagic.orig file-$VERSION/src
|
||||
fi
|
||||
sed -e "s/X\.YY/${VERSION//.}/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h
|
||||
diff -u libmagic.orig libmagic | grep -v '^Only in' > libmagic.patch
|
||||
+59
-95
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c 2019-02-20 03:35:27.000000000 +0100
|
||||
+++ libmagic/apprentice.c 2020-03-02 15:04:23.670412600 +0100
|
||||
+++ libmagic/apprentice.c 2019-06-29 22:00:36.200336685 +0200
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -974,7 +974,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/ascmagic.c 2020-03-02 15:04:23.671413500 +0100
|
||||
+++ libmagic/ascmagic.c 2019-06-29 20:07:54.070996657 +0200
|
||||
@@ -96,7 +96,7 @@
|
||||
rv = file_ascmagic_with_encoding(ms, &bb,
|
||||
ubuf, ulen, code, type, text);
|
||||
@@ -1005,7 +1005,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/buffer.c libmagic/buffer.c
|
||||
--- libmagic.orig/buffer.c 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/buffer.c 2020-03-02 15:04:23.672412500 +0100
|
||||
+++ libmagic/buffer.c 2019-06-29 22:07:44.306641133 +0200
|
||||
@@ -31,19 +31,23 @@
|
||||
#endif /* lint */
|
||||
|
||||
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
|
||||
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c 2019-02-20 03:35:27.000000000 +0100
|
||||
+++ libmagic/cdf.c 2020-03-02 15:04:23.674415200 +0100
|
||||
+++ libmagic/cdf.c 2019-06-29 20:07:54.074996599 +0200
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -1264,28 +1264,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
*maxcount = 0;
|
||||
*info = NULL;
|
||||
return NULL;
|
||||
@@ -1013,8 +995,9 @@
|
||||
goto out;
|
||||
}
|
||||
nelements = CDF_GETUINT32(q, 1);
|
||||
- if (nelements == 0) {
|
||||
- DPRINTF(("CDF_VECTOR with nelements == 0\n"));
|
||||
+ if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
|
||||
+ DPRINTF(("CDF_VECTOR with nelements == %"
|
||||
+ SIZE_T_FORMAT "u\n", nelements));
|
||||
goto out;
|
||||
}
|
||||
slen = 2;
|
||||
@@ -1056,8 +1039,6 @@
|
||||
goto out;
|
||||
inp += nelem;
|
||||
}
|
||||
- DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
|
||||
- nelements));
|
||||
for (j = 0; j < nelements && i < sh.sh_properties;
|
||||
j++, i++)
|
||||
{
|
||||
@@ -1102,7 +1083,7 @@
|
||||
@@ -1102,7 +1084,7 @@
|
||||
}
|
||||
return 0;
|
||||
out:
|
||||
@@ -1294,7 +1273,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
*info = NULL;
|
||||
*count = 0;
|
||||
*maxcount = 0;
|
||||
@@ -1394,7 +1375,7 @@
|
||||
@@ -1394,7 +1376,7 @@
|
||||
cdf_directory_t *d;
|
||||
char name[__arraycount(d->d_name)];
|
||||
cdf_stream_t scn;
|
||||
@@ -1303,7 +1282,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
|
||||
static const char *types[] = { "empty", "user storage",
|
||||
"user stream", "lockbytes", "property", "root storage" };
|
||||
@@ -1436,7 +1417,7 @@
|
||||
@@ -1436,7 +1418,7 @@
|
||||
break;
|
||||
}
|
||||
cdf_dump_stream(&scn);
|
||||
@@ -1312,7 +1291,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1449,7 +1430,7 @@
|
||||
@@ -1449,7 +1431,7 @@
|
||||
cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
|
||||
{
|
||||
cdf_timestamp_t tp;
|
||||
@@ -1321,7 +1300,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
char buf[64];
|
||||
size_t i, j;
|
||||
|
||||
@@ -1534,7 +1515,7 @@
|
||||
@@ -1534,7 +1516,7 @@
|
||||
(void)fprintf(stderr, "Class %s\n", buf);
|
||||
(void)fprintf(stderr, "Count %d\n", ssi.si_count);
|
||||
cdf_dump_property_info(info, count);
|
||||
@@ -1330,7 +1309,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
}
|
||||
|
||||
|
||||
@@ -1555,7 +1536,7 @@
|
||||
@@ -1555,7 +1537,7 @@
|
||||
cdf_u16tos8(sbuf, ce[i].ce_namlen, ce[i].ce_name),
|
||||
cdf_ctime(&ts.tv_sec, tbuf));
|
||||
}
|
||||
@@ -1341,7 +1320,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
#endif
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h 2019-02-20 02:24:19.000000000 +0100
|
||||
+++ libmagic/cdf.h 2020-03-02 15:04:23.675416900 +0100
|
||||
+++ libmagic/cdf.h 2019-06-29 20:07:54.074996599 +0200
|
||||
@@ -35,10 +35,10 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -1356,17 +1335,9 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#define timespec timeval
|
||||
@@ -48,6 +48,7 @@
|
||||
typedef int32_t cdf_secid_t;
|
||||
|
||||
#define CDF_LOOP_LIMIT 10000
|
||||
+#define CDF_ELEMENT_LIMIT 100000
|
||||
|
||||
#define CDF_SECID_NULL 0
|
||||
#define CDF_SECID_FREE -1
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c 2019-03-12 21:43:05.000000000 +0100
|
||||
+++ libmagic/cdf_time.c 2020-03-02 15:04:23.676413000 +0100
|
||||
+++ libmagic/cdf_time.c 2019-06-29 20:07:54.074996599 +0200
|
||||
@@ -23,6 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1395,7 +1366,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/compress.c 2020-03-02 15:04:23.676413000 +0100
|
||||
+++ libmagic/compress.c 2019-06-29 20:07:54.078996542 +0200
|
||||
@@ -45,13 +45,11 @@
|
||||
#endif
|
||||
#include <string.h>
|
||||
@@ -1545,7 +1516,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
+#endif
|
||||
diff -u libmagic.orig/der.c libmagic/der.c
|
||||
--- libmagic.orig/der.c 2019-02-20 03:35:27.000000000 +0100
|
||||
+++ libmagic/der.c 2020-03-02 15:04:23.677412900 +0100
|
||||
+++ libmagic/der.c 2019-06-29 20:07:54.078996542 +0200
|
||||
@@ -51,7 +51,9 @@
|
||||
#include "magic.h"
|
||||
#include "der.h"
|
||||
@@ -1575,7 +1546,7 @@ diff -u libmagic.orig/der.c libmagic/der.c
|
||||
snprintf(buf + z, blen - z, "%.2x", d[i]);
|
||||
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
|
||||
--- libmagic.orig/elfclass.h 2019-02-20 02:30:19.000000000 +0100
|
||||
+++ libmagic/elfclass.h 2020-03-02 15:04:23.679414300 +0100
|
||||
+++ libmagic/elfclass.h 2019-06-29 20:07:54.078996542 +0200
|
||||
@@ -41,7 +41,7 @@
|
||||
return toomany(ms, "program headers", phnum);
|
||||
flags |= FLAGS_IS_CORE;
|
||||
@@ -1605,7 +1576,7 @@ diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
|
||||
CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
|
||||
diff -u libmagic.orig/encoding.c libmagic/encoding.c
|
||||
--- libmagic.orig/encoding.c 2019-04-15 18:48:41.000000000 +0200
|
||||
+++ libmagic/encoding.c 2020-03-02 15:04:23.680413600 +0100
|
||||
+++ libmagic/encoding.c 2019-06-29 20:07:54.078996542 +0200
|
||||
@@ -89,13 +89,13 @@
|
||||
*code_mime = "binary";
|
||||
|
||||
@@ -1636,7 +1607,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
|
||||
}
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/file.h 2020-03-02 15:04:23.682414300 +0100
|
||||
+++ libmagic/file.h 2019-06-29 20:32:19.553528888 +0200
|
||||
@@ -33,18 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1923,7 +1894,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
#endif
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c 2019-05-07 04:26:48.000000000 +0200
|
||||
+++ libmagic/fsmagic.c 2020-03-02 15:04:23.683417500 +0100
|
||||
+++ libmagic/fsmagic.c 2019-06-29 20:07:54.082996485 +0200
|
||||
@@ -66,26 +66,10 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -2216,7 +2187,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
case S_IFSOCK:
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/funcs.c 2020-03-02 15:04:23.684415800 +0100
|
||||
+++ libmagic/funcs.c 2019-06-29 20:07:54.082996485 +0200
|
||||
@@ -31,7 +31,6 @@
|
||||
#endif /* lint */
|
||||
|
||||
@@ -2438,7 +2409,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
if (ms->c.li == NULL) {
|
||||
file_oomem(ms, len);
|
||||
return -1;
|
||||
@@ -513,76 +520,38 @@
|
||||
@@ -513,76 +520,41 @@
|
||||
protected int
|
||||
file_replace(struct magic_set *ms, const char *pat, const char *rep)
|
||||
{
|
||||
@@ -2466,9 +2437,11 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
+ zend_string *repl;
|
||||
+ size_t rep_cnt = 0;
|
||||
+
|
||||
+ (void)setlocale(LC_CTYPE, "C");
|
||||
+
|
||||
+ opts |= PCRE2_MULTILINE;
|
||||
+ convert_libmagic_pattern(&patt, (char*)pat, strlen(pat), opts);
|
||||
+ if ((pce = pcre_get_compiled_regex_cache_ex(Z_STR(patt), 0)) == NULL) {
|
||||
+ if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
|
||||
+ zval_ptr_dtor(&patt);
|
||||
+ rep_cnt = -1;
|
||||
+ goto out;
|
||||
@@ -2537,11 +2510,12 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
- file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat,
|
||||
- errmsg);
|
||||
+out:
|
||||
+ (void)setlocale(LC_CTYPE, "");
|
||||
+ return rep_cnt;
|
||||
}
|
||||
|
||||
protected file_pushbuf_t *
|
||||
@@ -593,7 +562,7 @@
|
||||
@@ -593,7 +565,7 @@
|
||||
if (ms->event_flags & EVENT_HAD_ERR)
|
||||
return NULL;
|
||||
|
||||
@@ -2550,7 +2524,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
return NULL;
|
||||
|
||||
pb->buf = ms->o.buf;
|
||||
@@ -611,8 +580,8 @@
|
||||
@@ -611,8 +583,8 @@
|
||||
char *rbuf;
|
||||
|
||||
if (ms->event_flags & EVENT_HAD_ERR) {
|
||||
@@ -2561,7 +2535,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -621,7 +590,7 @@
|
||||
@@ -621,7 +593,7 @@
|
||||
ms->o.buf = pb->buf;
|
||||
ms->offset = pb->offset;
|
||||
|
||||
@@ -2572,7 +2546,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c 2019-05-07 04:27:11.000000000 +0200
|
||||
+++ libmagic/magic.c 2020-03-02 15:04:23.686413600 +0100
|
||||
+++ libmagic/magic.c 2019-06-29 20:07:54.082996485 +0200
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -3036,8 +3010,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
public const char *
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2020-03-02 15:06:39.235737800 +0100
|
||||
+++ libmagic/magic.h 2020-03-02 15:04:23.686413600 +0100
|
||||
--- libmagic.orig/magic.h 2019-06-29 20:13:10.290924369 +0200
|
||||
+++ libmagic/magic.h 2019-06-29 20:11:37.732033650 +0200
|
||||
@@ -124,6 +124,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -3048,7 +3022,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c 2019-03-12 21:43:05.000000000 +0100
|
||||
+++ libmagic/print.c 2020-03-02 15:04:23.688414000 +0100
|
||||
+++ libmagic/print.c 2019-06-29 20:07:54.082996485 +0200
|
||||
@@ -28,6 +28,7 @@
|
||||
/*
|
||||
* print.c - debugging printout routines
|
||||
@@ -3122,7 +3096,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
goto out;
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c 2019-03-12 21:43:05.000000000 +0100
|
||||
+++ libmagic/readcdf.c 2020-03-02 15:04:23.689414500 +0100
|
||||
+++ libmagic/readcdf.c 2019-06-29 22:10:43.100179773 +0200
|
||||
@@ -31,7 +31,11 @@
|
||||
|
||||
#include <assert.h>
|
||||
@@ -3146,13 +3120,12 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -112,30 +112,24 @@
|
||||
@@ -112,30 +112,14 @@
|
||||
{
|
||||
size_t i;
|
||||
const char *rv = NULL;
|
||||
-#ifdef USE_C_LOCALE
|
||||
- locale_t old_lc_ctype, c_lc_ctype;
|
||||
+ char *vbuf_lower;
|
||||
|
||||
- c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
|
||||
- assert(c_lc_ctype != NULL);
|
||||
@@ -3161,18 +3134,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
-#else
|
||||
- char *old_lc_ctype = setlocale(LC_CTYPE, "C");
|
||||
-#endif
|
||||
- for (i = 0; nv[i].pattern != NULL; i++)
|
||||
- if (strcasestr(vbuf, nv[i].pattern) != NULL) {
|
||||
+ vbuf_lower = zend_str_tolower_dup(vbuf, strlen(vbuf));
|
||||
+ for (i = 0; nv[i].pattern != NULL; i++) {
|
||||
+ char *pattern_lower;
|
||||
+ int found;
|
||||
+
|
||||
+ pattern_lower = zend_str_tolower_dup(nv[i].pattern, strlen(nv[i].pattern));
|
||||
+ found = (strstr(vbuf_lower, pattern_lower) != NULL);
|
||||
+ efree(pattern_lower);
|
||||
+
|
||||
+ if (found) {
|
||||
+ (void)setlocale(LC_CTYPE, "C");
|
||||
for (i = 0; nv[i].pattern != NULL; i++)
|
||||
if (strcasestr(vbuf, nv[i].pattern) != NULL) {
|
||||
rv = nv[i].mime;
|
||||
break;
|
||||
}
|
||||
@@ -3185,13 +3149,11 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
-#else
|
||||
- setlocale(LC_CTYPE, old_lc_ctype);
|
||||
-#endif
|
||||
+ }
|
||||
+
|
||||
+ efree(vbuf_lower);
|
||||
+ (void)setlocale(LC_CTYPE, "");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -151,7 +145,9 @@
|
||||
@@ -151,7 +135,9 @@
|
||||
const char *s, *e;
|
||||
int len;
|
||||
|
||||
@@ -3202,7 +3164,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
|
||||
clsid2mime);
|
||||
|
||||
@@ -277,10 +273,10 @@
|
||||
@@ -277,10 +263,10 @@
|
||||
if (file_printf(ms, "%s%s",
|
||||
cdf_u16tos8(buf, ce[i].ce_namlen, ce[i].ce_name),
|
||||
i == cat->cat_num - 1 ? "]" : ", ") == -1) {
|
||||
@@ -3215,7 +3177,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
} else if (ms->flags & MAGIC_MIME_TYPE) {
|
||||
if (file_printf(ms, "application/CDFV2") == -1)
|
||||
return -1;
|
||||
@@ -341,7 +337,7 @@
|
||||
@@ -341,7 +327,7 @@
|
||||
}
|
||||
|
||||
m = cdf_file_property_info(ms, info, count, root_storage);
|
||||
@@ -3224,7 +3186,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
|
||||
return m == -1 ? -2 : m;
|
||||
}
|
||||
@@ -651,11 +647,11 @@
|
||||
@@ -651,11 +637,11 @@
|
||||
cdf_zero_stream(&scn);
|
||||
cdf_zero_stream(&sst);
|
||||
out3:
|
||||
@@ -3241,7 +3203,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
if (i != -1)
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
|
||||
+++ libmagic/softmagic.c 2020-03-02 15:04:23.690413500 +0100
|
||||
+++ libmagic/softmagic.c 2019-06-29 20:07:54.086996427 +0200
|
||||
@@ -43,6 +43,10 @@
|
||||
#include <time.h>
|
||||
#include "der.h"
|
||||
@@ -3285,13 +3247,14 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
#define FLT (STRING_BINTEST | STRING_TEXTTEST)
|
||||
((text && (m->str_flags & FLT) == STRING_BINTEST) ||
|
||||
(!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
|
||||
@@ -463,45 +469,28 @@
|
||||
@@ -463,45 +469,30 @@
|
||||
private int
|
||||
check_fmt(struct magic_set *ms, const char *fmt)
|
||||
{
|
||||
- file_regex_t rx;
|
||||
- int rc, rv = -1;
|
||||
+ pcre_cache_entry *pce;
|
||||
+ pcre2_code *pce;
|
||||
+ uint32_t capture_count;
|
||||
+ int rv = -1;
|
||||
+ zend_string *pattern;
|
||||
|
||||
@@ -3301,21 +3264,22 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
- rc = file_regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
|
||||
- if (rc) {
|
||||
- file_regerror(&rx, rc, ms);
|
||||
+ (void)setlocale(LC_CTYPE, "C");
|
||||
+ pattern = zend_string_init("~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, 0);
|
||||
+ if ((pce = pcre_get_compiled_regex_cache_ex(pattern, 0)) == NULL) {
|
||||
+ if ((pce = pcre_get_compiled_regex(pattern, &capture_count)) == NULL) {
|
||||
+ rv = -1;
|
||||
} else {
|
||||
- rc = file_regexec(&rx, fmt, 0, 0, 0);
|
||||
- rv = !rc;
|
||||
+ pcre2_code *re = php_pcre_pce_re(pce);
|
||||
+ pcre2_match_data *match_data = php_pcre_create_match_data(0, re);
|
||||
+ pcre2_match_data *match_data = php_pcre_create_match_data(capture_count, pce);
|
||||
+ if (match_data) {
|
||||
+ rv = pcre2_match(re, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
|
||||
+ rv = pcre2_match(pce, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
|
||||
+ php_pcre_free_match_data(match_data);
|
||||
+ }
|
||||
}
|
||||
- file_regfree(&rx);
|
||||
+ zend_string_release(pattern);
|
||||
+ zend_string_release_ex(pattern, 0);
|
||||
+ (void)setlocale(LC_CTYPE, "");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -3344,7 +3308,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
static int
|
||||
varexpand(struct magic_set *ms, char *buf, size_t len, const char *str)
|
||||
{
|
||||
@@ -796,15 +785,11 @@
|
||||
@@ -796,15 +787,11 @@
|
||||
char *cp;
|
||||
int rval;
|
||||
|
||||
@@ -3363,7 +3327,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
if (rval == -1)
|
||||
return -1;
|
||||
@@ -1555,9 +1540,6 @@
|
||||
@@ -1555,9 +1542,6 @@
|
||||
*indir_count, *name_count);
|
||||
mdebug(offset, RCAST(char *, RCAST(void *, p)),
|
||||
sizeof(union VALUETYPE));
|
||||
@@ -3373,7 +3337,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1685,7 +1667,7 @@
|
||||
@@ -1685,7 +1669,7 @@
|
||||
offset = do_ops(m, SEXT(sgn,64,BE64(p)), off);
|
||||
break;
|
||||
default:
|
||||
@@ -3382,7 +3346,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIROFFADD) {
|
||||
@@ -1706,9 +1688,6 @@
|
||||
@@ -1706,9 +1690,6 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
mdebug(offset, RCAST(char *, RCAST(void *, p)),
|
||||
sizeof(union VALUETYPE));
|
||||
@@ -3392,7 +3356,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1792,17 +1771,16 @@
|
||||
@@ -1792,17 +1773,16 @@
|
||||
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & MAGIC_NODESC) == 0 &&
|
||||
@@ -3414,7 +3378,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return rv;
|
||||
|
||||
case FILE_USE:
|
||||
@@ -1926,6 +1904,47 @@
|
||||
@@ -1926,6 +1906,47 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3462,7 +3426,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -2104,65 +2123,77 @@
|
||||
@@ -2104,65 +2125,77 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
@@ -3594,7 +3558,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
case FILE_INDIRECT:
|
||||
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
|
||||
--- libmagic.orig/strcasestr.c 2014-09-11 17:05:33.000000000 +0200
|
||||
+++ libmagic/strcasestr.c 2019-04-02 11:56:06.853152400 +0200
|
||||
+++ libmagic/strcasestr.c 2019-06-29 20:07:54.086996427 +0200
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "file.h"
|
||||
|
||||
@@ -63,6 +63,9 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr
|
||||
|
||||
/* {{{ php_converter_default_callback */
|
||||
static void php_converter_default_callback(zval *return_value, zval *zobj, zend_long reason, zval *error) {
|
||||
ZVAL_DEREF(error);
|
||||
zval_ptr_dtor(error);
|
||||
ZVAL_LONG(error, U_ZERO_ERROR);
|
||||
/* Basic functionality so children can call parent::toUCallback() */
|
||||
switch (reason) {
|
||||
case UCNV_UNASSIGNED:
|
||||
@@ -78,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, zend_
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZEND_TRY_ASSIGN_REF_LONG(error, U_INVALID_STATE_ERROR);
|
||||
ZVAL_LONG(error, U_INVALID_STATE_ERROR);
|
||||
RETVAL_STRINGL(chars, chars_len);
|
||||
return;
|
||||
}
|
||||
@@ -96,8 +99,8 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, zend_
|
||||
chars[0] = 0x1A;
|
||||
chars[1] = 0;
|
||||
chars_len = 1;
|
||||
ZVAL_LONG(error, uerror);
|
||||
}
|
||||
ZEND_TRY_ASSIGN_REF_LONG(error, uerror);
|
||||
RETVAL_STRINGL(chars, chars_len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ static int driver_embedded_read(mysqli_object *obj, zval *retval, zend_bool quie
|
||||
/* {{{ property driver_client_version_read */
|
||||
static int driver_client_version_read(mysqli_object *obj, zval *retval, zend_bool quiet)
|
||||
{
|
||||
ZVAL_LONG(retval, mysql_get_client_version());
|
||||
ZVAL_LONG(retval, MYSQL_VERSION_ID);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,6 @@ if (PHP_MYSQLND != "no") {
|
||||
{
|
||||
AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Compression support");
|
||||
AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "SSL support");
|
||||
if (CHECK_LIB("crypt32.lib", "mysqlnd")) {
|
||||
AC_DEFINE("MYSQLND_HAVE_SSL", 1, "Extended SSL support");
|
||||
}
|
||||
}
|
||||
PHP_INSTALL_HEADERS("", "ext/mysqlnd");
|
||||
}
|
||||
|
||||
+61
-212
@@ -694,146 +694,20 @@ mysqlnd_xor_string(char * dst, const size_t dst_len, const char * xor_str, const
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
typedef RSA * mysqlnd_rsa_t;
|
||||
|
||||
/* {{{ mysqlnd_sha256_get_rsa_from_pem */
|
||||
static mysqlnd_rsa_t
|
||||
mysqlnd_sha256_get_rsa_from_pem(const char *buf, size_t len)
|
||||
{
|
||||
BIO * bio = BIO_new_mem_buf(buf, len);
|
||||
RSA * ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_sha256_public_encrypt */
|
||||
static zend_uchar *
|
||||
mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t passwd_len, size_t * auth_data_len, char *xor_str)
|
||||
{
|
||||
zend_uchar * ret = NULL;
|
||||
size_t server_public_key_len = (size_t) RSA_size(server_public_key);
|
||||
|
||||
DBG_ENTER("mysqlnd_sha256_public_encrypt");
|
||||
/*
|
||||
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 (server_public_key_len <= passwd_len + 41) {
|
||||
/* 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(NULL);
|
||||
}
|
||||
|
||||
*auth_data_len = server_public_key_len;
|
||||
ret = malloc(*auth_data_len);
|
||||
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, ret, server_public_key, RSA_PKCS1_OAEP_PADDING);
|
||||
RSA_free(server_public_key);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#else
|
||||
|
||||
#include <wincrypt.h>
|
||||
#include <bcrypt.h>
|
||||
|
||||
typedef HANDLE mysqlnd_rsa_t;
|
||||
|
||||
/* {{{ mysqlnd_sha256_get_rsa_from_pem */
|
||||
static mysqlnd_rsa_t
|
||||
mysqlnd_sha256_get_rsa_from_pem(const char *buf, size_t len)
|
||||
{
|
||||
BCRYPT_KEY_HANDLE ret = 0;
|
||||
LPCSTR der_buf = NULL;
|
||||
DWORD der_len;
|
||||
CERT_PUBLIC_KEY_INFO *key_info = NULL;
|
||||
DWORD key_info_len;
|
||||
ALLOCA_FLAG(use_heap);
|
||||
|
||||
if (!CryptStringToBinaryA(buf, len, CRYPT_STRING_BASE64HEADER, NULL, &der_len, NULL, NULL)) {
|
||||
goto finish;
|
||||
}
|
||||
der_buf = do_alloca(der_len, use_heap);
|
||||
if (!CryptStringToBinaryA(buf, len, CRYPT_STRING_BASE64HEADER, der_buf, &der_len, NULL, NULL)) {
|
||||
goto finish;
|
||||
}
|
||||
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, der_buf, der_len, CRYPT_ENCODE_ALLOC_FLAG, NULL, &key_info, &key_info_len)) {
|
||||
goto finish;
|
||||
}
|
||||
if (!CryptImportPublicKeyInfoEx2(X509_ASN_ENCODING, key_info, CRYPT_OID_INFO_PUBKEY_ENCRYPT_KEY_FLAG, NULL, &ret)) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
finish:
|
||||
if (key_info) {
|
||||
LocalFree(key_info);
|
||||
}
|
||||
if (der_buf) {
|
||||
free_alloca(der_buf, use_heap);
|
||||
}
|
||||
return (mysqlnd_rsa_t) ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ mysqlnd_sha256_public_encrypt */
|
||||
static zend_uchar *
|
||||
mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t passwd_len, size_t * auth_data_len, char *xor_str)
|
||||
{
|
||||
zend_uchar * ret = NULL;
|
||||
DWORD server_public_key_len = passwd_len;
|
||||
BCRYPT_OAEP_PADDING_INFO padding_info;
|
||||
|
||||
DBG_ENTER("mysqlnd_sha256_public_encrypt");
|
||||
|
||||
ZeroMemory(&padding_info, sizeof padding_info);
|
||||
padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
||||
/*
|
||||
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 <= passwd_len + 41) {
|
||||
/* 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);
|
||||
}
|
||||
|
||||
*auth_data_len = server_public_key_len;
|
||||
ret = malloc(*auth_data_len);
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, ret, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
|
||||
DBG_RETURN(ret);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/* {{{ mysqlnd_sha256_get_rsa_key */
|
||||
static mysqlnd_rsa_t
|
||||
static RSA *
|
||||
mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
|
||||
const MYSQLND_SESSION_OPTIONS * const session_options,
|
||||
const MYSQLND_PFC_DATA * const pfc_data
|
||||
)
|
||||
{
|
||||
mysqlnd_rsa_t ret = NULL;
|
||||
RSA * ret = NULL;
|
||||
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);
|
||||
@@ -865,7 +739,11 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
|
||||
}
|
||||
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
|
||||
/* now extract the public key */
|
||||
ret = mysqlnd_sha256_get_rsa_from_pem((const char *) pk_resp_packet.public_key, pk_resp_packet.public_key_len);
|
||||
{
|
||||
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(&pk_req_packet);
|
||||
PACKET_FREE(&pk_resp_packet);
|
||||
@@ -884,7 +762,9 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
|
||||
|
||||
if (stream) {
|
||||
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
|
||||
ret = mysqlnd_sha256_get_rsa_from_pem(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
|
||||
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_ex(key_str, 0);
|
||||
@@ -908,7 +788,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
|
||||
const zend_ulong mysql_flags
|
||||
)
|
||||
{
|
||||
mysqlnd_rsa_t server_public_key;
|
||||
RSA * server_public_key;
|
||||
zend_uchar * ret = NULL;
|
||||
DBG_ENTER("mysqlnd_sha256_auth_get_auth_data");
|
||||
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
|
||||
@@ -925,13 +805,29 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
|
||||
server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
|
||||
|
||||
if (server_public_key) {
|
||||
ALLOCA_FLAG(use_heap);
|
||||
char *xor_str = do_alloca(passwd_len + 1, use_heap);
|
||||
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);
|
||||
ret = mysqlnd_sha256_public_encrypt(conn, server_public_key, passwd_len, auth_data_len, xor_str);
|
||||
free_alloca(xor_str, use_heap);
|
||||
|
||||
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(NULL);
|
||||
}
|
||||
|
||||
*auth_data_len = server_public_key_len;
|
||||
ret = malloc(*auth_data_len);
|
||||
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, ret, server_public_key, RSA_PKCS1_OAEP_PADDING);
|
||||
RSA_free(server_public_key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1002,73 +898,6 @@ void php_mysqlnd_scramble_sha2(zend_uchar * const buffer, const zend_uchar * con
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_public_encrypt */
|
||||
static size_t
|
||||
mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t passwd_len, unsigned char **crypted, char *xor_str)
|
||||
{
|
||||
size_t server_public_key_len = (size_t) RSA_size(server_public_key);
|
||||
|
||||
DBG_ENTER("mysqlnd_caching_sha2_public_encrypt");
|
||||
/*
|
||||
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 (server_public_key_len <= passwd_len + 41) {
|
||||
/* 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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#else
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_public_encrypt */
|
||||
static size_t
|
||||
mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t passwd_len, unsigned char **crypted, char *xor_str)
|
||||
{
|
||||
DWORD server_public_key_len = passwd_len;
|
||||
BCRYPT_OAEP_PADDING_INFO padding_info;
|
||||
|
||||
DBG_ENTER("mysqlnd_caching_sha2_public_encrypt");
|
||||
|
||||
ZeroMemory(&padding_info, sizeof padding_info);
|
||||
padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
|
||||
/*
|
||||
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 <= passwd_len + 41) {
|
||||
/* 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);
|
||||
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
|
||||
NULL, 0, *crypted, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
|
||||
DBG_RETURN(0);
|
||||
}
|
||||
DBG_RETURN(server_public_key_len);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif
|
||||
|
||||
/* {{{ mysqlnd_native_auth_get_auth_data */
|
||||
static zend_uchar *
|
||||
@@ -1106,10 +935,10 @@ mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * sel
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static mysqlnd_rsa_t
|
||||
static RSA *
|
||||
mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
{
|
||||
mysqlnd_rsa_t ret = NULL;
|
||||
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:
|
||||
@@ -1143,7 +972,11 @@ mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
}
|
||||
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet.public_key_len, pk_resp_packet.public_key);
|
||||
/* now extract the public key */
|
||||
ret = mysqlnd_sha256_get_rsa_from_pem((const char *) pk_resp_packet.public_key, pk_resp_packet.public_key_len);
|
||||
{
|
||||
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);
|
||||
@@ -1162,7 +995,9 @@ mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
|
||||
if (stream) {
|
||||
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
|
||||
ret = mysqlnd_sha256_get_rsa_from_pem(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
|
||||
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);
|
||||
@@ -1175,7 +1010,7 @@ mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
|
||||
}
|
||||
|
||||
|
||||
/* {{{ mysqlnd_caching_sha2_get_and_use_key */
|
||||
/* {{{ 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, const size_t auth_plugin_data_len,
|
||||
@@ -1183,19 +1018,33 @@ mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn,
|
||||
const char * const passwd,
|
||||
const size_t passwd_len)
|
||||
{
|
||||
mysqlnd_rsa_t server_public_key = mysqlnd_caching_sha2_get_key(conn);
|
||||
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;
|
||||
ALLOCA_FLAG(use_heap)
|
||||
char *xor_str = do_alloca(passwd_len + 1, use_heap);
|
||||
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, SCRAMBLE_LENGTH);
|
||||
server_public_key_len = mysqlnd_caching_sha2_public_encrypt(conn, server_public_key, passwd_len, crypted, xor_str);
|
||||
free_alloca(xor_str, use_heap);
|
||||
|
||||
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);
|
||||
|
||||
@@ -2141,8 +2141,12 @@ size_t php_mysqlnd_cached_sha2_result_write(MYSQLND_CONN_DATA * conn, void * _pa
|
||||
MYSQLND_PFC * pfc = conn->protocol_frame_codec;
|
||||
MYSQLND_VIO * vio = conn->vio;
|
||||
MYSQLND_STATS * stats = conn->stats;
|
||||
#if HAVE_COMPILER_C99_VLA
|
||||
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");
|
||||
@@ -2155,7 +2159,10 @@ size_t php_mysqlnd_cached_sha2_result_write(MYSQLND_CONN_DATA * conn, void * _pa
|
||||
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
|
||||
}
|
||||
|
||||
#if !HAVE_COMPILER_C99_VLA
|
||||
free_alloca(buffer, use_heap);
|
||||
#endif
|
||||
|
||||
DBG_RETURN(sent);
|
||||
}
|
||||
|
||||
|
||||
@@ -2761,10 +2761,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
|
||||
}
|
||||
if ((t1 & (MAY_BE_ANY|MAY_BE_UNDEF)) == MAY_BE_LONG) {
|
||||
if (!ssa_var_info[ssa_ops[i].op1_use].has_range ||
|
||||
(opline->opcode == ZEND_POST_DEC &&
|
||||
(opline->opcode == ZEND_PRE_DEC &&
|
||||
(ssa_var_info[ssa_ops[i].op1_use].range.underflow ||
|
||||
ssa_var_info[ssa_ops[i].op1_use].range.min == ZEND_LONG_MIN)) ||
|
||||
(opline->opcode == ZEND_POST_INC &&
|
||||
(opline->opcode == ZEND_PRE_INC &&
|
||||
(ssa_var_info[ssa_ops[i].op1_use].range.overflow ||
|
||||
ssa_var_info[ssa_ops[i].op1_use].range.max == ZEND_LONG_MAX))) {
|
||||
/* may overflow */
|
||||
|
||||
@@ -4233,12 +4233,9 @@ static void preload_load(void)
|
||||
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
|
||||
}
|
||||
if (CG(map_ptr_last) != ZCSG(map_ptr_last)) {
|
||||
size_t old_map_ptr_last = CG(map_ptr_last);
|
||||
CG(map_ptr_last) = ZCSG(map_ptr_last);
|
||||
CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(CG(map_ptr_last) + 1, 4096);
|
||||
CG(map_ptr_base) = perealloc(CG(map_ptr_base), CG(map_ptr_size) * sizeof(void*), 1);
|
||||
memset((void **) CG(map_ptr_base) + old_map_ptr_last, 0,
|
||||
(CG(map_ptr_last) - old_map_ptr_last) * sizeof(void *));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-56
@@ -995,20 +995,6 @@ static inline void populate_match_value(
|
||||
}
|
||||
}
|
||||
|
||||
static inline void add_named(
|
||||
zval *subpats, zend_string *name, zval *val, zend_bool unmatched) {
|
||||
/* If the DUPNAMES option is used, multiple subpatterns might have the same name.
|
||||
* In this case we want to preserve the one that actually has a value. */
|
||||
if (!unmatched) {
|
||||
zend_hash_update(Z_ARRVAL_P(subpats), name, val);
|
||||
} else {
|
||||
if (!zend_hash_add(Z_ARRVAL_P(subpats), name, val)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Z_TRY_ADDREF_P(val);
|
||||
}
|
||||
|
||||
/* {{{ add_offset_pair */
|
||||
static inline void add_offset_pair(
|
||||
zval *result, const char *subject, PCRE2_SIZE start_offset, PCRE2_SIZE end_offset,
|
||||
@@ -1037,7 +1023,8 @@ static inline void add_offset_pair(
|
||||
}
|
||||
|
||||
if (name) {
|
||||
add_named(result, name, &match_pair, start_offset == PCRE2_UNSET);
|
||||
Z_ADDREF(match_pair);
|
||||
zend_hash_update(Z_ARRVAL_P(result), name, &match_pair);
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair);
|
||||
}
|
||||
@@ -1067,7 +1054,8 @@ static void populate_subpat_array(
|
||||
populate_match_value(
|
||||
&val, subject, offsets[2*i], offsets[2*i+1], unmatched_as_null);
|
||||
if (subpat_names[i]) {
|
||||
add_named(subpats, subpat_names[i], &val, offsets[2*i] == PCRE2_UNSET);
|
||||
Z_TRY_ADDREF(val);
|
||||
zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i], &val);
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &val);
|
||||
}
|
||||
@@ -1075,7 +1063,7 @@ static void populate_subpat_array(
|
||||
for (i = count; i < num_subpats; i++) {
|
||||
ZVAL_NULL(&val);
|
||||
if (subpat_names[i]) {
|
||||
zend_hash_add(Z_ARRVAL_P(subpats), subpat_names[i], &val);
|
||||
zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i], &val);
|
||||
}
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &val);
|
||||
}
|
||||
@@ -1142,22 +1130,6 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_always_inline zend_bool is_known_valid_utf8(
|
||||
zend_string *subject_str, PCRE2_SIZE start_offset) {
|
||||
if (!(GC_FLAGS(subject_str) & IS_STR_VALID_UTF8)) {
|
||||
/* We don't know whether the string is valid UTF-8 or not. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (start_offset == ZSTR_LEN(subject_str)) {
|
||||
/* Degenerate case: Offset points to end of string. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check that the offset does not point to an UTF-8 continuation byte. */
|
||||
return (ZSTR_VAL(subject_str)[start_offset] & 0xc0) != 0x80;
|
||||
}
|
||||
|
||||
/* {{{ php_pcre_match_impl() */
|
||||
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
|
||||
zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset)
|
||||
@@ -1179,7 +1151,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str,
|
||||
PCRE2_SPTR mark = NULL; /* Target for MARK name */
|
||||
zval marks; /* Array of marks for PREG_PATTERN_ORDER */
|
||||
pcre2_match_data *match_data;
|
||||
PCRE2_SIZE start_offset2, orig_start_offset;
|
||||
PCRE2_SIZE start_offset2;
|
||||
|
||||
char *subject = ZSTR_VAL(subject_str);
|
||||
size_t subject_len = ZSTR_LEN(subject_str);
|
||||
@@ -1275,10 +1247,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str,
|
||||
}
|
||||
}
|
||||
|
||||
orig_start_offset = start_offset2;
|
||||
options =
|
||||
(pce->compile_options & PCRE2_UTF) && !is_known_valid_utf8(subject_str, orig_start_offset)
|
||||
? 0 : PCRE2_NO_UTF_CHECK;
|
||||
options = (pce->compile_options & PCRE2_UTF) && !(GC_FLAGS(subject_str) & IS_STR_VALID_UTF8)
|
||||
? 0 : PCRE2_NO_UTF_CHECK;
|
||||
|
||||
/* Execute the regular expression. */
|
||||
#ifdef HAVE_PCRE_JIT_SUPPORT
|
||||
@@ -1468,8 +1438,7 @@ error:
|
||||
|
||||
if (PCRE_G(error_code) == PHP_PCRE_NO_ERROR) {
|
||||
/* If there was no error and we're in /u mode, remember that the string is valid UTF-8. */
|
||||
if ((pce->compile_options & PCRE2_UTF)
|
||||
&& !ZSTR_IS_INTERNED(subject_str) && orig_start_offset == 0) {
|
||||
if ((pce->compile_options & PCRE2_UTF) && !ZSTR_IS_INTERNED(subject_str)) {
|
||||
GC_ADD_FLAGS(subject_str, IS_STR_VALID_UTF8);
|
||||
}
|
||||
|
||||
@@ -1613,7 +1582,6 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
|
||||
size_t match_len; /* Length of the current match */
|
||||
int backref; /* Backreference number */
|
||||
PCRE2_SIZE start_offset; /* Where the new search starts */
|
||||
size_t last_end_offset; /* Where the last search ended */
|
||||
char *walkbuf, /* Location of current replacement in the result */
|
||||
*walk, /* Used to walk the replacement string */
|
||||
*match, /* The current match */
|
||||
@@ -1632,7 +1600,6 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
|
||||
/* Initialize */
|
||||
match = NULL;
|
||||
start_offset = 0;
|
||||
last_end_offset = 0;
|
||||
result_len = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
@@ -1659,7 +1626,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
|
||||
options, match_data, mctx);
|
||||
|
||||
while (1) {
|
||||
piece = subject + last_end_offset;
|
||||
piece = subject + start_offset;
|
||||
|
||||
if (count >= 0 && limit > 0) {
|
||||
zend_bool simple_string;
|
||||
@@ -1689,7 +1656,7 @@ matched:
|
||||
/* Set the match location in subject */
|
||||
match = subject + offsets[0];
|
||||
|
||||
new_len = result_len + offsets[0] - last_end_offset; /* part before the match */
|
||||
new_len = result_len + offsets[0] - start_offset; /* part before the match */
|
||||
|
||||
walk = ZSTR_VAL(replace_str);
|
||||
replace_end = walk + ZSTR_LEN(replace_str);
|
||||
@@ -1766,7 +1733,7 @@ matched:
|
||||
limit--;
|
||||
|
||||
/* Advance to the next piece. */
|
||||
start_offset = last_end_offset = offsets[1];
|
||||
start_offset = offsets[1];
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE2_NOTEMPTY_ATSTART and try
|
||||
@@ -1786,7 +1753,10 @@ matched:
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
if (start_offset < subject_len) {
|
||||
size_t unit_len = calculate_unit_length(pce, piece);
|
||||
|
||||
start_offset += unit_len;
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, unit_len);
|
||||
result_len += unit_len;
|
||||
} else {
|
||||
goto not_matched;
|
||||
}
|
||||
@@ -1801,7 +1771,7 @@ not_matched:
|
||||
result = zend_string_copy(subject_str);
|
||||
break;
|
||||
}
|
||||
new_len = result_len + subject_len - last_end_offset;
|
||||
new_len = result_len + subject_len - start_offset;
|
||||
if (new_len >= alloc_len) {
|
||||
alloc_len = new_len; /* now we know exactly how long it is */
|
||||
if (NULL != result) {
|
||||
@@ -1811,8 +1781,8 @@ not_matched:
|
||||
}
|
||||
}
|
||||
/* stick that last bit of string on our output */
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, subject_len - last_end_offset);
|
||||
result_len += subject_len - last_end_offset;
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, subject_len - start_offset);
|
||||
result_len += subject_len - start_offset;
|
||||
ZSTR_VAL(result)[result_len] = '\0';
|
||||
ZSTR_LEN(result) = result_len;
|
||||
break;
|
||||
@@ -1854,7 +1824,6 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
|
||||
size_t new_len; /* Length of needed storage */
|
||||
size_t alloc_len; /* Actual allocated length */
|
||||
PCRE2_SIZE start_offset; /* Where the new search starts */
|
||||
size_t last_end_offset; /* Where the last search ended */
|
||||
char *match, /* The current match */
|
||||
*piece; /* The current piece of subject */
|
||||
size_t result_len; /* Length of result */
|
||||
@@ -1884,7 +1853,6 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
|
||||
/* Initialize */
|
||||
match = NULL;
|
||||
start_offset = 0;
|
||||
last_end_offset = 0;
|
||||
result_len = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
@@ -1917,7 +1885,7 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
|
||||
options, match_data, mctx);
|
||||
|
||||
while (1) {
|
||||
piece = subject + last_end_offset;
|
||||
piece = subject + start_offset;
|
||||
|
||||
if (count >= 0 && limit) {
|
||||
/* Check for too many substrings condition. */
|
||||
@@ -1945,7 +1913,7 @@ matched:
|
||||
/* Set the match location in subject */
|
||||
match = subject + offsets[0];
|
||||
|
||||
new_len = result_len + offsets[0] - last_end_offset; /* part before the match */
|
||||
new_len = result_len + offsets[0] - start_offset; /* part before the match */
|
||||
|
||||
/* Use custom function to get replacement string and its length. */
|
||||
eval_result = preg_do_repl_func(
|
||||
@@ -1977,7 +1945,7 @@ matched:
|
||||
limit--;
|
||||
|
||||
/* Advance to the next piece. */
|
||||
start_offset = last_end_offset = offsets[1];
|
||||
start_offset = offsets[1];
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE2_NOTEMPTY_ATSTART and try
|
||||
@@ -1997,7 +1965,10 @@ matched:
|
||||
to achieve this, unless we're already at the end of the string. */
|
||||
if (start_offset < subject_len) {
|
||||
size_t unit_len = calculate_unit_length(pce, piece);
|
||||
|
||||
start_offset += unit_len;
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, unit_len);
|
||||
result_len += unit_len;
|
||||
} else {
|
||||
goto not_matched;
|
||||
}
|
||||
@@ -2012,7 +1983,7 @@ not_matched:
|
||||
result = zend_string_copy(subject_str);
|
||||
break;
|
||||
}
|
||||
new_len = result_len + subject_len - last_end_offset;
|
||||
new_len = result_len + subject_len - start_offset;
|
||||
if (new_len >= alloc_len) {
|
||||
alloc_len = new_len; /* now we know exactly how long it is */
|
||||
if (NULL != result) {
|
||||
@@ -2022,8 +1993,8 @@ not_matched:
|
||||
}
|
||||
}
|
||||
/* stick that last bit of string on our output */
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, subject_len - last_end_offset);
|
||||
result_len += subject_len - last_end_offset;
|
||||
memcpy(ZSTR_VAL(result) + result_len, piece, subject_len - start_offset);
|
||||
result_len += subject_len - start_offset;
|
||||
ZSTR_VAL(result)[result_len] = '\0';
|
||||
ZSTR_LEN(result) = result_len;
|
||||
break;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79188: Memory corruption in preg_replace/preg_replace_callback and unicode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(preg_replace("//u", "", "a" . str_repeat("\u{1f612}", 10)));
|
||||
var_dump(preg_replace_callback(
|
||||
"//u", function() { return ""; }, "a" . str_repeat("\u{1f612}", 10)));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(41) "a😒😒😒😒😒😒😒😒😒😒"
|
||||
string(41) "a😒😒😒😒😒😒😒😒😒😒"
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79241: Segmentation fault on preg_match()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// if "’" string is used directly without json_decode,
|
||||
// the issue does not reproduce
|
||||
$text = json_decode('"’"');
|
||||
|
||||
$pattern = '/\b/u';
|
||||
|
||||
// it has to be exact two calls to preg_match(),
|
||||
// with the second call offsetting after the tick symbol
|
||||
var_dump(preg_match($pattern, $text, $matches, 0, 0));
|
||||
var_dump(preg_match($pattern, $text, $matches, 0, 1));
|
||||
var_dump(preg_last_error() == PREG_BAD_UTF8_OFFSET_ERROR);
|
||||
|
||||
echo "\n";
|
||||
|
||||
$text = "VA\xff"; $text .= "LID";
|
||||
var_dump(preg_match($pattern, $text, $matches, 0, 4));
|
||||
var_dump(preg_match($pattern, $text, $matches, 0, 0));
|
||||
var_dump(preg_last_error() == PREG_BAD_UTF8_ERROR);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
int(1)
|
||||
bool(false)
|
||||
bool(true)
|
||||
@@ -1,218 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79257: Duplicate named groups (?J) prefer last alternative even if not matched
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))/', 'foo', $matches);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))/', 'foo', $matches,
|
||||
PREG_UNMATCHED_AS_NULL);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))/', 'foo', $matches,
|
||||
PREG_OFFSET_CAPTURE);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))/', 'foo', $matches,
|
||||
PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE);
|
||||
var_dump($matches);
|
||||
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))(?<h>baz)/', 'foobaz', $matches);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))(?<h>baz)/', 'foobaz', $matches,
|
||||
PREG_UNMATCHED_AS_NULL);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))(?<h>baz)/', 'foobaz', $matches,
|
||||
PREG_OFFSET_CAPTURE);
|
||||
var_dump($matches);
|
||||
preg_match('/(?J)(?:(?<g>foo)|(?<g>bar))(?<h>baz)/', 'foobaz', $matches,
|
||||
PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE);
|
||||
var_dump($matches);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
["g"]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
string(3) "foo"
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
["g"]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
string(3) "foo"
|
||||
[2]=>
|
||||
NULL
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
["g"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
["g"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
int(-1)
|
||||
}
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
string(6) "foobaz"
|
||||
["g"]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
string(3) "foo"
|
||||
[2]=>
|
||||
string(0) ""
|
||||
["h"]=>
|
||||
string(3) "baz"
|
||||
[3]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
string(6) "foobaz"
|
||||
["g"]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
string(3) "foo"
|
||||
[2]=>
|
||||
NULL
|
||||
["h"]=>
|
||||
string(3) "baz"
|
||||
[3]=>
|
||||
string(3) "baz"
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(6) "foobaz"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
["g"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
int(-1)
|
||||
}
|
||||
["h"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "baz"
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
[3]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "baz"
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
array(6) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(6) "foobaz"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
["g"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "foo"
|
||||
[1]=>
|
||||
int(0)
|
||||
}
|
||||
[2]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
NULL
|
||||
[1]=>
|
||||
int(-1)
|
||||
}
|
||||
["h"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "baz"
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
[3]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(3) "baz"
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
}
|
||||
@@ -126,14 +126,13 @@ static void free_cols(pdo_stmt_t *stmt, pdo_odbc_stmt *S)
|
||||
if (S->cols) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < S->col_count; i++) {
|
||||
for (i = 0; i < stmt->column_count; i++) {
|
||||
if (S->cols[i].data) {
|
||||
efree(S->cols[i].data);
|
||||
}
|
||||
}
|
||||
efree(S->cols);
|
||||
S->cols = NULL;
|
||||
S->col_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,14 +262,14 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt)
|
||||
SQLRowCount(S->stmt, &row_count);
|
||||
stmt->row_count = row_count;
|
||||
|
||||
if (S->cols == NULL) {
|
||||
if (!stmt->executed) {
|
||||
/* do first-time-only definition of bind/mapping stuff */
|
||||
SQLSMALLINT colcount;
|
||||
|
||||
/* how many columns do we have ? */
|
||||
SQLNumResultCols(S->stmt, &colcount);
|
||||
|
||||
stmt->column_count = S->col_count = (int)colcount;
|
||||
stmt->column_count = (int)colcount;
|
||||
S->cols = ecalloc(colcount, sizeof(pdo_odbc_column));
|
||||
S->going_long = 0;
|
||||
}
|
||||
@@ -848,25 +847,13 @@ static int odbc_stmt_next_rowset(pdo_stmt_t *stmt)
|
||||
free_cols(stmt, S);
|
||||
/* how many columns do we have ? */
|
||||
SQLNumResultCols(S->stmt, &colcount);
|
||||
stmt->column_count = S->col_count = (int)colcount;
|
||||
stmt->column_count = (int)colcount;
|
||||
S->cols = ecalloc(colcount, sizeof(pdo_odbc_column));
|
||||
S->going_long = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int odbc_stmt_close_cursor(pdo_stmt_t *stmt)
|
||||
{
|
||||
SQLRETURN rc;
|
||||
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
|
||||
|
||||
rc = SQLCloseCursor(S->stmt);
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
const struct pdo_stmt_methods odbc_stmt_methods = {
|
||||
odbc_stmt_dtor,
|
||||
odbc_stmt_execute,
|
||||
@@ -877,6 +864,5 @@ const struct pdo_stmt_methods odbc_stmt_methods = {
|
||||
odbc_stmt_set_param,
|
||||
odbc_stmt_get_attr, /* get attr */
|
||||
NULL, /* get column meta */
|
||||
odbc_stmt_next_rowset,
|
||||
odbc_stmt_close_cursor
|
||||
odbc_stmt_next_rowset
|
||||
};
|
||||
@@ -151,8 +151,7 @@ typedef struct {
|
||||
zend_ulong convbufsize;
|
||||
unsigned going_long:1;
|
||||
unsigned assume_utf8:1;
|
||||
signed col_count:16;
|
||||
unsigned _spare:14;
|
||||
unsigned _spare:30;
|
||||
} pdo_odbc_stmt;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79062: Property with heredoc default value returns false for getDocComment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class BugReportMailrcConfigTests
|
||||
{
|
||||
/** @var string */
|
||||
private $s1 = <<<STRING
|
||||
I'm a string :(
|
||||
STRING;
|
||||
/** @var string */
|
||||
private $s2 = <<<'STRING'
|
||||
I'm a string :)
|
||||
STRING;
|
||||
/** @var string */
|
||||
private $s3 = 'I\'m a string :)';
|
||||
}
|
||||
|
||||
$ref = new \ReflectionClass(BugReportMailrcConfigTests::class);
|
||||
$s1 = $ref->getProperty('s1');
|
||||
var_dump($s1->getDocComment());
|
||||
|
||||
$s2 = $ref->getProperty('s2');
|
||||
var_dump($s2->getDocComment());
|
||||
|
||||
$s3 = $ref->getProperty('s3');
|
||||
var_dump($s2->getDocComment());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(18) "/** @var string */"
|
||||
string(18) "/** @var string */"
|
||||
string(18) "/** @var string */"
|
||||
@@ -3,7 +3,6 @@ Bug #78516 (password_hash(): Memory cost is not in allowed range)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sodium')) die('skip sodium extension not available');
|
||||
if (!defined('PASSWORD_ARGON2ID')) die('skip PASSWORD_ARGON2ID not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -108,7 +108,7 @@ struct _php_sqlite3_result_object {
|
||||
zval stmt_obj_zval;
|
||||
|
||||
int is_prepared_statement;
|
||||
int complete; // unused
|
||||
int complete;
|
||||
zend_object zo;
|
||||
};
|
||||
|
||||
|
||||
@@ -1983,7 +1983,7 @@ PHP_METHOD(sqlite3result, columnType)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sqlite3_data_count(result_obj->stmt_obj->stmt)) {
|
||||
if (result_obj->complete) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2038,6 +2038,7 @@ PHP_METHOD(sqlite3result, fetchArray)
|
||||
break;
|
||||
|
||||
case SQLITE_DONE:
|
||||
result_obj->complete = 1;
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
|
||||
@@ -2065,6 +2066,8 @@ PHP_METHOD(sqlite3result, reset)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
result_obj->complete = 0;
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79294 ()::columnType() may fail after SQLite3Stmt::reset())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sqlite3')) die('sqlite3 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec("CREATE TABLE foo (bar INT)");
|
||||
$db->exec("INSERT INTO foo VALUES (1)");
|
||||
|
||||
$stmt = $db->prepare("SELECT * FROM foo");
|
||||
$res = $stmt->execute();
|
||||
var_dump($res->fetchArray() !== false);
|
||||
var_dump($res->columnType(0));
|
||||
var_dump($res->fetchArray() !== false);
|
||||
var_dump($res->columnType(0));
|
||||
$stmt->reset();
|
||||
var_dump($res->fetchArray() !== false);
|
||||
var_dump($res->columnType(0));
|
||||
$res->reset();
|
||||
var_dump($res->fetchArray() !== false);
|
||||
var_dump($res->columnType(0));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
int(1)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
int(1)
|
||||
bool(true)
|
||||
int(1)
|
||||
@@ -105,17 +105,6 @@ static inline void strip_header(char *header_bag, char *lc_header_bag,
|
||||
}
|
||||
}
|
||||
|
||||
static zend_bool check_has_header(const char *headers, const char *header) {
|
||||
const char *s = headers;
|
||||
while ((s = strstr(s, header))) {
|
||||
if (s == headers || *(s-1) == '\n') {
|
||||
return 1;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
|
||||
const char *path, const char *mode, int options, zend_string **opened_path,
|
||||
php_stream_context *context, int redirect_max, int flags,
|
||||
@@ -470,31 +459,45 @@ finish:
|
||||
strip_header(user_headers, t, "content-type:");
|
||||
}
|
||||
|
||||
if (check_has_header(t, "user-agent:")) {
|
||||
have_header |= HTTP_HEADER_USER_AGENT;
|
||||
if ((s = strstr(t, "user-agent:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_USER_AGENT;
|
||||
}
|
||||
if (check_has_header(t, "host:")) {
|
||||
have_header |= HTTP_HEADER_HOST;
|
||||
if ((s = strstr(t, "host:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_HOST;
|
||||
}
|
||||
if (check_has_header(t, "from:")) {
|
||||
have_header |= HTTP_HEADER_FROM;
|
||||
if ((s = strstr(t, "from:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_FROM;
|
||||
}
|
||||
if ((s = strstr(t, "authorization:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_AUTH;
|
||||
}
|
||||
if (check_has_header(t, "authorization:")) {
|
||||
have_header |= HTTP_HEADER_AUTH;
|
||||
if ((s = strstr(t, "content-length:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_CONTENT_LENGTH;
|
||||
}
|
||||
if (check_has_header(t, "content-length:")) {
|
||||
have_header |= HTTP_HEADER_CONTENT_LENGTH;
|
||||
if ((s = strstr(t, "content-type:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_TYPE;
|
||||
}
|
||||
if (check_has_header(t, "content-type:")) {
|
||||
have_header |= HTTP_HEADER_TYPE;
|
||||
if ((s = strstr(t, "connection:")) &&
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_CONNECTION;
|
||||
}
|
||||
if (check_has_header(t, "connection:")) {
|
||||
have_header |= HTTP_HEADER_CONNECTION;
|
||||
}
|
||||
|
||||
/* remove Proxy-Authorization header */
|
||||
if (use_proxy && use_ssl && (s = strstr(t, "proxy-authorization:")) &&
|
||||
(s == t || *(s-1) == '\n')) {
|
||||
(s == t || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
char *p = s + sizeof("proxy-authorization:") - 1;
|
||||
|
||||
while (s > t && (*(s-1) == ' ' || *(s-1) == '\t')) s--;
|
||||
|
||||
@@ -504,7 +504,6 @@ PHP_FUNCTION(proc_open)
|
||||
int bypass_shell = 0;
|
||||
int blocking_pipes = 0;
|
||||
int create_process_group = 0;
|
||||
int create_new_console = 0;
|
||||
#else
|
||||
char **argv = NULL;
|
||||
#endif
|
||||
@@ -599,13 +598,6 @@ PHP_FUNCTION(proc_open)
|
||||
create_process_group = 1;
|
||||
}
|
||||
}
|
||||
|
||||
item = zend_hash_str_find(Z_ARRVAL_P(other_options), "create_new_console", sizeof("create_new_console") - 1);
|
||||
if (item != NULL) {
|
||||
if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
|
||||
create_new_console = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -929,9 +921,7 @@ PHP_FUNCTION(proc_open)
|
||||
if (create_process_group) {
|
||||
dwCreateFlags |= CREATE_NEW_PROCESS_GROUP;
|
||||
}
|
||||
if (create_new_console) {
|
||||
dwCreateFlags |= CREATE_NEW_CONSOLE;
|
||||
}
|
||||
|
||||
envpw = php_win32_cp_env_any_to_w(env.envp);
|
||||
if (envpw) {
|
||||
dwCreateFlags |= CREATE_UNICODE_ENVIRONMENT;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# These tests depend on the console codepage, which is shared across all parallel workers.
|
||||
# Force these tests to run sequentially to make sure the codepage isn't change by another process.
|
||||
all
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #78569 (proc_open() may require extra quoting)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY !== 'Windows') die('skip this test is for Windows platforms only');
|
||||
?>
|
||||
--XFAIL--
|
||||
Before PHP 8.0.0 we would need to add extra quotes.
|
||||
--FILE--
|
||||
<?php
|
||||
// We are searching for the following line:
|
||||
// FIND ME
|
||||
$descriptorspec = array(['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']);
|
||||
$cmd = sprintf('"findstr" "/b" "/c:// FIND ME" "%s" 2>&1', __FILE__);
|
||||
$proc = proc_open($cmd, $descriptorspec, $pipes);
|
||||
fpassthru($pipes[1]);
|
||||
proc_close($proc);
|
||||
?>
|
||||
--EXPECT--
|
||||
// FIND ME
|
||||
@@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79254 (getenv() w/o arguments not showing changes)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$old = getenv();
|
||||
var_dump(getenv("PHP_BUG_79254", true));
|
||||
|
||||
putenv("PHP_BUG_79254=BAR");
|
||||
|
||||
$new = getenv();
|
||||
var_dump(array_diff($new, $old));
|
||||
var_dump(getenv("PHP_BUG_79254", true));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
array(1) {
|
||||
["PHP_BUG_79254"]=>
|
||||
string(3) "BAR"
|
||||
}
|
||||
string(3) "BAR"
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79265 (Improper injection of Host header when using fopen for http requests)
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$responses = array(
|
||||
"data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
|
||||
);
|
||||
|
||||
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
|
||||
|
||||
$opts = array(
|
||||
'http'=>array(
|
||||
'method'=>"GET",
|
||||
'header'=>"RandomHeader: localhost:8080\r\n" .
|
||||
"Cookie: foo=bar\r\n" .
|
||||
"Host: userspecifiedvalue\r\n"
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
|
||||
fseek($output, 0, SEEK_SET);
|
||||
echo stream_get_contents($output);
|
||||
fclose($fd);
|
||||
|
||||
http_server_kill($pid);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
GET / HTTP/1.0
|
||||
Connection: close
|
||||
RandomHeader: localhost:8080
|
||||
Cookie: foo=bar
|
||||
Host: userspecifiedvalue
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Bug #79265 variation: "host:" not at start of header
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$responses = array(
|
||||
"data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
|
||||
);
|
||||
|
||||
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
|
||||
|
||||
$opts = array(
|
||||
'http'=>array(
|
||||
'method'=>"GET",
|
||||
'header'=>"RandomHeader: host:8080\r\n" .
|
||||
"Cookie: foo=bar\r\n"
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
|
||||
fseek($output, 0, SEEK_SET);
|
||||
echo stream_get_contents($output);
|
||||
fclose($fd);
|
||||
|
||||
http_server_kill($pid);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
GET / HTTP/1.0
|
||||
Host: 127.0.0.1:12342
|
||||
Connection: close
|
||||
RandomHeader: host:8080
|
||||
Cookie: foo=bar
|
||||
+1
-2
@@ -1791,8 +1791,7 @@ static ZIPARCHIVE_METHOD(addFile)
|
||||
entry_name_len = ZSTR_LEN(filename);
|
||||
}
|
||||
|
||||
if (php_zip_add_file(intern, ZSTR_VAL(filename), ZSTR_LEN(filename),
|
||||
entry_name, entry_name_len, offset_start, offset_len) < 0) {
|
||||
if (php_zip_add_file(intern, ZSTR_VAL(filename), ZSTR_LEN(filename), entry_name, entry_name_len, 0, 0) < 0) {
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_TRUE;
|
||||
|
||||
@@ -20,34 +20,23 @@ if (!$zip->open($file)) {
|
||||
if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
|
||||
echo "failed\n";
|
||||
}
|
||||
if (!$zip->addFile($dirname . 'utils.inc', 'mini.txt', 12, 34)) {
|
||||
echo "failed\n";
|
||||
}
|
||||
if ($zip->status == ZIPARCHIVE::ER_OK) {
|
||||
if (!verify_entries($zip, [
|
||||
"bar",
|
||||
"foobar/",
|
||||
"foobar/baz",
|
||||
"entry1.txt",
|
||||
"test.php",
|
||||
"mini.txt"
|
||||
"test.php"
|
||||
])) {
|
||||
echo "failed\n";
|
||||
} else {
|
||||
echo "OK\n";
|
||||
echo "OK";
|
||||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
echo "failed\n";
|
||||
}
|
||||
if (!$zip->open($file)) {
|
||||
exit('failed');
|
||||
}
|
||||
var_dump(strlen($zip->getFromName('test.php')) == filesize($dirname . 'utils.inc'));
|
||||
var_dump(strlen($zip->getFromName('mini.txt')) == 34);
|
||||
@unlink($file);
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
bool(true)
|
||||
bool(true)
|
||||
+24
-43
@@ -540,58 +540,39 @@ static zend_always_inline int valid_environment_name(const char *name, const cha
|
||||
return 1;
|
||||
}
|
||||
|
||||
static zend_always_inline void import_environment_variable(HashTable *ht, char *env)
|
||||
void _php_import_environment_variables(zval *array_ptr)
|
||||
{
|
||||
char *p;
|
||||
char **env, *p;
|
||||
size_t name_len, len;
|
||||
zval val;
|
||||
zend_ulong idx;
|
||||
|
||||
p = strchr(env, '=');
|
||||
if (!p
|
||||
|| p == env
|
||||
|| !valid_environment_name(env, p)) {
|
||||
/* malformed entry? */
|
||||
return;
|
||||
}
|
||||
name_len = p - env;
|
||||
p++;
|
||||
len = strlen(p);
|
||||
if (len == 0) {
|
||||
ZVAL_EMPTY_STRING(&val);
|
||||
} else if (len == 1) {
|
||||
ZVAL_INTERNED_STR(&val, ZSTR_CHAR((zend_uchar)*p));
|
||||
} else {
|
||||
ZVAL_NEW_STR(&val, zend_string_init(p, len, 0));
|
||||
}
|
||||
if (ZEND_HANDLE_NUMERIC_STR(env, name_len, idx)) {
|
||||
zend_hash_index_update(ht, idx, &val);
|
||||
} else {
|
||||
php_register_variable_quick(env, name_len, &val, ht);
|
||||
}
|
||||
}
|
||||
|
||||
void _php_import_environment_variables(zval *array_ptr)
|
||||
{
|
||||
#ifndef PHP_WIN32
|
||||
char **env;
|
||||
#else
|
||||
char *environment, *env;
|
||||
#endif
|
||||
|
||||
tsrm_env_lock();
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
for (env = environ; env != NULL && *env != NULL; env++) {
|
||||
import_environment_variable(Z_ARRVAL_P(array_ptr), *env);
|
||||
p = strchr(*env, '=');
|
||||
if (!p
|
||||
|| p == *env
|
||||
|| !valid_environment_name(*env, p)) {
|
||||
/* malformed entry? */
|
||||
continue;
|
||||
}
|
||||
name_len = p - *env;
|
||||
p++;
|
||||
len = strlen(p);
|
||||
if (len == 0) {
|
||||
ZVAL_EMPTY_STRING(&val);
|
||||
} else if (len == 1) {
|
||||
ZVAL_INTERNED_STR(&val, ZSTR_CHAR((zend_uchar)*p));
|
||||
} else {
|
||||
ZVAL_NEW_STR(&val, zend_string_init(p, len, 0));
|
||||
}
|
||||
if (ZEND_HANDLE_NUMERIC_STR(*env, name_len, idx)) {
|
||||
zend_hash_index_update(Z_ARRVAL_P(array_ptr), idx, &val);
|
||||
} else {
|
||||
php_register_variable_quick(*env, name_len, &val, Z_ARRVAL_P(array_ptr));
|
||||
}
|
||||
}
|
||||
#else
|
||||
environment = GetEnvironmentStringsA();
|
||||
for (env = environment; env != NULL && *env; env += strlen(env) + 1) {
|
||||
import_environment_variable(Z_ARRVAL_P(array_ptr), env);
|
||||
}
|
||||
FreeEnvironmentStringsA(environment);
|
||||
#endif
|
||||
|
||||
tsrm_env_unlock();
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.ac to change version number */
|
||||
#define PHP_MAJOR_VERSION 7
|
||||
#define PHP_MINOR_VERSION 4
|
||||
#define PHP_RELEASE_VERSION 4
|
||||
#define PHP_EXTRA_VERSION "RC1"
|
||||
#define PHP_VERSION "7.4.4RC1"
|
||||
#define PHP_VERSION_ID 70404
|
||||
#define PHP_RELEASE_VERSION 3
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "7.4.3"
|
||||
#define PHP_VERSION_ID 70403
|
||||
+3
-3
@@ -306,12 +306,12 @@ serialize_precision = -1
|
||||
; http://php.net/open-basedir
|
||||
;open_basedir =
|
||||
|
||||
; This directive allows you to disable certain functions.
|
||||
; This directive allows you to disable certain functions for security reasons.
|
||||
; It receives a comma-delimited list of function names.
|
||||
; http://php.net/disable-functions
|
||||
disable_functions =
|
||||
|
||||
; This directive allows you to disable certain classes.
|
||||
; This directive allows you to disable certain classes for security reasons.
|
||||
; It receives a comma-delimited list of class names.
|
||||
; http://php.net/disable-classes
|
||||
disable_classes =
|
||||
@@ -402,7 +402,7 @@ max_input_time = 60
|
||||
; How many GET/POST/COOKIE input variables may be accepted
|
||||
;max_input_vars = 1000
|
||||
|
||||
; Maximum amount of memory a script may consume
|
||||
; Maximum amount of memory a script may consume (128MB)
|
||||
; http://php.net/memory-limit
|
||||
memory_limit = 128M
|
||||
|
||||
|
||||
+3
-3
@@ -306,12 +306,12 @@ serialize_precision = -1
|
||||
; http://php.net/open-basedir
|
||||
;open_basedir =
|
||||
|
||||
; This directive allows you to disable certain functions.
|
||||
; This directive allows you to disable certain functions for security reasons.
|
||||
; It receives a comma-delimited list of function names.
|
||||
; http://php.net/disable-functions
|
||||
disable_functions =
|
||||
|
||||
; This directive allows you to disable certain classes.
|
||||
; This directive allows you to disable certain classes for security reasons.
|
||||
; It receives a comma-delimited list of class names.
|
||||
; http://php.net/disable-classes
|
||||
disable_classes =
|
||||
@@ -404,7 +404,7 @@ max_input_time = 60
|
||||
; How many GET/POST/COOKIE input variables may be accepted
|
||||
;max_input_vars = 1000
|
||||
|
||||
; Maximum amount of memory a script may consume
|
||||
; Maximum amount of memory a script may consume (128MB)
|
||||
; http://php.net/memory-limit
|
||||
memory_limit = 128M
|
||||
|
||||
|
||||
+1
-2
@@ -1424,8 +1424,7 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) {
|
||||
"TEST_PHP_URI" => $sockUri,
|
||||
],
|
||||
[
|
||||
"suppress_errors" => TRUE,
|
||||
'create_new_console' => TRUE,
|
||||
"suppress_errors" => TRUE
|
||||
]
|
||||
);
|
||||
if ($proc === FALSE) {
|
||||
|
||||
@@ -87,7 +87,6 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
|
||||
#include "fpm_request.h"
|
||||
#include "fpm_status.h"
|
||||
#include "fpm_signals.h"
|
||||
#include "fpm_stdio.h"
|
||||
#include "fpm_conf.h"
|
||||
#include "fpm_php.h"
|
||||
#include "fpm_log.h"
|
||||
@@ -1969,8 +1968,6 @@ fastcgi_request_done:
|
||||
|
||||
php_request_shutdown((void *) 0);
|
||||
|
||||
fpm_stdio_flush_child();
|
||||
|
||||
requests++;
|
||||
if (UNEXPECTED(max_requests && (requests == max_requests))) {
|
||||
fcgi_request_set_keep(request, 0);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "fpm_children.h"
|
||||
#include "fpm_scoreboard.h"
|
||||
#include "fpm_status.h"
|
||||
#include "fpm_stdio.h"
|
||||
#include "fpm_request.h"
|
||||
#include "fpm_log.h"
|
||||
|
||||
@@ -199,6 +200,7 @@ void fpm_request_end(void) /* {{{ */
|
||||
#endif
|
||||
proc->memory = memory;
|
||||
fpm_scoreboard_proc_release(proc);
|
||||
fpm_stdio_flush_child();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+44
-46
@@ -106,11 +106,9 @@ int fpm_stdio_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define FPM_STDIO_CMD_FLUSH "\0fscf"
|
||||
|
||||
int fpm_stdio_flush_child() /* {{{ */
|
||||
{
|
||||
return write(STDERR_FILENO, FPM_STDIO_CMD_FLUSH, sizeof(FPM_STDIO_CMD_FLUSH));
|
||||
return write(STDERR_FILENO, "\0", 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -122,8 +120,10 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
|
||||
struct fpm_child_s *child;
|
||||
int is_stdout;
|
||||
struct fpm_event_s *event;
|
||||
int in_buf = 0, cmd_pos = 0, pos, start;
|
||||
int read_fail = 0, create_log_stream;
|
||||
int fifo_in = 1, fifo_out = 1;
|
||||
int in_buf = 0;
|
||||
int read_fail = 0, finish_log_stream = 0, create_log_stream;
|
||||
int res;
|
||||
struct zlog_stream *log_stream;
|
||||
|
||||
if (!arg) {
|
||||
@@ -162,53 +162,49 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
stdio_read:
|
||||
in_buf = read(fd, buf, max_buf_size - 1);
|
||||
if (in_buf <= 0) { /* no data */
|
||||
if (in_buf == 0 || (errno != EAGAIN && errno != EWOULDBLOCK)) {
|
||||
/* pipe is closed or error */
|
||||
read_fail = (in_buf < 0) ? in_buf : 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
start = 0;
|
||||
if (cmd_pos > 0) {
|
||||
if ((sizeof(FPM_STDIO_CMD_FLUSH) - cmd_pos) <= in_buf &&
|
||||
!memcmp(buf, &FPM_STDIO_CMD_FLUSH[cmd_pos], sizeof(FPM_STDIO_CMD_FLUSH) - cmd_pos)) {
|
||||
zlog_stream_finish(log_stream);
|
||||
start = cmd_pos;
|
||||
while (fifo_in || fifo_out) {
|
||||
if (fifo_in) {
|
||||
res = read(fd, buf + in_buf, max_buf_size - 1 - in_buf);
|
||||
if (res <= 0) { /* no data */
|
||||
fifo_in = 0;
|
||||
if (res == 0 || (errno != EAGAIN && errno != EWOULDBLOCK)) {
|
||||
/* pipe is closed or error */
|
||||
read_fail = (res < 0) ? res : 1;
|
||||
}
|
||||
} else {
|
||||
zlog_stream_str(log_stream, &FPM_STDIO_CMD_FLUSH[0], cmd_pos);
|
||||
in_buf += res;
|
||||
/* if buffer ends with \0, then the stream will be finished */
|
||||
if (!buf[in_buf - 1]) {
|
||||
finish_log_stream = 1;
|
||||
in_buf--;
|
||||
}
|
||||
}
|
||||
cmd_pos = 0;
|
||||
}
|
||||
for (pos = start; pos < in_buf; pos++) {
|
||||
switch (buf[pos]) {
|
||||
case '\n':
|
||||
zlog_stream_str(log_stream, buf + start, pos - start);
|
||||
|
||||
if (fifo_out) {
|
||||
if (in_buf == 0) {
|
||||
fifo_out = 0;
|
||||
} else {
|
||||
char *nl;
|
||||
|
||||
nl = memchr(buf, '\n', in_buf);
|
||||
if (nl) {
|
||||
/* we should print each new line int the new message */
|
||||
int out_len = nl - buf;
|
||||
zlog_stream_str(log_stream, buf, out_len);
|
||||
zlog_stream_finish(log_stream);
|
||||
start = pos + 1;
|
||||
break;
|
||||
case '\0':
|
||||
if (pos + sizeof(FPM_STDIO_CMD_FLUSH) <= in_buf) {
|
||||
if (!memcmp(buf + pos, FPM_STDIO_CMD_FLUSH, sizeof(FPM_STDIO_CMD_FLUSH))) {
|
||||
zlog_stream_str(log_stream, buf + start, pos - start);
|
||||
zlog_stream_finish(log_stream);
|
||||
start = pos + sizeof(FPM_STDIO_CMD_FLUSH);
|
||||
pos = start - 1;
|
||||
}
|
||||
} else if (!memcmp(buf + pos, FPM_STDIO_CMD_FLUSH, in_buf - pos)) {
|
||||
cmd_pos = in_buf - pos;
|
||||
zlog_stream_str(log_stream, buf + start, pos - start);
|
||||
goto stdio_read;
|
||||
}
|
||||
break;
|
||||
/* skip new line */
|
||||
out_len++;
|
||||
/* move data in the buffer */
|
||||
memmove(buf, buf + out_len, in_buf - out_len);
|
||||
in_buf -= out_len;
|
||||
} else if (in_buf == max_buf_size - 1 || !fifo_in) {
|
||||
/* we should print if no more space in the buffer or no more data to come */
|
||||
zlog_stream_str(log_stream, buf, in_buf);
|
||||
in_buf = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (start < pos) {
|
||||
zlog_stream_str(log_stream, buf + start, pos - start);
|
||||
}
|
||||
}
|
||||
|
||||
if (read_fail) {
|
||||
@@ -229,6 +225,8 @@ stdio_read:
|
||||
close(child->fd_stderr);
|
||||
child->fd_stderr = -1;
|
||||
}
|
||||
} else if (finish_log_stream) {
|
||||
zlog_stream_finish(log_stream);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+3
-5
@@ -734,16 +734,14 @@ ssize_t zlog_stream_format(struct zlog_stream *stream, const char *fmt, ...) /*
|
||||
|
||||
ssize_t zlog_stream_str(struct zlog_stream *stream, const char *str, size_t str_len) /* {{{ */
|
||||
{
|
||||
/* do not write anything if the stream is full or str is empty */
|
||||
if (str_len == 0 || stream->full) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reset stream if it is finished */
|
||||
if (stream->finished) {
|
||||
stream->finished = 0;
|
||||
stream->len = 0;
|
||||
stream->full = 0;
|
||||
} else if (stream->full) {
|
||||
/* do not write anything if the stream is full */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stream->use_buffer) {
|
||||
|
||||
@@ -17,6 +17,10 @@ ExecReload=/bin/kill -USR2 $MAINPID
|
||||
# access this service's directories.
|
||||
PrivateTmp=true
|
||||
|
||||
# The directories /home, /root and /run/user are made inaccessible and empty for processes
|
||||
# invoked by this unit.
|
||||
ProtectHome=true
|
||||
|
||||
# Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit.
|
||||
ProtectSystem=full
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
--TEST--
|
||||
FPM: Log message in shutdown function
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
log_limit = 1024
|
||||
log_buffering = yes
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
catch_workers_output = yes
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
register_shutdown_function(function() {
|
||||
error_log(str_repeat('e', 80));
|
||||
});
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester->request()->expectEmptyBody();
|
||||
$tester->terminate();
|
||||
$tester->expectFastCGIErrorMessage('e', 1050, 80);
|
||||
$tester->expectLogMessage('NOTICE: PHP message: ' . str_repeat('e', 80), 1050);
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
||||
@@ -29,11 +29,10 @@ $tester = new FPM\Tester($cfg, $code);
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester->request()->expectEmptyBody();
|
||||
$tester->terminate();
|
||||
$tester->expectLogLine('msg 1');
|
||||
$tester->expectLogLine('msg 2');
|
||||
$tester->expectLogLine('msg 3');
|
||||
$tester->terminate();
|
||||
$tester->expectLogTerminatingNotices();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
--TEST--
|
||||
FPM: Buffered worker output plain log with msg with flush split in buffer
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
catch_workers_output = yes
|
||||
decorate_workers_output = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
file_put_contents('php://stderr', str_repeat('a', 1021) . "\0fabc");
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester->request()->expectEmptyBody();
|
||||
$lines = $tester->getLogLines(2);
|
||||
var_dump($lines[0] === str_repeat('a', 1021) . "\0f\n");
|
||||
var_dump($lines[1] === "abc\n");
|
||||
$tester->terminate();
|
||||
$tester->expectLogTerminatingNotices();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
FPM: Buffered worker output plain log with msg with flush split in buffer
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
catch_workers_output = yes
|
||||
decorate_workers_output = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
file_put_contents('php://stderr', str_repeat('a', 1022) . "\0fscf\0");
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester->request()->expectEmptyBody();
|
||||
$tester->terminate();
|
||||
var_dump($tester->getLastLogLine() === str_repeat('a', 1022) . "\n");
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
||||
@@ -75,7 +75,6 @@ $TS \
|
||||
--with-kerberos \
|
||||
--enable-sysvmsg \
|
||||
--with-ffi \
|
||||
--with-sodium \
|
||||
--enable-zend-test=shared \
|
||||
--enable-werror \
|
||||
--with-pear
|
||||
|
||||
Reference in new issue
Block a user