diff options
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r-- | ext/standard/string.c | 25 |
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 |