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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 23:01:28 2024 UTC