Req #72450 [Opn->Nab]: INIT_CLASS_ENTRY macro should not use sizeof

From: Date: Wed, 12 Jul 2017 14:34:36 +0000
Subject: Req #72450 [Opn->Nab]: INIT_CLASS_ENTRY macro should not use sizeof
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210016@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72450&edit=1 ID: 72450 Updated by: ab@php.net Reported by: slidertom at gmail dot com Summary: INIT_CLASS_ENTRY macro should not use sizeof -Status: Open +Status: Not a bug Type: Feature/Change Request Package: Unknown/Other Function Operating System: Windows PHP Version: 7.0.7 Block user comment: N Private report: N New Comment: Thanks for the report. It is the intended implementation. You can always expand the macro, if you need some dynamics. Thanks. Previous Comments: ------------------------------------------------------------------------ [2016-06-19 20:23:29] slidertom at gmail dot com Description: ------------ INIT_CLASS_ENTRY macro should not use sizeof e.g. such usage is valid: INIT_CLASS_ENTRY(ce, "MyCustomClass", NULL); as compiler uses such directives: INIT_OVERLOADED_CLASS_ENTRY (class_container, class_name, functions, NULL, NULL, NULL) INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL) but if INIT_CLASS_ENTRY is used in the function like: void InitClass(const char *class_name) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, class_name, NULL); will fail due the: INIT_OVERLOADED_CLASS_ENTRY_EX define implementation: sizeof(class_name)-1 maybe strlen (run-time) should be used to allow INIT_CLASS_ENTRY macro more general usage. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72450&edit=1

« previous php.bugs (#210016) next »