cvs: php4 /ext/standard string.c

From: Date: Tue, 30 Jul 2002 10:51:33 +0000
Subject: cvs: php4 /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13048@lists.php.net to get a copy of this message
rasmus Tue Jul 30 06:51:33 2002 EDT Modified files: /php4/ext/standard string.c Log: Fix for #18638 (str_rot13 bug) Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.277 php4/ext/standard/string.c:1.278 --- php4/ext/standard/string.c:1.277 Sat Jul 13 00:13:43 2002 +++ php4/ext/standard/string.c Tue Jul 30 06:51:33 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.277 2002/07/13 04:13:43 sniper Exp $ */ +/* $Id: string.c,v 1.278 2002/07/30 10:51:33 rasmus Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -3887,24 +3887,21 @@ 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"; + zval **arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", - &str, &str_len) == FAILURE) { - return; + 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); } /* }}} */ - - /*

« previous php.cvs (#13048) next »