Re: Newbie help
| From: | Alan Knowles | Date: | Mon, 27 Sep 2004 23:31:27 +0000 |
| Subject: | Re: Newbie help | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13031@lists.php.net to get a copy of this message | ||
Is there a reason there is no macro for this? (took me a while to figure it out as well)
And should it be done in PHP_MINIT_FUNCTION(), rather than __construct
Regards
Alan
George Schlossnagle wrote:
On Sep 27, 2004, at 12:14 PM, Andrei Zmievski wrote:On Sun, 26 Sep 2004, Robert Silva wrote:The key being that sizeof("Foo") == strlen("Foo") + 1 GeorgeTrying to register a constant value for a class and it keeps crashing. Learning C as I go, so I would appreciate some insight. I can figure out that my *property value is lost during zend_hash_add() but my knowledge stops there as to why. Tried passing property as property and &property. ZEND_METHOD(zboolean, __construct) {zend_hash_add(&(Z_OBJECE_P(object))->constants_table, "TrueString",zval *object = getThis(); zval *propertyALLOC_ZVAL(property); INIT_PZVAL(property); ZVAL_STRING(property, "true", 1); zend_hash_add(&(Z_OBJCE_P(object))->constants_table, "TrueString",sizeof("TrueString")+1, property, sizeof(zval *)); }sizeof("TrueString"), &property, sizeof(zval *), NULL);