|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53005 iconv() fails in ext/iconv/iconv.c php_iconv_string
Submitted: 2010-10-06 22:58 UTC Modified: 2010-10-07 01:45 UTC
From: php at jdrtech dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5.3.3 OS: Solaris 10 Sparc
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
50 - 23 = ?
Subscribe to this entry?

 [2010-10-06 22:58 UTC] php at jdrtech dot com
PHP runs great with the exception of iconv. I've created a test program that uses with expected results

CLI command:

>./php ./test.php
Original : This is the Euro symbol '?'.
TRANSLIT : Segmentation Fault (core dumped)

CC: Sun C++ 5.8 2005/10/13
cc: Sun C 5.8 2005/10/13


export CC=cc CFLAGS="-xarch=v9a" CXXFLAGS="-xarch=v9a" CPPFLAGS="-I/fcgi/include" LDFLAGS="-L/fcgi/lib"

./configure --prefix=/fcgi --with-mysql=/opt/mysql/mysql --enable-mbstring --with-apache=../apache_1.3.41 -with-dom --with-xsl=/fcgi --with-iconv-dir=/fcgi --enable-debug

>ldd php =>         /fcgi/lib/ =>       /lib/64/ =>        /lib/64/ =>   /lib/64/ =>     /lib/64/ =>    /lib/64/ =>  /usr/local/mysql/lib/ =>        /lib/64/ =>  /fcgi/lib/ =>  /fcgi/lib/ =>        /lib/64/ =>   /lib/64/ =>         /fcgi/lib/ =>     /lib/64/ =>     /usr/lib/64/ =>    /lib/64/ =>   /lib/64/ =>   /lib/64/ =>   /lib/64/ =>  /lib/64/ =>         /lib/64/

Test script:
$text = "This is the Euro symbol '?'.";

echo 'Original : ', $text, PHP_EOL;
echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
echo 'IGNORE   : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
echo 'Plain    : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;


Expected result:

Actual result:
t@1 (l@1) program terminated by signal SEGV (no mapping at the fault address)
0xffffffff7d35a544: _iconv+0x002c:      jmp      %l5
Current function is php_iconv_string
  501                   result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-07 01:45 UTC] php at jdrtech dot com
-Status: Open +Status: Closed
 [2010-10-07 01:45 UTC] php at jdrtech dot com
needed to do preload, runs great
 [2010-10-13 12:26 UTC] reggaedancer at ymail dot com
I have the same issue on Solaris 10 x86,
PHP 5.3.3
after running iconv PHP script, PHP crashed and created a core dump.
What do you mean by "needed to preload".
How can I fix this issue ?
 [2010-10-13 15:12 UTC] wes at jdrtech dot com
libiconv should provide the preloadable library

I edited apachectl:


 case $ARG in
        export LD_PRELOAD_64

        if [ $RUNNING -eq 1 ]; then
            echo "$0 $ARG: httpd (pid $PID) already running"

of course your library location may differ, probably /usr/local/lib and LD_PRELOAD_32 if your using 32 bit

good luck
 [2010-10-14 18:18 UTC] reggaedancer at ymail dot com
It really works.
I just added:
export LD_PRELOAD_32
and the Apache/PHP with iconv is working and not crashing anymore.

I tried to use disable_functions in PHP to avoid iconv,
but this preload solution is great.
Thank you very much for your help.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 19:01:30 2024 UTC