summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2002-07-30 10:51:33 +0000
committerRasmus Lerdorf <rasmus@php.net>2002-07-30 10:51:33 +0000
commitd56bc7934da1715e213897092e68e63d9589382d (patch)
treea07de7e784ba4c1e949b1f51a7e68b722613e820 /ext/standard
parent5246b7d9d4531f3c886e883612d0a1df585478a0 (diff)
downloadphp-git-d56bc7934da1715e213897092e68e63d9589382d.tar.gz
Fix for #18638 (str_rot13 bug)
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/string.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 933d062311..cab59b1b42 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3887,26 +3887,23 @@ PHP_FUNCTION(sscanf)
Perform the rot13 transform on a string */
PHP_FUNCTION(str_rot13)
{
- char *str;
- int str_len;
- static char xfrom[] = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- static char xto[] = "nopqrstuvwxyzabcdefghijklm"
- "NOPQRSTUVWXYZABCDEFGHIJKLM";
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &str, &str_len) == FAILURE) {
- return;
+ zval **arg;
+
+ static char xfrom[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ static char xto[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
+ WRONG_PARAM_COUNT;
}
+ convert_to_string_ex(arg);
+ *return_value = **arg;
+ zval_copy_ctor(return_value);
- php_strtr(str, str_len, xfrom, xto, 52);
- RETURN_STRINGL(str, str_len, 1);
+ php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), xfrom, xto, 52);
}
/* }}} */
-
-
/*
* Local variables:
* tab-width: 4