php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26194 Call to iconv() gives "undefined function" error, php -i says iconv functional
Submitted: 2003-11-10 21:24 UTC Modified: 2003-11-22 08:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bjorn dot wiberg at home dot se Assigned:
Status: Closed Package: ICONV related
PHP Version: 5.0.0b2 (beta2) OS: Windows XP Professional SP-1
Private report: No CVE-ID: None
 [2003-11-10 21:24 UTC] bjorn dot wiberg at home dot se
Description:
------------
I'm using the binary distribution of PHP 5.0.0b2.

Calling iconv() fails with an "undefined function" error, although php -i and phpinfo() reports the iconv extension to be functional. This problem did not occur with 5.0.0b1.

Path to php.ini is E:\Utils\Apache Group\Apache2\custom\conf\php.ini (set in httpd.conf through the PHPINIDir directive -- I'm running it with Apache 2.0.48, everything works fine except for this).

Extension dir is E:\Utils\PHP\extensions (set in php.ini).
The php_iconv.dll extension is loaded in php.ini. I'm also using the php_exif.dll, php_gd2.dll, php_mime_magic.dll (and in 5.0.0b2, php_mysql.dll) extensions.

The php4ts.dll, iconv.dll and libmySQL.dll files have been copied to the E:\Utils\PHP\sapi\ directory which Apache loads the PHP module (php4apache2.dll) from.

E:\Utils\PHP and E:\Utils\PHP\dlls are in the PATH environment variable.

I also tried the php5-win32-200311102330.zip snapshot, but got the same error.


Reproduce code:
---------------
[test.php]

<?php
        echo iconv("ISO-8859-1","UTF-8","This is a test.");
?>


Expected result:
----------------
The text "This is a test.". The script works fine with PHP 5.0.0b1:

E:\Utils\PHP>php.exe -c "\Utils\Apache Group\Apache2\custom\conf" "\Utils\Apache Group\Apache2\custom\php-bin\vhosts\myhost.dyndns.org\test.php"
Content-type: text/html
X-Powered-By: PHP/5.0.0b1

This is a test.

E:\Utils\PHP>php.exe -c "\Utils\Apache Group\Apache2\custom\conf" -i | grep iconv
<h2><a name="module_iconv">iconv</a></h2>
<tr><td class="e">iconv support </td><td class="v">enabled </td></tr>
<tr><td class="e">iconv implementation </td><td class="v">libiconv </td></tr>
<tr><td class="e">iconv library version </td><td class="v">1.8 </td></tr>
<tr><td class="e">iconv.input_encoding</td><td class="v">ISO-8859-1</td><td clas
s="v">ISO-8859-1</td></tr>
<tr><td class="e">iconv.internal_encoding</td><td class="v">ISO-8859-1</td><td c
lass="v">ISO-8859-1</td></tr>
<tr><td class="e">iconv.output_encoding</td><td class="v">ISO-8859-1</td><td cla
ss="v">ISO-8859-1</td></tr>

E:\Utils\PHP>php.exe -c "\Utils\Apache Group\Apache2\custom\conf" -v
PHP 5.0.0b1 (cgi-fcgi) (built: Jun 28 2003 00:31:05)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies


Actual result:
--------------
An "undefined function" error:

E:\Utils\PHP>php.exe -c "\Utils\Apache Group\Apache2\custom\conf" "\Utils\Apache Group\Apache2\custom\php-bin\vhosts\myhost.dyndns.org\test.php"
PHP Fatal error:  Call to undefined function iconv() in E:\Utils\Apache Group\Apache2\custom\php-bin\vhosts\myhost.dyndns.org\test.php on line 3
Content-type: text/html
X-Powered-By: PHP/5.0.0b2

E:\Utils\PHP>php -c "\Utils\Apache Group\Apache2\custom\conf\php.ini" -i | grep
iconv
<h2><a name="module_iconv">iconv</a></h2>
<tr><td class="e">iconv support </td><td class="v">enabled </td></tr>
<tr><td class="e">iconv implementation </td><td class="v">libiconv </td></tr>
<tr><td class="e">iconv library version </td><td class="v">1.8 </td></tr>
<tr><td class="e">iconv.input_encoding</td><td class="v">ISO-8859-1</td><td clas
s="v">ISO-8859-1</td></tr>
<tr><td class="e">iconv.internal_encoding</td><td class="v">ISO-8859-1</td><td c
lass="v">ISO-8859-1</td></tr>
<tr><td class="e">iconv.output_encoding</td><td class="v">ISO-8859-1</td><td cla
ss="v">ISO-8859-1</td></tr>

E:\Utils\PHP>php -v
PHP 5.0.0b2 (cgi-fcgi) (built: Oct 30 2003 12:37:18)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-21 10:11 UTC] sfox@php.net
I get the same on win98.  Initial investigation shows that if I rename the PHP_NAMED_FE to 'blue' on line 64 of iconv.c, the resulting function blue() works perfectly.  It's just the word 'iconv' that makes it b0rk, presumably because it matches the module name (why now??).

nb libiconv() currently works in userland instead..

Can someone please check whether this is win-only or cross-platform?

Cheers,
Steph
 [2003-11-21 14:50 UTC] sfox@php.net
Patch sent to internals list just now which fixes this bug on my box.  (NB Derick tested 5.0.0b3 on some brand of *nix - this is purely a win32 problem.)
 [2003-11-21 23:14 UTC] moriyoshi@php.net
It seems kind of random heap corruption is causing this 
problem. What extensions did you enable in your php.ini?

 [2003-11-22 08:56 UTC] sfox@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Moriyoshi just committed a patch to CVS that redefines iconv at a crucial moment.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC