Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61512 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55115 invoked from network); 19 Jul 2012 18:49:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 18:49:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:58638] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/2F-18983-7C658005 for ; Thu, 19 Jul 2012 14:49:44 -0400 Received: by yhoo21 with SMTP id o21so3586597yho.29 for ; Thu, 19 Jul 2012 11:49:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=9T/dcYnx/zxfs47B7aZazRTJYBiuXvJjP8UrQXjwt4k=; b=X/SdrMvN16MJR2LVQplUAGUkFecjV6NZ5nWkuYwtPP3Z4QWV8lPkjEpmpyjY/qTvUj mGt9iNB+hMDvUJxn7qhFCjkFg4ohfklIqAc7HoY8V2roc0UKa7CIPTr+QdwjwXsPDt8h 47W9ZfM6K6a1cC4Me2sGHPR1CC7wrHOmniTwGOKN6la6vMVi3g1WQYaYxWvmbuAwA7B9 jXJaUQtYG3wwkw0Eu+paUzRxbPaIezNVfqON2Vh6mPe5w4XQGZL7so09FAWi6O6dF3Qg GR2PnkkXWFwP+0qz+h398FItI2oaVsUKimjV51k03b7k93y+I9NfsD/6Q0efLw2ShIMz XdpQ== MIME-Version: 1.0 Received: by 10.50.94.228 with SMTP id df4mr2446396igb.34.1342723781181; Thu, 19 Jul 2012 11:49:41 -0700 (PDT) Sender: php@golemon.com Received: by 10.64.24.242 with HTTP; Thu, 19 Jul 2012 11:49:40 -0700 (PDT) X-Originating-IP: [2620:0:1cfe:28:8cb3:438e:1db2:b161] In-Reply-To: References: Date: Thu, 19 Jul 2012 11:49:40 -0700 X-Google-Sender-Auth: ur-vcZ9-m3e7FQ5e3rjVWx46egE Message-ID: To: Adam Jon Richardson Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8f235453023f2904c5333eaa X-Gm-Message-State: ALoCoQnJjBSPbLaQWoKfJ/l9EeIvbnITpO682OjCMHtdcxt5QB4tBBPigOQOnzDlMG6n/bFrBR2l Subject: Re: [PHP-DEV] Recommended way to create a zval that serves as a callback in an extension From: pollita@php.net (Sara Golemon) --e89a8f235453023f2904c5333eaa Content-Type: text/plain; charset=ISO-8859-1 Same as you would in PHP code. Make an IS_STRING pointing at a global function, or IS_ARRAY pointing at a class method, or an IS_OBJECT supporting __invoke(). If you're asking how you can call a C function directly via this callback: You can't. You can can, however, make an internal method to use as a callback, just bear in mind it'll be callable by userspace as well. -Sara On Sat, Jul 14, 2012 at 2:00 PM, Adam Jon Richardson wrote: > Hi, > > I'm calling the function php_pcre_replace() in my extension: > http://lxr.php.net/xref/PHP_5_4/ext/pcre/php_pcre.c#952 > > I would like to use a callback for the replace_val, but this will be > supplied by my extension. I'm wondering what the recommended way of > creating the replace_val zval callback would be in the extension. > > Thank you for your patience and help. > > Adam > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --e89a8f235453023f2904c5333eaa--