tony2001 Mon Jul 17 07:02:26 2006 UTC
Modified files:
/php-src/ext/standard basic_functions.c
Log:
make use of new param parsing API
use convert_to_text(), which makes constant() unicode aware
finally nuke invalid reads
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.788&r2=1.789&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.788
php-src/ext/standard/basic_functions.c:1.789
--- php-src/ext/standard/basic_functions.c:1.788 Sat Jul 15 10:10:46 2006
+++ php-src/ext/standard/basic_functions.c Mon Jul 17 07:02:26 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.788 2006/07/15 10:10:46 helly Exp $ */
+/* $Id: basic_functions.c,v 1.789 2006/07/17 07:02:26 tony2001 Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -4177,16 +4177,16 @@
Given the name of a constant this function will return the constants
associated value */
PHP_FUNCTION(constant)
{
- zval **const_name;
+ zval* const_name;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &const_name) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &const_name)
== FAILURE) {
+ return;
}
- convert_to_string_ex(const_name);
- if (!zend_u_get_constant(Z_TYPE_PP(const_name),
Z_UNIVAL_PP(const_name), Z_UNILEN_PP(const_name), return_value TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find
constant %s", Z_STRVAL_PP(const_name));
+ convert_to_text_ex(&const_name);
+
+ if (!zend_u_get_constant(Z_TYPE_P(const_name), Z_UNIVAL_P(const_name),
Z_UNILEN_P(const_name), return_value TSRMLS_CC)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find
constant %s", Z_STRVAL_P(const_name));
RETURN_NULL();
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php