note 20520 modified in zend.api-macros by gwynne

From: Date: Mon, 18 Jun 2007 17:58:00 +0000
Subject: note 20520 modified in zend.api-macros by gwynne
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127556@lists.php.net to get a copy of this message
If you are using one of the above macros you definitely want to use one of those convert-functions if you are not sure what data type is stored in the zval: convert_to_string(zval_p) convert_to_long(zval_p) convert_to_double(zval_p) convert_to_boolean(zval_p) convert_to_array(zval_p) convert_to_object(zval_p) Otherwise you may get undefined results, because Z_STRVAL_P(zval_p) returns nonsense if the zval contains not a string. If you use convert_to_string() before, the value is converted to a string and you can safely access it via the Z_STRVAL* macros. There are more useful convert-functions: Resets the zval to NULL: convert_to_null(zval_p) Converts to a long by using a special base: convert_to_long_base(zval_p, base) There are some more functions which may be useful, but I don't know exactly what they are doing. Just take a look at Zend/zend_operaters.h. --was-- If you are using one of the above macros you definitely want to use one of those convert-functions if you are not sure what data type is stored in the zval: convert_to_string(zval_p) convert_to_long(zval_p) convert_to_double(zval_p) convert_to_boolean(zval_p) convert_to_array(zval_p) convert_to_object(zval_p) Otherwise you may get undefined results, because Z_STRVAL_P(zval_p) returns nonsense if the zval contains not a string. If you use convert_to_string() before, the value is converted to a string and you can safely access it via the Z_STRVAL* macros. There are more useful convert-functions: Resets the zval to NULL: convert_to_null(zval_p) Converts to a long by using a special base: convert_to_long_base(zval_p, base) There are some more functions which may be useful, but I don't know exactly what they are doing. Just take a look at Zend/zend_operaters.h. http://php.net/manual/en/zend.api-macros.php

« previous php.notes (#127556) next »