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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gedas at martynas dot it
New email:
PHP Version: OS:

 

 [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)

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 14:01:28 2024 UTC