From: Bob Weinand Date: Wed, 22 Jul 2015 23:03:03 +0000 (+0200) Subject: Fix phpdbg test failure and crash with opcache X-Git-Tag: php-7.0.0beta3~5^2~103^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=686b9039a6d8ba820538222bbb44925ae25c4c93;p=php Fix phpdbg test failure and crash with opcache --- diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index a2f5ff6cc5..3a7761cc64 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -289,7 +289,12 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) { zend_file_handle_dtor(&fake); dataptr->op_array = ret; - ++*dataptr->op_array->refcount; + if (dataptr->op_array->refcount) { + ++*dataptr->op_array->refcount; + } else { + dataptr->op_array->refcount = emalloc(sizeof(uint32_t)); + *dataptr->op_array->refcount = 2; + } return ret; } diff --git a/sapi/phpdbg/tests/phpdbg_oplog_001.phpt b/sapi/phpdbg/tests/phpdbg_oplog_001.phpt index 868493b4ba..15eeea5ebe 100644 --- a/sapi/phpdbg/tests/phpdbg_oplog_001.phpt +++ b/sapi/phpdbg/tests/phpdbg_oplog_001.phpt @@ -9,9 +9,7 @@ q [Successful compilation of %s] prompt> halloarray(2) { ["%s"]=> - array(6) { - [11]=> - int(0) + array(5) { [13]=> int(1) [17]=> @@ -25,10 +23,10 @@ prompt> halloarray(2) { } ["A::b"]=> array(2) { - [5]=> - int(5) [4]=> int(1) + [5]=> + int(5) } } [Script ended normally] @@ -54,5 +52,5 @@ $a = new A(); $a->b(); $a->b('ha'); -var_dump(phpdbg_end_oplog(["functions" => true, "show_unexecuted" => true])); +var_dump(phpdbg_end_oplog(["functions" => true]));