Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93571 invoked from network); 26 Jul 2013 08:28:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2013 08:28:08 -0000 Authentication-Results: pb1.pair.com header.from=az9901@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=az9901@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.182 as permitted sender) X-PHP-List-Original-Sender: az9901@gmail.com X-Host-Fingerprint: 209.85.215.182 mail-ea0-f182.google.com Received: from [209.85.215.182] ([209.85.215.182:52992] helo=mail-ea0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/30-25917-71332F15 for ; Fri, 26 Jul 2013 04:28:08 -0400 Received: by mail-ea0-f182.google.com with SMTP id o10so1424716eaj.13 for ; Fri, 26 Jul 2013 01:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=NPtlLT7PlrayiLMeCfwKPlSU1Yisbv7qIkLCAn0Xd6o=; b=LLE/hhTtpf1wytKw/EFY1AnO5LXdiuG6i1Ee4HJxkjJQxQxOQAkJbxdnzJ9OnWzaT8 TP0Qt3XUvFo92M9P2wSuyV16y9f0jmHIIwRuoLj7MMwCXf9FcBzKnrJXMI0IYroodnzY JNjmOgFHJ+ybVgRmXSEBo2vpo8OtBiMyNeATo+SGApoY1L+6iostAtcNVOIdreKEgUuX 8mLkbyRGR0kqQS9y4tXRhBMLlQJxeypTrzjtc9nDHBfsBsLKVl6Om5kDn/0HpHLMoRUA U0QDEA14tjhrvlJTePUHZgWpxvP5PMe+bq/08Tej0l5LIpGhFya5sUcHWVSSbsKI0i4V V6/g== MIME-Version: 1.0 X-Received: by 10.15.110.10 with SMTP id cg10mr46683779eeb.57.1374827285111; Fri, 26 Jul 2013 01:28:05 -0700 (PDT) Received: by 10.223.192.134 with HTTP; Fri, 26 Jul 2013 01:28:04 -0700 (PDT) Date: Fri, 26 Jul 2013 10:28:04 +0200 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Simulate enable_functions From: az9901@gmail.com (AZ 9901) Hello, I need to simulate "enable_functions" configuration directive on my mutualized hosting environment. Goal is to enable some functions in a specific vhost which have been disabled globally. To make as less changes as possible, here is what I did : In zend_API.h, I changed _zend_function_entry adding a pointer to itself to keep track of the original function in a disabled function : typedef struct _zend_function_entry { const char *fname; void (*handler)(INTERNAL_FUNCTION_PARAMETERS); const struct _zend_arg_info *arg_info; zend_uint num_args; zend_uint flags; struct _zend_function_entry* original; } zend_function_entry; In zend_API.c, I changed zend_disable_function to swap between original function and disabled function : ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */ { zend_function_entry *orig; zend_hash_find(CG(function_table), function_name, function_name_length+1, (void **) &orig); if(orig != NULL) { if(orig->original == NULL) { zend_function_entry *dummy; dummy = pemalloc(sizeof(zend_function_entry), 1); disabled_function[0].fname = function_name; disabled_function[0].original = orig; orig=dummy; if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; } return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); } else { zend_function_entry *new; new=orig->original; if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; } return zend_register_functions(NULL, &new, CG(function_table), MODULE_PERSISTENT TSRMLS_CC); } } else { return FAILURE; } } /* }}} */ Expected behaviour is that each time a function is seen is the "disable_functions" directive, the original and disabled functions are swapped. So if I put "php_value disable_functions syslog" in a vhost, it should re-enable syslog which has been disabled globally. Of course it does not work. My code compiles but it does not work as expected. Could you help me please ? Perhaps a patch has already been made available for that ? Thank you very much, Best regards, Ben