mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: check for zlib headers as well as lib for mysqlnd a realpath cache key can be int or float, catching this TLS 1.0, 1.1 and 1.2 Curl constants - bug #68247 Micro optimizations for isset/empty Micro optimization for zend_hash_next_index_insert_new() Fix array_keys() on $GLOBALS Fix procedural finfo calls in methods Conflicts: ext/mysqlnd/config.w32
This commit is contained in:
commit
2942a4aa45
@ -342,6 +342,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *na
|
||||
ZEND_API char *zend_get_type_by_const(int type);
|
||||
|
||||
#define getThis() (Z_OBJ(EX(This)) ? &EX(This) : NULL)
|
||||
#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
|
||||
|
||||
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
|
||||
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
|
||||
|
@ -444,11 +444,15 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
/* incremental initialization of empty Buckets */
|
||||
if (h >= ht->nNumUsed) {
|
||||
Bucket *q = ht->arData + ht->nNumUsed;
|
||||
while (q != p) {
|
||||
ZVAL_UNDEF(&q->val);
|
||||
q++;
|
||||
if ((flag & (HASH_ADD_NEW|HASH_ADD_NEXT)) == (HASH_ADD_NEW|HASH_ADD_NEXT)) {
|
||||
ht->nNumUsed = h + 1;
|
||||
} else if (h >= ht->nNumUsed) {
|
||||
if (h > ht->nNumUsed) {
|
||||
Bucket *q = ht->arData + ht->nNumUsed;
|
||||
while (q != p) {
|
||||
ZVAL_UNDEF(&q->val);
|
||||
q++;
|
||||
}
|
||||
}
|
||||
ht->nNumUsed = h + 1;
|
||||
}
|
||||
@ -537,12 +541,12 @@ ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData
|
||||
|
||||
ZEND_API zval *_zend_hash_next_index_insert(HashTable *ht, zval *pData ZEND_FILE_LINE_DC)
|
||||
{
|
||||
return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD ZEND_FILE_LINE_RELAY_CC);
|
||||
return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD | HASH_ADD_NEXT ZEND_FILE_LINE_RELAY_CC);
|
||||
}
|
||||
|
||||
ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_FILE_LINE_DC)
|
||||
{
|
||||
return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD | HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC);
|
||||
return _zend_hash_index_add_or_update_i(ht, ht->nNextFreeElement, pData, HASH_ADD | HASH_ADD_NEW | HASH_ADD_NEXT ZEND_FILE_LINE_RELAY_CC);
|
||||
}
|
||||
|
||||
static void zend_hash_do_resize(HashTable *ht)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define HASH_ADD (1<<1)
|
||||
#define HASH_UPDATE_INDIRECT (1<<2)
|
||||
#define HASH_ADD_NEW (1<<3)
|
||||
#define HASH_ADD_NEXT (1<<4)
|
||||
|
||||
#define INVALID_IDX ((uint32_t) -1)
|
||||
|
||||
|
@ -4848,18 +4848,22 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
{
|
||||
USE_OPLINE
|
||||
zval *value;
|
||||
zend_bool isset = 1;
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (OP1_TYPE == IS_CV &&
|
||||
OP2_TYPE == IS_UNUSED &&
|
||||
(opline->extended_value & ZEND_QUICK_SET)) {
|
||||
if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
|
||||
value = EX_VAR(opline->op1.var);
|
||||
ZVAL_DEREF(value);
|
||||
} else {
|
||||
isset = 0;
|
||||
value = EX_VAR(opline->op1.var);
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var),
|
||||
Z_TYPE_P(value) > IS_NULL &&
|
||||
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var),
|
||||
!i_zend_is_true(value TSRMLS_CC));
|
||||
CHECK_EXCEPTION();
|
||||
}
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else {
|
||||
zend_free_op free_op1;
|
||||
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS);
|
||||
@ -4887,40 +4891,28 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
|
||||
ce = Z_CE_P(EX_VAR(opline->op2.var));
|
||||
}
|
||||
value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((OP1_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
|
||||
if (!value) {
|
||||
isset = 0;
|
||||
}
|
||||
} else {
|
||||
HashTable *target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
|
||||
value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
|
||||
if (!value || Z_ISUNDEF_P(value)) {
|
||||
isset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (OP1_TYPE != IS_CONST && varname == &tmp) {
|
||||
zval_dtor(&tmp);
|
||||
}
|
||||
FREE_OP1();
|
||||
}
|
||||
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
if (isset && Z_TYPE_P(value) != IS_NULL &&
|
||||
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var), 1);
|
||||
} else {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var), 0);
|
||||
if (opline->extended_value & ZEND_ISSET) {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var),
|
||||
value && Z_TYPE_P(value) > IS_NULL &&
|
||||
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL));
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var),
|
||||
!value || !i_zend_is_true(value TSRMLS_CC));
|
||||
}
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var), 1);
|
||||
} else {
|
||||
ZVAL_BOOL(EX_VAR(opline->result.var), 0);
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
CHECK_EXCEPTION();
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
@ -4936,7 +4928,7 @@ ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMP|VAR|UNUSED|CV, CONST|
|
||||
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
|
||||
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE != IS_UNUSED && Z_TYPE_P(container) == IS_ARRAY) {
|
||||
if (OP1_TYPE != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
|
||||
HashTable *ht = Z_ARRVAL_P(container);
|
||||
zval *value;
|
||||
zend_string *str;
|
||||
@ -4989,8 +4981,8 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
|
||||
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
|
||||
}
|
||||
} else if (OP1_TYPE == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (Z_OBJ_HT_P(container)->has_dimension) {
|
||||
} else if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
|
||||
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check element of non-array");
|
||||
@ -4999,7 +4991,7 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
if ((opline->extended_value & ZEND_ISSET) == 0) {
|
||||
result = !result;
|
||||
}
|
||||
} else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
|
||||
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
result = 0;
|
||||
@ -5015,7 +5007,7 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
offset = &tmp;
|
||||
}
|
||||
}
|
||||
if (Z_TYPE_P(offset) == IS_LONG) {
|
||||
if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
|
||||
if (offset->value.lval >= 0 && (size_t)offset->value.lval < Z_STRLEN_P(container)) {
|
||||
if ((opline->extended_value & ZEND_ISSET) ||
|
||||
Z_STRVAL_P(container)[offset->value.lval] != '0') {
|
||||
@ -5049,8 +5041,8 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMP|VAR|UNUSED|CV, CONST
|
||||
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
|
||||
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
|
||||
if (OP1_TYPE == IS_UNUSED || Z_TYPE_P(container) == IS_OBJECT) {
|
||||
if (Z_OBJ_HT_P(container)->has_property) {
|
||||
if (OP1_TYPE == IS_UNUSED || EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
|
||||
if (EXPECTED(Z_OBJ_HT_P(container)->has_property)) {
|
||||
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
|
||||
} else {
|
||||
zend_error(E_NOTICE, "Trying to check property of non-object");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1201,6 +1201,12 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLSSLOPT_ALLOW_BEAST);
|
||||
#endif
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x072200 /* Available since 7.34.0 */
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_0);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_1);
|
||||
REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_2);
|
||||
#endif
|
||||
|
||||
#if CURLOPT_FTPASCII != 0
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ typedef struct _finfo_object {
|
||||
} finfo_object;
|
||||
|
||||
#define FILEINFO_DECLARE_INIT_OBJECT(object) \
|
||||
zval *object = getThis();
|
||||
zval *object = ZEND_IS_METHOD_CALL() ? getThis() : NULL;
|
||||
|
||||
static inline finfo_object *php_finfo_fetch_object(zend_object *obj) {
|
||||
return (finfo_object *)((char*)(obj) - XtOffsetOf(finfo_object, zo));
|
||||
|
18
ext/fileinfo/tests/precedural_finfo_in_method.phpt
Normal file
18
ext/fileinfo/tests/precedural_finfo_in_method.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Using procedural finfo API in a method
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public function method() {
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
var_dump(finfo_file($finfo, __FILE__));
|
||||
}
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
$test->method();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(28) "text/plain; charset=us-ascii"
|
@ -26,8 +26,11 @@ if (PHP_MYSQLND != "no") {
|
||||
"mysqlnd_wireprotocol.c " +
|
||||
"php_mysqlnd.c ";
|
||||
EXTENSION("mysqlnd", mysqlnd_source, false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
if (((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "mysqlnd", PHP_MYSQLND))) ||
|
||||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "mysqlnd", PHP_MYSQLND)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED)))
|
||||
if ((((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "mysqlnd", PHP_MYSQLND))) ||
|
||||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "mysqlnd", PHP_MYSQLND)) ||
|
||||
(PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)
|
||||
)
|
||||
{
|
||||
AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Compression support");
|
||||
AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "SSL support");
|
||||
|
@ -2597,7 +2597,7 @@ PHP_FUNCTION(array_keys)
|
||||
add_key = 1;
|
||||
|
||||
/* Go through input array and add keys to the return array */
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
|
||||
if (search_value != NULL) {
|
||||
is_equal_func(&res, search_value, entry TSRMLS_CC);
|
||||
add_key = zval_is_true(&res);
|
||||
|
12
ext/standard/tests/array/array_keys_on_GLOBALS.phpt
Normal file
12
ext/standard/tests/array/array_keys_on_GLOBALS.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Using array_keys() on $GLOBALS
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$foo = 'bar';
|
||||
unset($foo);
|
||||
var_dump(in_array('foo', array_keys($GLOBALS)));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
@ -19,7 +19,7 @@ echo "Done\n";
|
||||
int(%d)
|
||||
array(8) {
|
||||
["key"]=>
|
||||
%s(%d)
|
||||
%s(%d%s)
|
||||
["is_dir"]=>
|
||||
bool(true)
|
||||
["realpath"]=>
|
||||
|
Loading…
Reference in New Issue
Block a user