com php-src: Fixed bug #65947 (basename is no more working after fgetcsv in certain situation): NEWS ext/standard/php_string.h ext/st
andard/tests/strings/bug65947.phpt

From: Date: Fri, 08 Nov 2013 07:32:28 +0000
Subject: com php-src: Fixed bug #65947 (basename is no more working after fgetcsv in certain situation): NEWS ext/standard/php_string.h ext/st
andard/tests/strings/bug65947.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73897@lists.php.net to get a copy of this message
Commit: cf2626f10c92709f8db44afa15fc09ec6a9d8b0c Author: Xinchen Hui <laruence@php.net> Fri, 8 Nov 2013 15:32:28 +0800 Parents: fd3fa9b53c6bc8f34c1c8bf75141f7ee74dc8db0 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cf2626f10c92709f8db44afa15fc09ec6a9d8b0c Log: Fixed bug #65947 (basename is no more working after fgetcsv in certain situation) previous codes: "#define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state)))# it use mbsinit there, seems try to initialize the mblen_state, but: "This function does not change the state identified by ps. Typical ways to make the state pointed by ps an initial state are: memset (ps,0,sizeof(*ps)); // ps points to zero-valued object " http://www.cplusplus.com/reference/cwchar/mbsinit/?kw=mbsinit Bugs: https://bugs.php.net/65947 Changed paths: M NEWS M ext/standard/php_string.h A ext/standard/tests/strings/bug65947.phpt Diff: diff --git a/NEWS b/NEWS index 091ae9a...4689a43 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.4.23 +- Core: + . Fixed bug #65947 (basename is no more working after fgetcsv in certain + situation). (Laruence) + - MySQLi: . Fixed bug #66043 (Segfault calling bind_param() on mysqli). (Laruence) diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 65219f2..1ce98ee 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -156,7 +156,7 @@ PHPAPI char *php_strerror(int errnum); # define php_mblen(ptr, len) 1 #else # if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T) -# define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(&BG(mblen_state)): (int)mbrlen(ptr, len, &BG(mblen_state))) +# define php_mblen(ptr, len) ((ptr) == NULL ? memset(&BG(mblen_state), 0, sizeof(BG(mblen_state))): (int)mbrlen(ptr, len, &BG(mblen_state))) # else # define php_mblen(ptr, len) mblen(ptr, len) # endif diff --git a/ext/standard/tests/strings/bug65947.phpt b/ext/standard/tests/strings/bug65947.phpt new file mode 100644 index 0000000..956aa60 --- /dev/null +++ b/ext/standard/tests/strings/bug65947.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #65947 (basename is no more working after fgetcsv in certain situation) +--SKIPIF-- +<?php if (!PHP_ZTS) { print "skip only for zts build"; } +--FILE-- +<?php +$filename = 'test.toto'; +// é in ISO-8859-1 +$csv = base64_decode('6Q=='); +$adata = str_getcsv($csv,";"); +$b2 = basename($filename); +if ($filename != $b2) + print "BUG"; +else + print "OKEY"; +--EXPECTF-- +OKEY

« previous php.cvs (#73897) next »