php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78642 Wrong version displayed
Submitted: 2019-10-07 19:52 UTC Modified: 2019-10-08 08:45 UTC
From: gedas at martynas dot it Assigned: cmb (profile)
Status: Closed Package: ICONV related
PHP Version: 7.2.23 OS: CentOS 7
Private report: No CVE-ID: None
 [2019-10-07 19:52 UTC] gedas at martynas dot it
Description:
------------
After upgrading iconv 1.15 -> 1.16 phpinfo() shows iconv version being 1.0.

/usr/local/include/iconv.h snippet:
[...]
23:#define _LIBICONV_VERSION 0x0110    /* version number: (major<<8) + minor */
[...]

And how php parses the version:
285:#if HAVE_LIBICONV
286:        {
287:                static char buf[16];
288:                snprintf(buf, sizeof(buf), "%d.%d",
289:                    ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f));
290:                version = buf;
291:        }

Till the 1.15 was all fine, as the version string was: 0x010F, after it went to 0x0110, the minor version became 0 due to the "_libiconv_version & 0x0f".

Suggested change:
#if HAVE_LIBICONV
        {
                static char buf[16];
                snprintf(buf, sizeof(buf), "%d.%d",
                    _libiconv_version >> 8, _libiconv_version & 0xff);
                version = buf;
        }

Attaching suggested patch.



Expected result:
----------------
Expected result iconv version 1.16

Actual result:
--------------
Actual result iconv version 1.0

Patches

iconv.c.patch (last revision 2019-10-07 19:52 UTC by gedas at martynas dot it)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-07 19:52 UTC] gedas at martynas dot it
The following patch has been added/updated:

Patch Name: iconv.c.patch
Revision:   1570477956
URL:        https://bugs.php.net/patch-display.php?bug=78642&patch=iconv.c.patch&revision=1570477956
 [2019-10-08 08:45 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2019-10-08 08:45 UTC] cmb@php.net
Thanks for reporting and the patch!
 [2019-10-08 10:12 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=195c2008e8f25040130e597f46cd652829c84dba
Log: Fix #78642: Wrong libiconv version displayed
 [2019-10-08 10:12 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC