Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112315 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67761 invoked from network); 29 Nov 2020 22:52:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Nov 2020 22:52:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 30EB81804C0 for ; Sun, 29 Nov 2020 14:19:38 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-mahalux.mvorisek.com (mail-mahalux.mvorisek.com [77.93.195.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 29 Nov 2020 14:19:36 -0800 (PST) Received: from b9f952526bdc (10.228.0.247) by mail-mahalux.mvorisek.com (10.228.0.4) with Microsoft SMTP Server (TLS); Sun, 29 Nov 2020 23:19:32 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_720ffb0d7184f5b17a2aa45fb3f1351a" Date: Sun, 29 Nov 2020 23:19:31 +0100 To: internals@lists.php.net Message-ID: <8bd42687f325ac9a2a97714a7ad7416da74636c28077813b0f6605c154b442cb@mahalux.com> X-Mailer: SAP NetWeaver 7.03 Subject: Detect if function is disabled from c ext From: vorismi3@fel.cvut.cz (=?UTF-8?Q?Michael_Vo=C5=99=C3=AD=C5=A1ek_-_=C4=8CVUT_FEL?=) --=_720ffb0d7184f5b17a2aa45fb3f1351a Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed How can a php function can be checked from extension if that function is disabled or not? In php7.x, I used: #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "php.h" bool is_php_function_disabled(const char *func_name) { zend_internal_function *func; if ((func = zend_hash_str_find_ptr(CG(function_table), func_name, strlen(func_name)))) { if (func->handler == ZEND_FN(display_disabled_function)) { return true; } } return false; } But it does not work for php8: In file included from /usr/local/include/php/main/php.h:35, from .../ext/libs.c:6: .../ext/libs.c: In function 'is_php_function_disabled': /usr/local/include/php/Zend/zend_API.h:68:23: error: 'zif_display_disabled_function' undeclared (first use in this function) 68 | #define ZEND_FN(name) zif_##name | ^~~~ .../ext/libs.c:237:30: note: in expansion of macro 'ZEND_FN' 237 | if (func->handler == ZEND_FN(display_disabled_function)) { Thanks for help in advance. With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek ČVUT FEL --=_720ffb0d7184f5b17a2aa45fb3f1351a--