cvs: php-src /ext/standard head.c

From: Date: Mon, 04 Dec 2006 20:43:42 +0000
Subject: cvs: php-src /ext/standard head.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41886@lists.php.net to get a copy of this message
andrei Mon Dec 4 20:43:42 2006 UTC Modified files: /php-src/ext/standard head.c Log: Make headers-related functions accept Unicode strings, but only if their contents can be converted to ASCII. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/head.c?r1=1.92&r2=1.93&diff_format=u Index: php-src/ext/standard/head.c diff -u php-src/ext/standard/head.c:1.92 php-src/ext/standard/head.c:1.93 --- php-src/ext/standard/head.c:1.92 Thu Oct 19 20:55:08 2006 +++ php-src/ext/standard/head.c Mon Dec 4 20:43:42 2006 @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: head.c,v 1.92 2006/10/19 20:55:08 andrei Exp $ */ +/* $Id: head.c,v 1.93 2006/12/04 20:43:42 andrei Exp $ */ #include <stdio.h> #include "php.h" @@ -34,16 +34,17 @@ /* Implementation of the language Header() function */ -/* {{{ proto void header(string header [, bool replace, [int http_response_code]]) +/* {{{ proto void header(string header [, bool replace, [int http_response_code]]) U Sends a raw HTTP header */ PHP_FUNCTION(header) { zend_bool rep = 1; sapi_header_line ctr = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line, - &ctr.line_len, &rep, &ctr.response_code) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|bl", &ctr.line, + &ctr.line_len, UG(ascii_conv), &rep, &ctr.response_code) == FAILURE) { return; + } sapi_header_op(rep ? SAPI_HEADER_REPLACE:SAPI_HEADER_ADD, &ctr TSRMLS_CC); } @@ -144,7 +145,7 @@ /* php_set_cookie(name, value, expires, path, domain, secure) */ -/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) +/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) U Send a cookie */ PHP_FUNCTION(setcookie) { @@ -153,9 +154,11 @@ zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, - &name_len, &value, &value_len, &expires, &path, - &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|s&ls&s&bb", &name, + &name_len, UG(ascii_conv), &value, &value_len, + UG(ascii_conv), &expires, &path, &path_len, + UG(ascii_conv), &domain, &domain_len, + UG(ascii_conv), &secure, &httponly) == FAILURE) { return; } @@ -167,7 +170,7 @@ } /* }}} */ -/* {{{ proto bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) +/* {{{ proto bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]]) U Send a cookie with no url encoding of the value */ PHP_FUNCTION(setrawcookie) { @@ -176,9 +179,11 @@ zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, - &name_len, &value, &value_len, &expires, &path, - &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|s&ls&s&bb", &name, + &name_len, UG(ascii_conv), &value, &value_len, + UG(ascii_conv), &expires, &path, &path_len, + UG(ascii_conv), &domain, &domain_len, + UG(ascii_conv), &secure, &httponly) == FAILURE) { return; }

« previous php.cvs (#41886) next »