Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57809 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3754 invoked from network); 12 Feb 2012 12:42:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Feb 2012 12:42:10 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:53446] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/04-63294-F93B73F4 for ; Sun, 12 Feb 2012 07:42:08 -0500 Received: by vcbfk13 with SMTP id fk13so3204490vcb.29 for ; Sun, 12 Feb 2012 04:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=PHjjlIrBF+JvquY+ULnpH8ifzVimYkH6TfxFEOfcLVE=; b=pfkMKXD8onMLa7y91tAwjPaN7fnbQT77Pa5xcIxv5I580wdU5R4pkTMJz6Inbzh4Oj vQo9mMMT2kM3w/aIUAZplY/LMQW0eJ5Sg/CVu+3eVfYuRuqNMXv+hgQORNvXT+2ZkfEs xVZtrc5V69YLEHzLllWRAzr8PZGJgFBCaOIBA= Received: by 10.52.27.1 with SMTP id p1mr6316520vdg.17.1329050524291; Sun, 12 Feb 2012 04:42:04 -0800 (PST) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.178.130 with HTTP; Sun, 12 Feb 2012 04:41:44 -0800 (PST) In-Reply-To: <201202121409.54891.yoram.b@zend.com> References: <201202121409.54891.yoram.b@zend.com> Date: Sun, 12 Feb 2012 20:41:44 +0800 X-Google-Sender-Auth: H8gWhc0oXNIIy3F4yst1UxLkhrY Message-ID: To: yoram bar haim Cc: PHP Internals , Dmitry Stogov , Alex Haiut , Zeev Suraski , Eran Ifrah , Lior Kaplan Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] restore user opcode handler in PHP From: laruence@php.net (Laruence) Hi: could you file a feature req on bugs.php.net? I think it's okey to add a zend_restore_user_handler . like: ZEND_API int zend_restore_user_opcode_handler(zend_uchar opcode) { zend_user_opcodes[opcode] =3D opcode; zend_user_opcode_handlers[opcode] =3D NULL; return SUCCESS; } but it still need dmitry to review :) thanks On Sun, Feb 12, 2012 at 8:09 PM, yoram bar haim wrote: > I first saw this problem while addapting extension to PHP 5.4 but the cod= e is > the same in 5.3 : > when you call zend_set_user_opcode_handler() it set's a pointer (handler)= in > zend_user_opcode_handlers and a uint opcode value in zend_user_opcodes to > ZEND_USER_OPCODE . > > you can call zend_set_user_opcode_handler with the original handler to re= store > it, but if the original state did not include ZEND_USER_OPCODE you have n= o way > to restore it. > > Why restoring ? > On mac, static variables are not re-initialized on dlclose()+dlopen(). th= at > means that apache reload does not re-create zend_user_opcode_handlers and > zend_user_opcodes. > if your extension sets user_opcode_handler and is not reloaded in apache > reload (because you commented it in php.ini, for example), your handlers = array > will actually point to non-exist handler. > if you will call zend_set_user_opcode_handler() with the original handler= at > MSHUTDOWN, it will restore the handler but zend_user_opcodes[ still be ZEND_USER_OPCODE so you will end up calling a NULL handler. > > we should eather allow zend_set_user_opcode_handler to also set the value= in > zend_user_opcodes[] or we should build those arrayes from scratch= at > php_module_init. > > currently an extension tha calls zend_set_user_opcode_handler() will make= PHP > crash on mac after disabling the extension and apache reload. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/