summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2001-08-13 07:55:39 +0000
committerRasmus Lerdorf <rasmus@php.net>2001-08-13 07:55:39 +0000
commit4d11d90880e63aaf125d09140775efdb287b9704 (patch)
tree00ed223eb953c2286b1b557548fbc4f73000f55c /ext/standard
parent5b2227ea80b0fc5be46bfbdd9dd5ce4ac7825717 (diff)
downloadphp-git-4d11d90880e63aaf125d09140775efdb287b9704.tar.gz
Track down a few more functions that don't check for 0 args and use
faster mechanism
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c6
-rw-r--r--ext/standard/head.c4
-rw-r--r--ext/standard/info.c30
-rw-r--r--ext/standard/rand.c8
4 files changed, 33 insertions, 15 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 17b093bf59..2fd601bf42 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1316,8 +1316,9 @@ PHP_FUNCTION(settype)
Get the name of the owner of the current PHP script */
PHP_FUNCTION(get_current_user)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRING(php_get_current_user(), 1);
}
@@ -1343,7 +1344,6 @@ PHP_FUNCTION(get_cfg_var)
}
/* }}} */
-
/* {{{ proto bool set_magic_quotes_runtime(int new_setting)
Set the current active configuration setting of magic_quotes_runtime and return previous */
PHP_FUNCTION(set_magic_quotes_runtime)
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 532cd7c5a6..38f8438f7f 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -180,6 +180,10 @@ PHP_FUNCTION(setcookie)
Return true if headers have already been sent, false otherwise */
PHP_FUNCTION(headers_sent)
{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
if (SG(headers_sent)) {
RETURN_TRUE;
} else {
diff --git a/ext/standard/info.c b/ext/standard/info.c
index ca41591ca3..0fa5414a1d 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -476,8 +476,9 @@ PHP_FUNCTION(phpinfo)
Return the current PHP version */
PHP_FUNCTION(phpversion)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRING(PHP_VERSION, 1);
}
@@ -506,8 +507,9 @@ PHP_FUNCTION(phpcredits)
Return the special ID used to request the PHP logo in phpinfo screens*/
PHP_FUNCTION(php_logo_guid)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
}
@@ -517,8 +519,9 @@ PHP_FUNCTION(php_logo_guid)
Return the special ID used to request the PHP logo in phpinfo screens*/
PHP_FUNCTION(php_egg_logo_guid)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
}
@@ -528,8 +531,9 @@ PHP_FUNCTION(php_egg_logo_guid)
Return the special ID used to request the Zend logo in phpinfo screens*/
PHP_FUNCTION(zend_logo_guid)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
}
@@ -539,8 +543,9 @@ PHP_FUNCTION(zend_logo_guid)
Return the current SAPI module name */
PHP_FUNCTION(php_sapi_name)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
if (sapi_module.name) {
RETURN_STRING(sapi_module.name, 1);
@@ -555,8 +560,9 @@ PHP_FUNCTION(php_sapi_name)
Return information about the system PHP was built on */
PHP_FUNCTION(php_uname)
{
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE)
- return;
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
RETURN_STRING(php_get_uname(), 0);
}
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 567ee7277a..4ac3bc0507 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -329,6 +329,10 @@ PHP_FUNCTION(mt_rand)
Returns the maximum value a random number can have */
PHP_FUNCTION(getrandmax)
{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
return_value->type = IS_LONG;
return_value->value.lval = PHP_RAND_MAX;
}
@@ -338,6 +342,10 @@ PHP_FUNCTION(getrandmax)
Returns the maximum value a random number from Mersenne Twister can have */
PHP_FUNCTION(mt_getrandmax)
{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
return_value->type = IS_LONG;
/*
* Melo: it could be 2^^32 but we only use 2^^31 to maintain