Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89845 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26370 invoked from network); 18 Dec 2015 16:44:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2015 16:44:52 -0000 Authentication-Results: pb1.pair.com header.from=adam.baratz@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam.baratz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.170 as permitted sender) X-PHP-List-Original-Sender: adam.baratz@gmail.com X-Host-Fingerprint: 209.85.223.170 mail-io0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:35209] helo=mail-io0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/02-51216-30834765 for ; Fri, 18 Dec 2015 11:44:51 -0500 Received: by mail-io0-f170.google.com with SMTP id q126so95197804iof.2 for ; Fri, 18 Dec 2015 08:44:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QWsuaStCXFj2vG7Ex7pssbSRpOpPrOiYHaLMxeAFsws=; b=Qz/EzCoZCZPzz1KAQkIwhRXq5XuEJcsOFtmDBIeBURM0DCNRyILXmEtlUeY7+rWlzM 0wwcyukLIP9wem2DVtVI9hXfFgzYjDpvRib/XVKCf2Rl8D/9QnQNz0OKdoAzd2Oj5XEU 3jgckKthkeFOgG4Fuxjs8Mlnd60KVEwW79q9GGHD8yn9YQ4uLti4PhuLDkqrEqTrAHrF Iq/1dznfm/HIX01MzsZ40DfTAuntB458pzxXYclitD4tOmFkV8do+QwXx12hjF5Emn3Y /aFAex0nBzbtuvtD589m2+Crxc5aqouYV5/M92MTlS9r4eXIYB6vS8fXllSs7y76x2gY uRig== MIME-Version: 1.0 X-Received: by 10.107.166.82 with SMTP id p79mr5660699ioe.187.1450457089081; Fri, 18 Dec 2015 08:44:49 -0800 (PST) Received: by 10.64.5.104 with HTTP; Fri, 18 Dec 2015 08:44:49 -0800 (PST) In-Reply-To: <5673EE6A.60109@php.net> References: <5673EE6A.60109@php.net> Date: Fri, 18 Dec 2015 11:44:49 -0500 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1141f2ac8e888805272edb83 Subject: Re: [PHP-DEV] call_user_function_ex() affects zval value From: adam.baratz@gmail.com (Adam Baratz) --001a1141f2ac8e888805272edb83 Content-Type: text/plain; charset=UTF-8 > > If your code is public, can you give a pointer to the problematic call ? > Or at least what your 'zval' points to on return. > It's the PECL memcache extension: https://pecl.php.net/package/memcache All of the existing test suite passes, except for this one: http://git.php.net/?p=pecl/caching/memcache.git;a=blob;f=tests/033.phpt;h=dad8214786d909fbce5bc6a1b4fd69b59daf5c79;hb=HEAD It verifies an error callback mechanism using a few different styles of callbacks. I've trimmed the test down to the first string-based case and that works fine. I get a segfault when I focus on the "OO callback" case. This is where the callback is invoked: http://git.php.net/?p=pecl/caching/memcache.git;a=blob;f=memcache.c;h=6a7576d1a86fdbeaf8f30c3cfd54ac642719c006;hb=HEAD#l1096 Reference counting appears to be in order. See mmc_server_callback_ctor() and mmc_server_callback_dtor() for where that happens. PHP7 compatible versions of those functions don't look very different, nor does most of the surrounding code. The main changes I had to make to the extension involved handling resource zvals. Entering the call_user_function_ex() call, the callback array has a ref count of 1 and its 0th element has a count of 2 (according to gdb). The same is true when I run the test with PHP56. The value of the array zval changes inside the call to call_user_function_ex(), in a call to zend_vm_stack_push_call_frame() (determined via setting a watch). It ends up with garbage contents (its type is not a defined value). Let me know if there's any other info I can dig up. Thanks, Adam --001a1141f2ac8e888805272edb83--