1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 08:28:26 +02:00

Merge branch 'PHP-7.0'

This commit is contained in:
Bob Weinand
2015-10-02 12:38:00 +02:00
5 changed files with 32 additions and 15 deletions
+3 -1
View File
@@ -2042,6 +2042,7 @@ static void zend_emit_return_type_check(znode *expr, zend_arg_info *return_info)
void zend_emit_final_return(zval *zv) /* {{{ */
{
znode zn;
zend_op *ret;
zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
@@ -2055,7 +2056,8 @@ void zend_emit_final_return(zval *zv) /* {{{ */
ZVAL_NULL(&zn.u.constant);
}
zend_emit_op(NULL, returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN, &zn, NULL);
ret = zend_emit_op(NULL, returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN, &zn, NULL);
ret->extended_value = -1;
}
/* }}} */
+11 -7
View File
@@ -443,14 +443,14 @@ static void phpdbg_oplog_fill_executable(zend_op_array *op_array, HashTable *ins
ZVAL_LONG(&zero, 0);
/* ignore autogenerated return (well, not too precise with finally branches, but that's okay) */
if (op_array->last >= 1 && (end - 1)->opcode == ZEND_RETURN
&& ((op_array->last > 1 && ((end - 2)->opcode == ZEND_RETURN || (end - 2)->opcode == ZEND_GENERATOR_RETURN || (end - 2)->opcode == ZEND_THROW))
|| op_array->function_name == NULL)) {
if (op_array->last >= 1 && (((end - 1)->opcode == ZEND_RETURN || (end - 1)->opcode == ZEND_RETURN_BY_REF || (end - 1)->opcode == ZEND_GENERATOR_RETURN)
&& ((op_array->last > 1 && ((end - 2)->opcode == ZEND_RETURN || (end - 2)->opcode == ZEND_RETURN_BY_REF || (end - 2)->opcode == ZEND_GENERATOR_RETURN || (end - 2)->opcode == ZEND_THROW))
|| op_array->function_name == NULL || (end - 1)->extended_value == -1))) {
end--;
}
for (; cur < end; cur++) {
if (cur->opcode == ZEND_NOP || cur->opcode == ZEND_OP_DATA || cur->opcode == ZEND_FE_FREE || cur->opcode == ZEND_FREE || cur->opcode == ZEND_ASSERT_CHECK
if (cur->opcode == ZEND_NOP || cur->opcode == ZEND_OP_DATA || cur->opcode == ZEND_FE_FREE || cur->opcode == ZEND_FREE || cur->opcode == ZEND_ASSERT_CHECK || cur->opcode == ZEND_VERIFY_RETURN_TYPE
|| cur->opcode == ZEND_DECLARE_CONST || cur->opcode == ZEND_DECLARE_CLASS || cur->opcode == ZEND_DECLARE_INHERITED_CLASS || cur->opcode == ZEND_DECLARE_FUNCTION
|| cur->opcode == ZEND_DECLARE_INHERITED_CLASS_DELAYED || cur->opcode == ZEND_VERIFY_ABSTRACT_CLASS || cur->opcode == ZEND_ADD_TRAIT || cur->opcode == ZEND_BIND_TRAITS
|| cur->opcode == ZEND_DECLARE_ANON_CLASS || cur->opcode == ZEND_DECLARE_ANON_INHERITED_CLASS || cur->opcode == ZEND_FAST_RET || cur->opcode == ZEND_TICKS
@@ -793,7 +793,7 @@ static void php_sapi_phpdbg_send_header(sapi_header_struct *sapi_header, void *s
static void php_sapi_phpdbg_log_message(char *message) /* {{{ */
{
/*
* We must not request TSRM before being boot
* We must not request TSRM before being booted
*/
if (phpdbg_booted) {
if (PHPDBG_G(flags) & PHPDBG_IN_EVAL) {
@@ -803,6 +803,10 @@ static void php_sapi_phpdbg_log_message(char *message) /* {{{ */
phpdbg_error("php", "msg=\"%s\"", "%s", message);
if (PHPDBG_G(flags) & PHPDBG_PREVENT_INTERACTIVE) {
return;
}
switch (PG(last_error_type)) {
case E_ERROR:
case E_CORE_ERROR:
@@ -813,7 +817,7 @@ static void php_sapi_phpdbg_log_message(char *message) /* {{{ */
const char *file_char = zend_get_executed_filename();
zend_string *file = zend_string_init(file_char, strlen(file_char), 0);
phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno());
efree(file);
zend_string_release(file);
if (!phpdbg_fully_started) {
return;
@@ -1936,7 +1940,7 @@ phpdbg_out:
/* In case we aborted during script execution, we may not reset CG(unclean_shutdown) */
if (!(PHPDBG_G(flags) & PHPDBG_IS_RUNNING)) {
is_exit = !PHPDBG_G(in_execution) && EG(exit_status) != 255;
is_exit = !PHPDBG_G(in_execution);
CG(unclean_shutdown) = is_exit || PHPDBG_G(unclean_eval);
}
+16 -5
View File
@@ -649,9 +649,10 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), 1, &rv));
}
phpdbg_writeln("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT "\n%s", ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line, ZSTR_VAL(msg));
zend_string_release(msg);
phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT, ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line);
zend_string_release(file);
phpdbg_writeln("exceptionmsg", "msg=\"%s\"", ZSTR_VAL(msg));
zend_string_release(msg);
if (EG(prev_exception)) {
OBJ_RELEASE(EG(prev_exception));
@@ -659,6 +660,8 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
}
OBJ_RELEASE(ex);
EG(opline_before_exception) = NULL;
EG(exit_status) = 255;
} /* }}} */
PHPDBG_COMMAND(run) /* {{{ */
@@ -745,12 +748,20 @@ PHPDBG_COMMAND(run) /* {{{ */
if (restore) {
zend_exception_restore();
zend_try_exception_handler();
zend_try {
zend_try_exception_handler();
PHPDBG_G(in_execution) = 1;
} zend_catch {
PHPDBG_G(in_execution) = 0;
if (PHPDBG_G(flags) & PHPDBG_IS_STOPPING) {
zend_bailout();
}
} zend_end_try();
if (EG(exception)) {
phpdbg_handle_exception();
}
PHPDBG_G(in_execution) = 1;
}
PHPDBG_G(flags) &= ~PHPDBG_IS_RUNNING;
+1 -1
View File
@@ -16,7 +16,7 @@ prompt> handle first
prompt> frame #0: {closure}() at %s:16
frame #1: {main} at %s:20
prompt> 3
prompt> Uncaught Error in %s on line 16
prompt> [Uncaught Error in %s on line 16]
Error: Call to undefined function foo() in %s:16
Stack trace:
#0 %s(20): {closure}()
+1 -1
View File
@@ -20,7 +20,7 @@ Stack trace:
#1 %s(20): {closure}()
#2 {main}
thrown in eval()'d code on line 1
prompt> Uncaught Error in %s on line 16
prompt> [Uncaught Error in %s on line 16]
Error: Call to undefined function foo() in %s:16
Stack trace:
#0 %s(20): {closure}()