Bug #15799 Updated: Another segfault on iconv

From: Date: Mon, 11 Mar 2002 22:40:45 +0000
Subject: Bug #15799 Updated: Another segfault on iconv
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-2258@lists.php.net to get a copy of this message
ID: 15799 Updated by: jan@horde.org Reported By: jan@horde.org -Status: Closed +Status: Open Bug Type: ICONV related Operating System: Linux PHP Version: 4.0CVS-2002-02-2 New Comment: Ah, you're right, I thought all ob_* functions that return or output the buffer pass the data through the ob_handler first. But even if I use it the intended way, the output is not converted. This is the new script I used: <? error_reporting(E_ALL); $text = <<< END Thanks !! David Chang ----------------------------------------------------------------- < ¨C¤&#1139;£ Yahoo!©_¼¯ > www.yahoo.com.tw END; iconv_set_encoding('input_encoding', 'BIG5'); iconv_set_encoding('internal_encoding', 'UTF-8'); iconv_set_encoding('output_encoding', 'UTF-8'); ob_start('ob_iconv_handler'); echo $text; header('Content-Type: text/plain; charset=UTF-8'); ob_end_flush(); ?> Previous Comments: ------------------------------------------------------------------------ [2002-03-11 17:10:02] mfischer@php.net I'm closing this because I think your code is bogus. The manual clearly says "The function ("ob_iconv_handler") will be called when ob_end_flush() is called, or when the output buffer is flushed to the browser at the end of the request." So, if you call ob_get_contents() and ob_end_clean() you do not get any conversion. If you either call ob_end_flush() or just don't call any further ob*() functions the conversion works as expected for me. Feel free to re-open if you think I'm wrong. ------------------------------------------------------------------------ [2002-03-11 05:58:19] mfischer@php.net Yep, saw it. Will fix this later (this day). ------------------------------------------------------------------------ [2002-03-11 05:18:13] jan@horde.org I see you already committed the patch to cvs and, yes, php doesn't segfault anymore, thanks. But unfortunately the conversion doesn't happen at all. You can try the same script I posted earlier to reproduce it. Method 1 converts correctly, method 2 just send the Big5 data asis. ------------------------------------------------------------------------ [2002-03-10 18:01:25] mfischer@php.net Fixed in CVS and 4.2.0 branch. ------------------------------------------------------------------------ [2002-03-09 15:34:13] mfischer@php.net I've sent a patch to jan (wouldn't make sense to paste here as long lines get broken) and I'm pretty sure it's the right fix. I bet the current code never really worked the way it was written. Anyway I'm for deprecating iconv_(set|get)_encoding. All it does is changing INI settigns which can be easily read and set with ini_get("iconv.input_encoding") or ini_set(). However I don't know what the general consesus in in such situations. The two functions just seem redundant to me. ------------------------------------------------------------------------ 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 http://bugs.php.net/15799 -- Edit this bug report at http://bugs.php.net/?id=15799&edit=1

« previous php.bugs (#2258) next »