Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57273 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35558 invoked from network); 8 Jan 2012 16:41:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2012 16:41:58 -0000 Authentication-Results: pb1.pair.com header.from=ezyang@MIT.EDU; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ezyang@mit.edu; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mit.edu designates 18.7.68.35 as permitted sender) X-PHP-List-Original-Sender: ezyang@mit.edu X-Host-Fingerprint: 18.7.68.35 DMZ-MAILSEC-SCANNER-6.MIT.EDU Linux 2.6 Received: from [18.7.68.35] ([18.7.68.35:46046] helo=dmz-mailsec-scanner-6.mit.edu) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/D2-17813-457C90F4 for ; Sun, 08 Jan 2012 11:41:57 -0500 X-AuditID: 12074423-b7f9c6d0000008c3-36-4f09c7521e6f Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id AC.41.02243.257C90F4; Sun, 8 Jan 2012 11:41:54 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q08GfrS4031371; Sun, 8 Jan 2012 11:41:53 -0500 Received: from localhost (EZYANG.MIT.EDU [18.243.1.50]) (authenticated bits=0) (User authenticated as ezyang@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q08GfoV2008236; Sun, 8 Jan 2012 11:41:52 -0500 (EST) Content-Type: text/plain; charset=UTF-8 Cc: "Edward Z. Yang" , internals To: Pierre Joye In-reply-to: References: <1325788652-sup-3243@ezyang> Date: Sun, 08 Jan 2012 11:41:50 -0500 Message-ID: <1326039782-sup-7389@ezyang> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IRYrdT0Q06zulvsHChpMWBV93MFgfebmOz WLu+m8WB2WPnrLvsHk/WrWHxaGn6xxTAHMVlk5Kak1mWWqRvl8CVsb3lEHPBRKmKFd3NTA2M 10S6GDk5JARMJCbdvckCYYtJXLi3nq2LkYtDSGAfo8S5ZS+ZIJz1jBJbX6xghXA+MUocm3YV qIyDg1lAXWL9PCGQbmYBL4ne3X1gk4QFdCTubrrKBGKzAZU8OvaUFcQWEVCT6D5+hhnE5hQI lLiw+Tw7iC0kkCsx7fYDsHoWAVWJpr9v2EBsXgENiam928FqRAWEJZ4caWaG2CUv0bx1NvME RoFZCFfMQpJZwMi0ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdMLzezRC81pXQTIzhEXZR3MP45 qHSIUYCDUYmHdwMbp78Qa2JZcWXuIUZJDiYlUd4bR4FCfEn5KZUZicUZ8UWlOanFhxglOJiV RHgDdgHleFMSK6tSi/JhUtIcLErivBpa7/yEBNITS1KzU1MLUotgsuocHAIrP65mlWLJy89L VZLgPXkMaIZgUWp6akVaZk4JQiUTByfIHh6gPcdBaniLCxJzizPTIfKnGHU57nfPPccoBDZI Spx3AUiRAEhRRmke3BxYwnnFKA70oTBvP0gVDzBZwU16BbSECWjJgz/sIEtKEhFSUg2Mi7sm z38rePi3vYQ2l9KXV+W/39m97tOq4eQJ4a2WNHO6VxmRkhjq0XU7vm7um8qLab1FZwIb9Tre fjRiPMkfwbe5vcF6j0LJ1t/OM+233U3atERsZ2xXTPYx0afWJxo3imf4eF7t3b+xM/Dnc2bN nV3HHr9QY49tfr+rMJfVrTvOTfPVtANKLMUZiYZazEXFiQDVIVXuEwMAAA== Subject: Re: [PHP-DEV] Bug 48417 and PHP 5.4 From: ezyang@MIT.EDU ("Edward Z. Yang") Hello Pierre, The whole situation is a slightly complicated. One question to ask is: "Is there code in PHP 5.3 that worked, which now no longer works in PHP 5.4?" The answer to this question is *yes*, as seen by this example: var_dump(iconv("UTF-8", "ISO-8859-1//IGNORE", "\xE4\xB8\xAD")); Now, the reason why this worked in PHP 5.3 was because of a "bug", namely #52211, so the situation in PHP 5.3 was "two wrongs make a right" (except, of course, in the case where more than 8000 bytes are involved.) Fixing one of the bugs causes "//IGNORE" to stop working entirely. So if you ask another question, "Are there less bugs in PHP 5.4 than in PHP 5.3", the answer is also yes. Now, consider the perspective of a library developer using iconv //IGNORE. In PHP 5.3, effective workarounds exist: I can fix #52211 by checking for captured errors and returning false instead, I can fix #48147 by splitting my input into 8kb chunks (mumble utf-8 boundaries) and feeding it to iconv individually. In PHP 5.4, I am left with no such redress. Because iconv will now always return false upon an input, regardless of whether or not //IGNORE is set, I can no longer do conversions with invalid inputs. It's worth repeating: #48147 is no longer "iconv with //IGNORE cuts string", it's "iconv with //IGNORE doesn't work". At all. I *guarantee* you large amounts of PHP code will be affected. It seems it would be better to wait for a complete fix, than to fix it partially and leave some (widely used) functionality completely broken. Is this a bug in glibc? I sincerely hope I can convince Ulrich Drepper so, since I agree that his API is completely off the wall: http://sources.redhat.com/bugzilla/show_bug.cgi?id=13541 But as it stands, Ulrich does not seem to believe that there is any bug (see that he's closed both of my upstream bugs; and, since //IGNORE is wholly undocumented, there is not really any spec I can hold him to), so it would seem most advisable for PHP to play nice, since most users are not in the position to patch their glibc installation. Cheers, Edward Excerpts from Pierre Joye's message of Sun Jan 08 07:36:03 -0500 2012: > hi, > > I closed one bug (unrelated to what you have) and added a comment to > the /ignore issue. I do not see a bug in PHP but if you have any info > that shows that PHP causes this problem, then please add them to the > bug so we can fix it, if not I will bogus it as there is no bug in php > but in iconv (glibc or other implementations). > > On Thu, Jan 5, 2012 at 7:42 PM, Edward Z. Yang wrote: > > Hello all, > > > > I know it seems like there always is infinite pile of work to do before > > the PHP 5.4 release comes out, but I think this bug is worth looking at. > > > > https://bugs.php.net/bug.php?id=52211 > > > > I suggest reverting r300894, since this causes //IGNORE to stop working. > > Preserving functionality should probably be more important. > > > > The underlying cause of this bug is this one: > > > > https://bugs.php.net/bug.php?id=48147 > > > > But I don't think this feature is going to get implemented in time. > > > > Edward > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > >