]> granicus.if.org Git - php/commitdiff
Fix phpdbg test failure and crash with opcache
authorBob Weinand <bobwei9@hotmail.com>
Wed, 22 Jul 2015 23:03:03 +0000 (01:03 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Wed, 22 Jul 2015 23:03:03 +0000 (01:03 +0200)
sapi/phpdbg/phpdbg_list.c
sapi/phpdbg/tests/phpdbg_oplog_001.phpt

index a2f5ff6cc5265b9711696af60dce847615010c15..3a7761cc64cb45b8fdf0ffed3e8d905f1ae4b928 100644 (file)
@@ -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;
 }
index 868493b4ba7f5dc458a30841d62d9feac380029f..15eeea5ebefd130e3052b0599ea6c9183b9a20eb 100644 (file)
@@ -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]));