[PHP-DEV] Re: [PHP3] Manipulating PHP symbol table From: Zeev Suraski (bourbon <email protected>)
Date: 07/01/98

At 17:46 01/07/98 +0200, James Lyell wrote:
>Hi PHP-ers
>
>I have a function that will read variables from an external source (e.g.
>db file off the harddrive) then inserts the variables into PHP's symbol
>table. This works fine when the variablename is new - however when I want
>to override an existing variable, it hangs and dumps core somewhere.
>
>The function uses
>
>SET_VAR_STRING(varname->value.strval, value);
>
>to set new variables. The new value is malloc'ed to the correct size and
>works if the variable is not previously defined.
>
>
>If I detect a defined variable using
>
>hash_exists(&symbol_table, varname->value.strval,
sizeof(varname->value.strval))
>
>how would I then delete it from the symbol table before assigning the new
>value?

The behavior you're describing is not expected - SET_VAR_STRING() is
supposed to overwrite existing variables, and assuming you're emalloc()'ing
and not malloc()'ing, and have all the structure properties assigned
properly, it should not crash. If it crashes, please send us the code that
causes the problem, and we'll see what goes wrong.

By the way, development related questions should go to the PHP development
list at php-dev <email protected> instead of the general purpose php3 mailing
list.

Zeev

--
Zeev Suraski   <zeev <email protected>>
For a PGP public key, finger bourbon <email protected>