php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53196 zend_API.h has an error in INIT_OVERLOADED_CLASS_ENTRY Macro
Submitted: 2010-10-28 21:43 UTC Modified: 2010-10-28 23:55 UTC
From: sven dot assmann at lubico dot biz Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sven dot assmann at lubico dot biz
New email:
PHP Version: OS:

 

 [2010-10-28 21:43 UTC] sven dot assmann at lubico dot biz
Description:
------------
#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)

leads to a segfault.. 

change it like 

#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, 
strlen(class_name)+1, functions, handle_fcall, handle_propget, handle_propset, 
NULL, NULL)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-28 22:33 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-10-28 22:33 UTC] felipe@php.net
This is not a bug, the macro is intended to use sizeof.
You need to use the literal string in the macro, not a variable.
 [2010-10-28 23:55 UTC] sven dot assmann at lubico dot biz
the macro is used by INIT_CLASS_ENTRY, if it is not a bug, what is the right way 
to initialize a class at runtime?

I think the change on the macro will work for both ways compiletime and runtime..
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC