Date: 07/30/99
- Next message: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Previous message: Alvin Engler: "[PHP-DEV] Multiple char encodings for site internationalzation"
- Next in thread: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Reply: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The information here applies to PHP 4.0 only.
I've just updated the various SET_VAR_*() macros to support
references. That means that from now on, if you set the global variable
$foo, and $foo is a reference to $bar, then your update will modify both
$foo and $bar (until now, it separated $foo from $bar, only $foo was set to
the new value, and $foo and $bar were no longer referencing each other).
That means you must no longer directly update the main symbol table
(EG(symbol_table)) from anywhere but infrastructure code (read: pretty
much nowhere). Nothing 'bad' would happen if you do (that is, PHP won't
crash or anything) - but it'll present the old behavior.
If you want to update the main symbol table not using the SET_VAR_*()
macros (usually if you generate the pval's yourself), you can use one of
the following macros:
ZEND_SET_GLOBAL_VAR(name, var)
ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var)
name is a char *, var is a zval *, and name_length (if applicable) is its
length (including the terminating NULL!).
When you use these macros, you're no longer responsible for maintaining the
Zend status flags and counters - the reference count (.refcount), the
reference status bit (.EA.is_ref) and the lock count (.EA.locks) - the
macros takes care of them for you - in other words, there's no reason to
call INIT_PZVAL() if you use these macros.
Sascha - what triggered me to do it was a bug report from Ivan Schreter,
that complained that the session module was updating variables in the
global scope, but these weren't being reflected in variables he declared as
'global'. This should fix it - if you move to use these new macros...
Zeev
-- Zeev Suraski <zeev <email protected>> http://www.zend.com/ For a PGP public key, finger bourbon <email protected>-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Previous message: Alvin Engler: "[PHP-DEV] Multiple char encodings for site internationalzation"
- Next in thread: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Reply: David Guillouet: "[PHP-DEV] PHP and class.graph problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

