Edit report at https://bugs.php.net/bug.php?id=64966&edit=1

 ID:                 64966
 User updated by:    bfra...@php.net
 Reported by:        bfra...@php.net
 Summary:            segfault in zend_do_fcall_common_helper_SPEC
 Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        Irrelevant
 Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

Your patch fixes the core dump and is cleaner, thanks!

What are your thoughts on:

Major Compatible Change or Simple Bug fix? 
  http://marc.info/?l=php-internals&m=137066248125910&w=2


Your phpunit test does have a warning removed from 5.4.13/5.3.23:

% php test.php 

Warning: iterator_apply() expects at least 2 parameters, 1 given in 
/home/bfrance/test.php on line 6

Fatal error: Uncaught exception 'Exception' in /home/bfrance/test.php:3
Stack trace:
#0 [internal function]: {closure}(4096, 'Argument 1 pass...', 
'/home/bfrance/t...', 6, Array)
#1 /home/bfrance/test.php(6): iterator_apply('')
#2 /home/bfrance/test.php(12): test('iterator_apply')
#3 /home/bfrance/test.php(17): A->b()
#4 {main}
  thrown in /home/bfrance/test.php on line 3



compared to 5.4.14/5.2.24 (with this patch):


% php test.php 

Fatal error: Uncaught exception 'Exception' in /home/bfrance/test.php:3
Stack trace:
#0 [internal function]: {closure}(4096, 'Argument 1 pass...', 
'/home/bfrance/t...', 6, Array)
#1 /home/bfrance/test.php(6): iterator_apply(NULL)
#2 /home/bfrance/test.php(12): test('iterator_apply')
#3 /home/bfrance/test.php(17): A->b()
#4 {main}
  thrown in /home/bfrance/test.php on line 3


But the bigger change is in the email thread.


Previous Comments:
------------------------------------------------------------------------
[2013-06-08 09:19:19] larue...@php.net

The following patch has been added/updated:

Patch Name: bug64966.phpt
Revision:   1370683159
URL:        
https://bugs.php.net/patch-display.php?bug=64966&patch=bug64966.phpt&revision=1370683159

------------------------------------------------------------------------
[2013-06-08 09:19:01] larue...@php.net

The following patch has been added/updated:

Patch Name: bug64966.patch
Revision:   1370683141
URL:        
https://bugs.php.net/patch-display.php?bug=64966&patch=bug64966.patch&revision=1370683141

------------------------------------------------------------------------
[2013-06-08 09:15:03] larue...@php.net

change summary, since not reflection specific bug

------------------------------------------------------------------------
[2013-06-08 08:39:25] larue...@php.net

here is a small reproduce script, if no segfault, run with valgrind:

<?php
error_reporting(E_ALL | E_STRICT);
set_error_handler(function($error) { throw new Exception(); }, 
E_RECOVERABLE_ERROR);


function test($func) {
    $a = $func("");
    return true;
}
class A {
    public function b() {
        test("strlen");
        test("iterator_apply");
    }
}

$a = new A();
$a->b();

------------------------------------------------------------------------
[2013-06-08 06:37:10] larue...@php.net

A more simple fix might be like:
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 02566f3..d471f39 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2327,6 +2327,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                        if (!RETURN_VALUE_USED(opline)) {
                                zval_ptr_dtor(&EX_T(opline-
>result.u.var).var.ptr);
                        }
+               } else if (RETURN_VALUE_USED(opline)) {
+                       EX_T(opline->result.u.var).var.ptr = NULL;
                }
        } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
                EX(original_return_value) = EG(return_value_ptr_ptr);

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=64966


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64966&edit=1

Reply via email to