summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 4a7ab54387..57460eaf25 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -185,6 +185,8 @@ void init_executor(void) /* {{{ */
EG(ht_iterators) = EG(ht_iterators_slots);
memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots)));
+ EG(each_deprecation_thrown) = 0;
+
EG(active) = 1;
}
/* }}} */
@@ -505,7 +507,7 @@ ZEND_API zend_string *zend_get_executed_filename_ex(void) /* {{{ */
}
/* }}} */
-ZEND_API uint zend_get_executed_lineno(void) /* {{{ */
+ZEND_API uint32_t zend_get_executed_lineno(void) /* {{{ */
{
zend_execute_data *ex = EG(current_execute_data);
@@ -573,7 +575,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
zend_throw_error(NULL, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
return FAILURE;
}
- inline_change = (Z_TYPE_FLAGS_P(p) & IS_TYPE_IMMUTABLE) == 0;
+ inline_change = (Z_TYPE_FLAGS_P(p) & IS_TYPE_REFCOUNTED) != 0;
SEPARATE_ZVAL_NOREF(p);
MARK_CONSTANT_VISITED(p);
if (Z_CONST_FLAGS_P(p) & IS_CONSTANT_CLASS) {
@@ -609,7 +611,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
actual_len -= (actual - Z_STRVAL_P(p));
}
- zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
+ zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual);
if (EG(exception)) {
RESET_CONSTANT_VISITED(p);
return FAILURE;
@@ -638,7 +640,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
zval tmp;
- inline_change = (Z_TYPE_FLAGS_P(p) & IS_TYPE_IMMUTABLE) == 0;
+ inline_change = (Z_TYPE_FLAGS_P(p) & IS_TYPE_REFCOUNTED) != 0;
if (UNEXPECTED(zend_ast_evaluate(&tmp, Z_ASTVAL_P(p), scope) != SUCCESS)) {
return FAILURE;
}
@@ -842,9 +844,15 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
}
if (UNEXPECTED(func->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
+ uint32_t call_info;
+
ZEND_ASSERT(GC_TYPE((zend_object*)func->op_array.prototype) == IS_OBJECT);
GC_REFCOUNT((zend_object*)func->op_array.prototype)++;
- ZEND_ADD_CALL_FLAG(call, ZEND_CALL_CLOSURE);
+ call_info = ZEND_CALL_CLOSURE;
+ if (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
+ call_info |= ZEND_CALL_FAKE_CLOSURE;
+ }
+ ZEND_ADD_CALL_FLAG(call, call_info);
}
if (func->type == ZEND_USER_FUNCTION) {
@@ -920,9 +928,15 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
- if (EG(exception)) {
- zend_throw_exception_internal(NULL);
+ if (UNEXPECTED(EG(exception))) {
+ if (UNEXPECTED(!EG(current_execute_data))) {
+ zend_throw_exception_internal(NULL);
+ } else if (EG(current_execute_data)->func &&
+ ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
+ zend_rethrow_exception(EG(current_execute_data));
+ }
}
+
return SUCCESS;
}
/* }}} */
@@ -970,7 +984,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
}
if (!EG(autoload_func)) {
- zend_function *func = zend_hash_find_ptr(EG(function_table), CG(known_strings)[ZEND_STR_MAGIC_AUTOLOAD]);
+ zend_function *func = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
if (func) {
EG(autoload_func) = func;
} else {
@@ -983,7 +997,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
}
/* Verify class name before passing it to __autoload() */
- if (strspn(ZSTR_VAL(name), "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != ZSTR_LEN(name)) {
+ if (!key && strspn(ZSTR_VAL(name), "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != ZSTR_LEN(name)) {
if (!key) {
zend_string_release(lc_name);
}
@@ -1206,7 +1220,7 @@ static void zend_timeout_handler(int dummy) /* {{{ */
if (EG(timed_out)) {
/* Die on hard timeout */
const char *error_filename = NULL;
- uint error_lineno = 0;
+ uint32_t error_lineno = 0;
char log_buffer[2048];
int output_len = 0;