Skip to content

INIT_CLASS_ENTRY should use strlen() to determine class name length #10217

Closed
@ghost

Description

Description

This works:

INIT_CLASS_ENTRY(ce, "mylongclassname", methods);

This does not:

void register_class(zend_class_entry * ce, const char * name, const zend_function_entry * methods) {
    INIT_CLASS_ENTRY(ce, name, methods);
}

register_class(ce, "mylongclassname", methods);

Because INIT_OVERLOADED_CLASS_ENTRY uses sizeof() to determine class_name_len:

#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
	INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL

PHP Version

All

Operating System

All

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions