php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23105 read_exif_data fails to read entire string
Submitted: 2003-04-07 23:08 UTC Modified: 2003-04-08 16:26 UTC
From: joncu at autodesk dot com Assigned: edink (profile)
Status: Wont fix Package: mbstring related
PHP Version: 4.3.1 OS: XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-04-07 23:08 UTC] joncu at autodesk dot com
read_exif_data() will only return the first letter of any WINXP Unicode strings.  This only happens in a Win32 build of the php_exif.dll.  The bug does not occur in a Linux build.  

I've confirmed this with both my own build and the currently posted php_exif.dll.  I am unable to successfully run a debug build in XP, so I have not been able to debug further.

The same data will be read fully under the IFD0 tags, but not under the WINXP tags.  The following code ...

foreach($exif as $key=>$section) {
    foreach($section as $name=>$val) {
        echo "$key.$name: $val<br />\n";
    }
}
... will return the following relevant data ...

IFD0.Title: JMC_TITLE
IFD0.Comments: JMC_COMMENTS
IFD0.Subject: JMC_SUBJECT

WINXP.Title: J
WINXP.Comments: J
WINXP.Subject: J

These two sections should be identical, and are with Linux built binaries.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-08 05:19 UTC] joncu at autodesk dot com
I have now been able to debug this to the point of knowing that it is an MBString problem.  HAVE_MBSTRING is not defined in the exif project when config.w32.h has it defined.  So, EXIF_USE_MBSTRING does not get defined.  

I tried manually setting EXIF_USE_MBSTRING, but was unable to get it correct - ending with a problem in the Thread storage accessing the mbstring globals.

Anyway, someone more familiar with this code can probably find and fix the problem fairly quickly.  It just appears that somewhere in the VC6 dsw and dsp files, the HAVE_MBSTRING extension is not getting set correctly.

Also - to create a test JPG, I just used the XP file properties dialog to add summary data to the Title, Comments, etc. fields (under summary/advanced).
 [2003-04-08 15:21 UTC] sniper@php.net
Edin, can you add the missing defines..

 [2003-04-08 16:05 UTC] joncu at autodesk dot com
I did find one more thing after I sent the last comment.  The config.w32.h file has the commented line ...
;#define HAVE_MBSTRING 0
I had at first just uncommented it, thinking the code was using #ifdef HAVE_MBSTRING, rather than #if HAVE_MBSTRING.

I would recommend that the commented line should be ...
;#define HAVE_MBSTRING 1
so that simply uncommenting it turns on the MBSTRING.

When I corrected that, I was unable to compile a functioning executable - however, I should mention that I am also using VC7, and am aware that it handles #if differently than VC6.  But since the posted Win32 executables exhibit the same bug as my VC7 build does, I think there's still additional changes needed.
 [2003-04-08 16:26 UTC] edink@php.net
This cannot be fixed due to the fact that mbstring has been removed from PHP core (it has been 'unbundled') and the rest of core files and other extensions cannot use mbstring functionality when it is compiled as a shared library (dll).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC