felipe Fri Jun 20 13:02:33 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/standard type.c
/php-src/ext/standard/tests/general_functions is_array.phpt
is_bool.phpt
is_float.phpt
is_int.phpt
is_null.phpt
is_numeric.phpt
is_object.phpt
is_scalar.phpt
is_string.phpt
Log:
- New parameter parsing API
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.30.2.2.2.3.2.5&r2=1.30.2.2.2.3.2.6&diff_format=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.30.2.2.2.3.2.5
php-src/ext/standard/type.c:1.30.2.2.2.3.2.6
--- php-src/ext/standard/type.c:1.30.2.2.2.3.2.5 Sat Feb 2 14:03:13 2008
+++ php-src/ext/standard/type.c Fri Jun 20 13:02:33 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: type.c,v 1.30.2.2.2.3.2.5 2008/02/02 14:03:13 helly Exp $ */
+/* $Id: type.c,v 1.30.2.2.2.3.2.6 2008/06/20 13:02:33 felipe Exp $ */
#include "php.h"
#include "php_incomplete_class.h"
@@ -27,8 +27,8 @@
{
zval **arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) ==
FAILURE) {
+ return;
}
switch (Z_TYPE_PP(arg)) {
@@ -90,37 +90,36 @@
Set the type of the variable */
PHP_FUNCTION(settype)
{
- zval **var, **type;
+ zval **var;
+ char *type;
char *new_type;
+ int type_len = 0;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &var, &type) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type,
&type_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(type);
- new_type = Z_STRVAL_PP(type);
-
- if (!strcasecmp(new_type, "integer")) {
+ if (!strcasecmp(type, "integer")) {
convert_to_long(*var);
- } else if (!strcasecmp(new_type, "int")) {
+ } else if (!strcasecmp(type, "int")) {
convert_to_long(*var);
- } else if (!strcasecmp(new_type, "float")) {
+ } else if (!strcasecmp(type, "float")) {
convert_to_double(*var);
- } else if (!strcasecmp(new_type, "double")) { /* deprecated */
+ } else if (!strcasecmp(type, "double")) { /* deprecated */
convert_to_double(*var);
- } else if (!strcasecmp(new_type, "string")) {
+ } else if (!strcasecmp(type, "string")) {
convert_to_string(*var);
- } else if (!strcasecmp(new_type, "array")) {
+ } else if (!strcasecmp(type, "array")) {
convert_to_array(*var);
- } else if (!strcasecmp(new_type, "object")) {
+ } else if (!strcasecmp(type, "object")) {
convert_to_object(*var);
- } else if (!strcasecmp(new_type, "bool")) {
+ } else if (!strcasecmp(type, "bool")) {
convert_to_boolean(*var);
- } else if (!strcasecmp(new_type, "boolean")) {
+ } else if (!strcasecmp(type, "boolean")) {
convert_to_boolean(*var);
- } else if (!strcasecmp(new_type, "null")) {
+ } else if (!strcasecmp(type, "null")) {
convert_to_null(*var);
- } else if (!strcasecmp(new_type, "resource")) {
+ } else if (!strcasecmp(type, "resource")) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot convert to
resource type");
RETURN_FALSE;
} else {
@@ -135,23 +134,23 @@
Get the integer value of a variable using the optional base for the
conversion */
PHP_FUNCTION(intval)
{
- zval **num, **arg_base;
+ zval **num;
+ long arg_base;
int base;
switch (ZEND_NUM_ARGS()) {
case 1:
- if (zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"Z", &num) == FAILURE) {
+ return;
}
base = 10;
break;
case 2:
- if (zend_get_parameters_ex(2, &num, &arg_base) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"Zl", &num, &arg_base) == FAILURE) {
+ return;
}
- convert_to_long_ex(arg_base);
- base = Z_LVAL_PP(arg_base);
+ base = arg_base;
break;
default:
@@ -169,8 +168,8 @@
{
zval **num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &num) ==
FAILURE) {
+ return;
}
RETVAL_ZVAL(*num, 1, 0);
@@ -186,8 +185,8 @@
zval expr_copy;
int use_copy;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &num) ==
FAILURE) {
+ return;
}
zend_make_printable_zval(*num, &expr_copy, &use_copy);
@@ -204,8 +203,7 @@
{
zval **arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only one argument
expected");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) ==
FAILURE) {
RETURN_FALSE;
}
@@ -305,8 +303,8 @@
{
zval **arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) ==
FAILURE) {
+ return;
}
switch (Z_TYPE_PP(arg)) {
@@ -336,8 +334,8 @@
{
zval **arg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) ==
FAILURE) {
+ return;
}
switch (Z_TYPE_PP(arg)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_array.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_array.phpt
diff -u php-src/ext/standard/tests/general_functions/is_array.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_array.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_array.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_array.phpt Fri Jun 20
13:02:33 2008
@@ -207,9 +207,9 @@
*** Testing error conditions ***
-Warning: is_array(): Only one argument expected in %s on line %d
+Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_array(): Only one argument expected in %s on line %d
+Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_bool.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_bool.phpt
diff -u php-src/ext/standard/tests/general_functions/is_bool.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_bool.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_bool.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_bool.phpt Fri Jun 20
13:02:33 2008
@@ -287,9 +287,9 @@
*** Testing error conditions ***
-Warning: is_bool(): Only one argument expected in %s on line %d
+Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_bool(): Only one argument expected in %s on line %d
+Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_float.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_float.phpt
diff -u php-src/ext/standard/tests/general_functions/is_float.phpt:1.1.2.2
php-src/ext/standard/tests/general_functions/is_float.phpt:1.1.2.2.2.1
--- php-src/ext/standard/tests/general_functions/is_float.phpt:1.1.2.2 Mon May
14 10:57:04 2007
+++ php-src/ext/standard/tests/general_functions/is_float.phpt Fri Jun 20
13:02:33 2008
@@ -421,21 +421,21 @@
*** Testing error conditions ***
-Warning: is_float(): Only one argument expected in %s on line %d
+Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_double(): Only one argument expected in %s on line %d
+Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_real(): Only one argument expected in %s on line %d
+Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_float(): Only one argument expected in %s on line %d
+Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-Warning: is_double(): Only one argument expected in %s on line %d
+Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-Warning: is_real(): Only one argument expected in %s on line %d
+Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_int.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_int.phpt
diff -u php-src/ext/standard/tests/general_functions/is_int.phpt:1.1.2.2
php-src/ext/standard/tests/general_functions/is_int.phpt:1.1.2.2.2.1
--- php-src/ext/standard/tests/general_functions/is_int.phpt:1.1.2.2 Mon May
14 10:57:04 2007
+++ php-src/ext/standard/tests/general_functions/is_int.phpt Fri Jun 20
13:02:33 2008
@@ -446,21 +446,21 @@
*** Testing error conditions ***
-Warning: is_int(): Only one argument expected in %s on line %d
+Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_integer(): Only one argument expected in %s on line %d
+Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_long(): Only one argument expected in %s on line %d
+Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_int(): Only one argument expected in %s on line %d
+Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-Warning: is_integer(): Only one argument expected in %s on line %d
+Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-Warning: is_long(): Only one argument expected in %s on line %d
+Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_null.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_null.phpt
diff -u php-src/ext/standard/tests/general_functions/is_null.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_null.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_null.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_null.phpt Fri Jun 20
13:02:33 2008
@@ -289,9 +289,9 @@
*** Testing error conditions ***
-Warning: is_null(): Only one argument expected in %s on line %d
+Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_null(): Only one argument expected in %s on line %d
+Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_numeric.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_numeric.phpt
diff -u php-src/ext/standard/tests/general_functions/is_numeric.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_numeric.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_numeric.phpt:1.1.2.1
Sat May 12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_numeric.phpt Fri Jun
20 13:02:33 2008
@@ -380,9 +380,9 @@
*** Testing error conditions ***
-Warning: Wrong parameter count for is_numeric() in %s on line %d
+Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for is_numeric() in %s on line %d
+Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_object.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_object.phpt
diff -u php-src/ext/standard/tests/general_functions/is_object.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_object.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_object.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_object.phpt Fri Jun 20
13:02:33 2008
@@ -220,9 +220,9 @@
*** Testing error conditions ***
-Warning: is_object(): Only one argument expected in %s on line %d
+Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_object(): Only one argument expected in %s on line %d
+Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_scalar.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_scalar.phpt
diff -u php-src/ext/standard/tests/general_functions/is_scalar.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_scalar.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_scalar.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_scalar.phpt Fri Jun 20
13:02:33 2008
@@ -230,12 +230,12 @@
*** Testing error conditions ***
-Warning: Wrong parameter count for is_scalar() in %s on line %d
+Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-Warning: Wrong parameter count for is_scalar() in %s on line %d
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-Warning: Wrong parameter count for is_scalar() in %s on line %d
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_string.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/is_string.phpt
diff -u php-src/ext/standard/tests/general_functions/is_string.phpt:1.1.2.1
php-src/ext/standard/tests/general_functions/is_string.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/general_functions/is_string.phpt:1.1.2.1 Sat May
12 10:28:00 2007
+++ php-src/ext/standard/tests/general_functions/is_string.phpt Fri Jun 20
13:02:33 2008
@@ -296,9 +296,9 @@
*** Testing error conditions ***
-Warning: is_string(): Only one argument expected in %s on line %d
+Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-Warning: is_string(): Only one argument expected in %s on line %d
+Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php