com php-src: fixed count_chars(): ext/standard/string .c

From: Date: Wed, 20 Aug 2014 13:51:45 +0000
Subject: com php-src: fixed count_chars(): ext/standard/string .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-80726@lists.php.net to get a copy of this message
Commit: e08fa78a54f7f1abf5b599bdcef5a7323fa5eb3a Author: Anatol Belski <ab@php.net> Wed, 20 Aug 2014 15:51:45 +0200 Parents: 38c4db54dde1d82769f8c3e3775656d58db0a24a Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e08fa78a54f7f1abf5b599bdcef5a7323fa5eb3a Log: fixed count_chars() Changed paths: M ext/standard/string.c Diff: diff --git a/ext/standard/string.c b/ext/standard/string.c index 5a4bf8a..e43ec7d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4772,6 +4772,7 @@ PHP_FUNCTION(count_chars) int inx; char retstr[256]; php_size_t retlen=0; + php_size_t tmp = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &input, &mymode) == FAILURE) { return; @@ -4782,13 +4783,13 @@ PHP_FUNCTION(count_chars) RETURN_FALSE; } - buf = (unsigned char *) input; + buf = (unsigned char *) input->val; memset((void*) chars, 0, sizeof(chars)); - while (input->len > 0) { + while (tmp < input->len) { chars[*buf]++; buf++; - input->len--; + tmp++; } if (mymode < 3) {

« previous php.cvs (#80726) next »