]> granicus.if.org Git - php/commitdiff
Make quoted_printable_decode() take only ASCII strings.
authorAndrei Zmievski <andrei@php.net>
Thu, 30 Nov 2006 18:32:59 +0000 (18:32 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 30 Nov 2006 18:32:59 +0000 (18:32 +0000)
ext/standard/quot_print.c

index 22a2e494ca567ca0234b8c6e1b6b306f07618610..0c40f4b5aa1dcf7f999838f5bd37f25d957d68e7 100644 (file)
@@ -147,26 +147,24 @@ PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t len
 * Decoding  Quoted-printable string.
 *
 */
-/* {{{ proto string quoted_printable_decode(string str)
+/* {{{ proto binary quoted_printable_decode(string str) U
    Convert a quoted-printable string to an 8 bit string */
 PHP_FUNCTION(quoted_printable_decode)
 {
-       zval **arg1;
        char *str_in, *str_out;
+       int str_in_len;
        int i = 0, j = 0, k;
 
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str_in, &str_in_len, UG(ascii_conv)) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(arg1);
     
-       if (Z_STRLEN_PP(arg1) == 0) {
+       if (str_in_len == 0) {
                /* shortcut */
                RETURN_EMPTY_STRING();
        }
 
-       str_in = Z_STRVAL_PP(arg1);
-       str_out = emalloc(Z_STRLEN_PP(arg1) + 1);
+       str_out = emalloc(str_in_len + 1);
        while (str_in[i]) {
                switch (str_in[i]) {
                case '=':