summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-14 11:44:53 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-14 11:44:53 +0400
commit32e477c98c706303e1935e3af96632a02949137a (patch)
tree18559c9ae62daa74f657019569b62059aee96574 /ext/standard/string.c
parent0ef6f729c91dbe2a4abdeefe9ac112021c7d60b0 (diff)
parent4bdb0120dc26a14d906e2e8a69e841920df3de99 (diff)
downloadphp-git-32e477c98c706303e1935e3af96632a02949137a.tar.gz
Merge branch 'master' into phpng
* master: (40 commits) Bug #67609: TLS connections fail behind HTTP proxy Updated NEWS for #67594 Updated NEWS for #67594 Fix #67594 - invisible colon should be stripped off header name Updated NEWS for 34407 Updated NEWS for 34407 Updated NEWS for 34407 Fix for bug #34407 - ucwords and title case fixed broken merged code Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. fixed broken merged code Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index. Test output relies on expose_php being on 1.2 is a problematic float to print out Lower the default display precision for this test The test output is dependent on expose_php ini fix makefile in phpize mode fixe output_as_table() when no ext was enabled fix end of stream exception when generating makefile ... Conflicts: ext/standard/http_fopen_wrapper.c ext/standard/string.c sapi/cli/php_cli_server.c
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index ec9b8a02a2..5f4f360ca6 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2748,17 +2748,20 @@ PHP_FUNCTION(lcfirst)
Uppercase the first character of every word in a string */
PHP_FUNCTION(ucwords)
{
- char *str;
+ char *str, *delims = " \t\r\n\f\v";
register char *r, *r_end;
- int str_len;
+ int str_len, delims_len = 6;
+ char mask[256];
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &delims, &delims_len) == FAILURE) {
return;
}
#else
- ZEND_PARSE_PARAMETERS_START(1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_STRING(str, str_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(delims, delims_len)
ZEND_PARSE_PARAMETERS_END();
#endif
@@ -2766,12 +2769,14 @@ PHP_FUNCTION(ucwords)
RETURN_EMPTY_STRING();
}
+ php_charmask((unsigned char *)delims, delims_len, mask TSRMLS_CC);
+
ZVAL_STRINGL(return_value, str, str_len);
r = Z_STRVAL_P(return_value);
*r = toupper((unsigned char) *r);
for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) {
- if (isspace((int) *(unsigned char *)r++)) {
+ if (mask[(unsigned char)*r++]) {
*r = toupper((unsigned char) *r);
}
}