Re: [PHP4BETA] Extending PHP, Zend API

From: Date: Tue, 07 Mar 2000 14:22:09 +0000
Subject: Re: [PHP4BETA] Extending PHP, Zend API
References: 1 2 3  Groups: php.version4 
Request: Send a blank email to php-version4+get-11674@lists.php.net to get a copy of this message
On Mon, 06 Mar 2000, Paul S. Gumerman wrote: > How does one create an array, and add elements to it? (or, perjaps I should say, > how does one do it *correctly* <g>) zval *array; MAKE_STD_ZVAL(array); array_init(array); add_index_long(array, 555); > > Why do the API calls (such as zend_hash_find and zend_hash_update) sometimes > want strlen(name) + 1, and other times want strlen(name) ? strlen(name) + 1 is required because hash functions need to know the exact length of the key, including the 0 at the end. > Since I do have this working, but suspect problems, what's the best procedure for > testing for memory leaks or other problems? Read the error messages and trace them. > I see various messages in the Apache log from zend_variables.c complaining of > overruns and Magic Numbers not being as expected (I assume). What precisely do > these messages mean, and how would I go about tracking down the problems? > > Here's one: > --------------------------------------- > zend_opcode.c(172) : Block 0x081D2128 status: > zend_variables.c(63) : Actual location (location was relayed) > Beginning: Overrun (magic=0x00050100, expected=0x7312F8DC) > End: Unknown > ==================================== This means that the zval of type IS_STRING is being destructed twice. It's hard to tell what might be causing it, but maybe it's being deallocated automatically because of the reference counting. -Andrei "The time from now until the completion of the project tends to become constant." -- Douglas Hartree

« previous php.version4 (#11674) next »