Bug #65947 [PATCH]: basename is no more working after fgetcsv in certain situation

From: Date: Wed, 06 Nov 2013 08:41:26 +0000
Subject: Bug #65947 [PATCH]: basename is no more working after fgetcsv in certain situation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182615@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65947&edit=1 ID: 65947 Patch added by: laruence@php.net Reported by: phpbugs at dev dot bitadept dot org Summary: basename is no more working after fgetcsv in certain situation Status: Assigned Type: Bug Package: Filesystem function related Operating System: Gentoo Linux PHP Version: 5.5.5 Assigned To: rasmus Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: bug65947-2.patch Revision: 1383727286 URL: https://bugs.php.net/patch-display.php?bug=65947&patch=bug65947-2.patch&revision=1383727286 Previous Comments: ------------------------------------------------------------------------ [2013-11-06 08:40:40] laruence@php.net I was keep looking this, and found a suspicious 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 so I propose another fix... will attach later rasmus, do you think it's right fix? thanks ------------------------------------------------------------------------ [2013-11-05 15:24:05] phpbugs at dev dot bitadept dot org Applied patch to php-5.5.5-pl0-gentoo and works fine now. ------------------------------------------------------------------------ [2013-11-05 14:31:40] remi dot sauvat+php at gmail dot com The patch is working for me. It fixes the basename and pathinfo php functions. Patch applied to PHP 5.5.4-pl0-gentoo ------------------------------------------------------------------------ [2013-11-05 13:41:59] laruence@php.net a patch is attached to explain where the problems come from. anyway maybe a better fix is clean the stat in getcsv. ------------------------------------------------------------------------ [2013-11-05 13:40:38] laruence@php.net The following patch has been added/updated: Patch Name: bug65947.patch Revision: 1383658838 URL: https://bugs.php.net/patch-display.php?bug=65947&patch=bug65947.patch&revision=1383658838 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65947 -- Edit this bug report at https://bugs.php.net/bug.php?id=65947&edit=1

« previous php.bugs (#182615) next »