#41712 [Fbk->Opn]: [PATCH] Add CURL Progress Function Callback
ID: 41712 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com -Status: Feedback +Status: Open Bug Type: Feature/Change Request Operating System: SuSE Linux 10.2 PHP Version: 5CVS-2007-06-16 (CVS) Assigned To: pajoye New Comment: Thanks for responding to this issue. I've updated and tested the patch once more with the PHP_5_3 sources from CVS today: http://sdteffen.de/php/php_curl_progress_callback.patch The test script is the same as mentioned under "Reproduce code", but I've added an explanatory comment to the version on my website: http://sdteffen.de/php/index_en.html Previous Comments: [2009-04-28 18:10:56] paj...@php.net Did you test your with 5.3? If not can you post a URL to an updated patch with a test script please? It can still make it this week for 5.3+. [2009-04-28 15:09:26] frase at cs dot wisc dot edu What happened here? A patch was offered for this feature almost two years ago, and was assigned to the maintainer a week later. The next six months saw some tweaks and corrections, and yet here we are two years later with this still languishing in "assigned" limbo, neither accepted and merged nor rejected and closed. Ilia? Tony? Bueller? [2009-02-20 09:27:43] php41712 at brainpower dot no-ip dot org can somewone submit this to the php code as this will help a lot of users ---- [2008-02-16 15:00:15] sdteffen at gmail dot com The last patch is missing the changes to php_curl.h from the previous patch. A file containing the complete patch with changes for both files can be found under this URL: http://sdteffen.de/php/php_curl_progress_callback.patch [2008-02-06 21:35:33] renatobraga at gmail dot com Thanks Steffen, Worked like a charm The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41712 -- Edit this bug report at http://bugs.php.net/?id=41712&edit=1
#41712 [Asn]: [PATCH] Add CURL Progress Function Callback
ID: 41712 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Assigned Bug Type: Feature/Change Request Operating System: SuSE Linux 10.2 PHP Version: 5CVS-2007-06-16 (CVS) Assigned To: iliaa New Comment: The last patch is missing the changes to php_curl.h from the previous patch. A file containing the complete patch with changes for both files can be found under this URL: http://sdteffen.de/php/php_curl_progress_callback.patch Previous Comments: [2008-02-06 21:35:33] renatobraga at gmail dot com Thanks Steffen, Worked like a charm [2008-02-06 18:14:12] sdteffen at gmail dot com I've updated the patch to pass the return value from the callback function as Renato suggested: --- php-5.2.5.orig/ext/curl/interface.c 2007-10-13 13:35:35.0 +0200 +++ php-5.2.5.patch/ext/curl/interface.c2008-02-06 18:43:41.0 +0100 @@ -368,6 +368,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -780,6 +781,87 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + size_t rval = 0; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &zulnow; + + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = t->func_name; + fci.object_pp = NULL; + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 4; + fci.params = argv; + fci.no_separation = 0; + fci.symbol_table = NULL; + + ch->in_callback = 1; + error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC); + ch->in_callback = 0; + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); + length = -1; + } else if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) != IS_LONG) { + convert_to_long_ex(&retval_ptr); + } + if(0 != Z_LVAL_P(retval_ptr)) + rval = 1; + zval_ptr_dtor(&retval_ptr); + } + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return rval; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1068,6 +115
#41712 [Asn]: [PATCH] Add CURL Progress Function Callback
ID: 41712 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Assigned Bug Type: Feature/Change Request Operating System: SuSE Linux 10.2 PHP Version: 5CVS-2007-06-16 (CVS) Assigned To: iliaa New Comment: I've updated the patch to pass the return value from the callback function as Renato suggested: --- php-5.2.5.orig/ext/curl/interface.c 2007-10-13 13:35:35.0 +0200 +++ php-5.2.5.patch/ext/curl/interface.c2008-02-06 18:43:41.0 +0100 @@ -368,6 +368,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -780,6 +781,87 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + size_t rval = 0; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &zulnow; + + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = t->func_name; + fci.object_pp = NULL; + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 4; + fci.params = argv; + fci.no_separation = 0; + fci.symbol_table = NULL; + + ch->in_callback = 1; + error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC); + ch->in_callback = 0; + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); + length = -1; + } else if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) != IS_LONG) { + convert_to_long_ex(&retval_ptr); + } + if(0 != Z_LVAL_P(retval_ptr)) + rval = 1; + zval_ptr_dtor(&retval_ptr); + } + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return rval; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1068,6 +1150,7 @@ (*ch)->handlers->write= ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read)); + (*ch)->handlers->progress = ecalloc(1, sizeof(php_curl_progress)); (*ch)->in_callback = 0; (*ch)->header.str_len = 0; @@ -1422,6 +1505,17 @@ ch->handlers->read->func_name = *zvalue;
#41712 [Asn]: [PATCH] Add CURL Progress Function Callback
ID: 41712 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Assigned Bug Type: Feature/Change Request Operating System: SuSE Linux 10.2 PHP Version: 5CVS-2007-06-16 (CVS) Assigned To: iliaa New Comment: The progress function only returned 3 values instead of 4. The following revised patch fixes this problem (it completely replaces the previous patch): diff -u php-5.2.3/ext/curl/interface.c php-5.2.3.patched/ext/curl/interface.c --- php-5.2.3/ext/curl/interface.c 2007-05-22 10:39:20.0 +0200 +++ php-5.2.3.patched/ext/curl/interface.c 2007-06-16 13:30:05.0 +0200 @@ -368,6 +368,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -777,6 +778,80 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &zulnow; + + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = t->func_name; + fci.object_pp = NULL; + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 4; + fci.params = argv; + fci.no_separation = 0; + fci.symbol_table = NULL; + + ch->in_callback = 1; + error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC); + ch->in_callback = 0; + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); + length = -1; + } + + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return 0; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1065,6 +1140,7 @@ (*ch)->handlers->write= ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read)); + (*ch)->handlers->progress = ecalloc(1, sizeof(php_curl_progress)); (*ch)->in_callback = 0; (*ch)->header.str_len = 0; @@ -1418,6 +1494,17 @@ ch->handlers->read->func_name = *zvalue; ch->handlers->read->method = PHP_CURL_USER; break; + case CURLOPT_PROGRESSFUNCTION: + curl_easy_setopt(ch->cp, CURLOPT_PROGRESSFUNCTION, curl_progress); + curl_easy_setopt(ch->cp, CURLOPT_PROGRESSDATA, ch);
#41712 [Opn]: [PATCH] Add CURL Progress Function Callback
ID: 41712 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Open Bug Type: cURL related Operating System: SuSE Linux 10.2 PHP Version: 5CVS-2007-06-16 (CVS) New Comment: Patch to implement CURL_PROGRESSFUNCTION (works against today's 5.2 CVS version): diff -u php-5.2.3/ext/curl/interface.c php-5.2.3.patched/ext/curl/interface.c --- php-5.2.3/ext/curl/interface.c 2007-05-22 10:39:20.0 +0200 +++ php-5.2.3.patched/ext/curl/interface.c 2007-06-16 13:30:05.0 +0200 @@ -368,6 +368,7 @@ REGISTER_CURL_CONSTANT(CURLOPT_HEADER); REGISTER_CURL_CONSTANT(CURLOPT_HTTPHEADER); REGISTER_CURL_CONSTANT(CURLOPT_NOPROGRESS); + REGISTER_CURL_CONSTANT(CURLOPT_PROGRESSFUNCTION); REGISTER_CURL_CONSTANT(CURLOPT_NOBODY); REGISTER_CURL_CONSTANT(CURLOPT_FAILONERROR); REGISTER_CURL_CONSTANT(CURLOPT_UPLOAD); @@ -777,6 +778,80 @@ } /* }}} */ +/* {{{ curl_progress + */ +static size_t curl_progress(void *clientp, +double dltotal, +double dlnow, +double ultotal, +double ulnow) +{ + php_curl *ch = (php_curl *) clientp; + php_curl_progress *t = ch->handlers->progress; + int length = -1; + +#if PHP_CURL_DEBUG + fprintf(stderr, "curl_progress() called\n"); + fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); +#endif + + switch (t->method) { + case PHP_CURL_USER: { + zval **argv[4]; + zval *zdltotal = NULL; + zval *zdlnow = NULL; + zval *zultotal = NULL; + zval *zulnow = NULL; + zval *retval_ptr; + int error; + zend_fcall_info fci; + TSRMLS_FETCH_FROM_CTX(ch->thread_ctx); + + MAKE_STD_ZVAL(zdltotal); + MAKE_STD_ZVAL(zdlnow); + MAKE_STD_ZVAL(zultotal); + MAKE_STD_ZVAL(zulnow); + + ZVAL_LONG(zdltotal, dltotal); + ZVAL_LONG(zdlnow, dlnow); + ZVAL_LONG(zultotal, ultotal); + ZVAL_LONG(zulnow, ulnow); + + argv[0] = &zdltotal; + argv[1] = &zdlnow; + argv[2] = &zultotal; + argv[3] = &zulnow; + + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = t->func_name; + fci.object_pp = NULL; + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 3; + fci.params = argv; + fci.no_separation = 0; + fci.symbol_table = NULL; + + ch->in_callback = 1; + error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC); + ch->in_callback = 0; + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); + length = -1; + } + + zval_ptr_dtor(argv[0]); + zval_ptr_dtor(argv[1]); + zval_ptr_dtor(argv[2]); + zval_ptr_dtor(argv[3]); + break; + } + } + return 0; +} +/* }}} */ + + /* {{{ curl_read */ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) @@ -1065,6 +1140,7 @@ (*ch)->handlers->write= ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write)); (*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read)); + (*ch)->handlers->progress = ecalloc(1, sizeof(php_curl_progress)); (*ch)->in_callback = 0; (*ch)->header.str_len = 0; @@ -1418,6 +1494,17 @@ ch->handlers->read->func_name = *zvalue; ch->handlers->read->method = PHP_CURL_USER; break; + case CURLOPT_PROGRESSFUNCTION: + curl_easy_setopt(ch->cp, CURLOPT_PROGRESSFUNCTION, curl_progress); + curl_easy_setopt(ch->cp, CURLOPT_PROGRESSDATA, ch); + if (ch->handlers->progress->func_name) { +
#41712 [NEW]: [PATCH] Add CURL Progress Function Callback
From: sdteffen at gmail dot com Operating system: SuSE Linux 10.2 PHP version: 5CVS-2007-06-16 (CVS) PHP Bug Type: cURL related Bug description: [PATCH] Add CURL Progress Function Callback Description: The current PHP version does not allow to use the CURL progress function callback (CURL_PROGRESSFUNCTION). Reproduce code: --- http://www.php.net";); $fp = fopen("index.html", "w"); function curl_progress_callback($a=0,$b=0,$c=0, $d=0) { echo "curl_progress_callback($a,$b,$c,$d)\n"; } curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOPROGRESS, false); curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'curl_progress_callback'); curl_exec($ch); echo curl_close($ch); fclose($fp); ?> Expected result: curl_progress_callback(0,1054,0,0) curl_progress_callback(0,35131,0,0) Actual result: -- % Total% Received % Xferd Average Speed TimeTime Time Current Dload Upload Total SpentLeft Speed 100 351310 351310 0 32344 0 --:--:-- 0:00:01 --:--:-- 52105 -- Edit bug report at http://bugs.php.net/?id=41712&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41712&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41712&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41712&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41712&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41712&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41712&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=41712&r=needscript Try newer version:http://bugs.php.net/fix.php?id=41712&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41712&r=support Expected behavior:http://bugs.php.net/fix.php?id=41712&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41712&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41712&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41712&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41712&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41712&r=dst IIS Stability:http://bugs.php.net/fix.php?id=41712&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41712&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41712&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41712&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=41712&r=mysqlcfg
#31980 [Csd]: Unable to Extract Windows XP EXIF Information
ID: 31980 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Closed Bug Type: EXIF related Operating System: win32 only PHP Version: 4CVS, 5CVS (2005-02-15) Assigned To: edink New Comment: Thanks for the quick fix. However, it looks like php_exif.dll is missing from the snapshot zip file. I checked http://snaps.php.net/win32/php4-win32-STABLE-200502161330.zip and http://snaps.php.net/win32/PECL_STABLE/ Previous Comments: [2005-02-16 11:00:26] [EMAIL PROTECTED] This bug has been fixed in CVS. 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/. Thank you for the report, and for helping us make PHP better. [2005-02-15 13:52:58] [EMAIL PROTECTED] Assigning to our win32 build guru.. [2005-02-15 13:48:00] [EMAIL PROTECTED] Nevermind, in windows the EXIF module isn't compiled with MBSTRING support. [2005-02-15 12:22:01] sdteffen at gmail dot com Thanks for the comments. I've updated my code according to Pierre's suggestion: ini_set('exif.decode_unicode_intel', 'UCS-2LE'); ini_set('exif.encode_unicode','ISO-8859-1'); ini_set('exif.encode_jis','ISO-8859-1'); ini_set('exif.decode_jis_intel','ISO-8859-1'); $arrComment = exif_read_data('1.jpg', 'WINXP', true); The problem still exists (Only first letter is returned). Here's the example file: http://sdteffen.de/1.jpg [2005-02-15 10:19:19] [EMAIL PROTECTED] > The constant EXIF_USE_MBSTRING is 0 - isn't this a > contradiction with the PHP Manual that says > "Windows users must also have the mbstring > extension enabled"? Loading the mbstring extension is one of the requirement, another is to specify the encoding (See http://de.php.net/exif) using either php.ini or ini_set. If the problem remains, please provide a link to the image as requested by Sniper. --Pierre The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31980 -- Edit this bug report at http://bugs.php.net/?id=31980&edit=1
#31980 [Fbk->Opn]: Unable to Extract Windows XP EXIF Information
ID: 31980 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com -Status: Feedback +Status: Open Bug Type: EXIF related Operating System: Windows XP PHP Version: 4.3.10 New Comment: Thanks for the comments. I've updated my code according to Pierre's suggestion: ini_set('exif.decode_unicode_intel', 'UCS-2LE'); ini_set('exif.encode_unicode','ISO-8859-1'); ini_set('exif.encode_jis','ISO-8859-1'); ini_set('exif.decode_jis_intel','ISO-8859-1'); $arrComment = exif_read_data('1.jpg', 'WINXP', true); The problem still exists (Only first letter is returned). Here's the example file: http://sdteffen.de/1.jpg Previous Comments: [2005-02-15 10:19:19] [EMAIL PROTECTED] > The constant EXIF_USE_MBSTRING is 0 - isn't this a > contradiction with the PHP Manual that says > "Windows users must also have the mbstring > extension enabled"? Loading the mbstring extension is one of the requirement, another is to specify the encoding (See http://de.php.net/exif) using either php.ini or ini_set. If the problem remains, please provide a link to the image as requested by Sniper. --Pierre [2005-02-15 10:11:26] [EMAIL PROTECTED] Put that image file somewhere where we can download it and try ourselves. [2005-02-15 07:47:36] sdteffen at gmail dot com Description: I'm trying to extract EXIF information created by the Windows XP Explorer (In particular the Comments field). Dumping the array created by exif_read_data('c:\test.jpg','WINXP',true); includes the following result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } The problem is that the comment is not only the letter "G", but a full sentence (starting with G). Apparently, the comment is UNICODE (UCS-2?). I tried to use mb_string (Loading php_mbstring.dll before php_exif.dll like outlined in the PHP manual) without success. The constant EXIF_USE_MBSTRING is 0 - isn't this a contradiction with the PHP Manual that says "Windows users must also have the mbstring extension enabled"? If this is not a bug, please consider it as a request to enhance the PHP Manual with a small example showing the necessary php.ini configurations to use in conjuction with Windows XP Explorer EXIF comments. Windows Explorer is the most convenient application for our users to add EXIF comments. PHP 4.3.10 Zipfile distribution, using the CGI (php.exe). Reproduce code: --- exif_read_data('c:\test.jpg','WINXP',true); Expected result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } Actual result: -- ["WINXP"]=> array(1) { ["Comments"]=> string(1) "Generator and pump" } -- Edit this bug report at http://bugs.php.net/?id=31980&edit=1
#31980 [Opn]: Unable to Extract Windows XP EXIF Information
ID: 31980 User updated by: sdteffen at gmail dot com Reported By: sdteffen at gmail dot com Status: Open Bug Type: EXIF related Operating System: Windows XP PHP Version: 4.3.10 New Comment: I just noticed that I mixed up "Expected Result" and "Actual Result". It's just the other way round. Sorry for the confusion. Previous Comments: ---- [2005-02-15 12:22:01] sdteffen at gmail dot com Thanks for the comments. I've updated my code according to Pierre's suggestion: ini_set('exif.decode_unicode_intel', 'UCS-2LE'); ini_set('exif.encode_unicode','ISO-8859-1'); ini_set('exif.encode_jis','ISO-8859-1'); ini_set('exif.decode_jis_intel','ISO-8859-1'); $arrComment = exif_read_data('1.jpg', 'WINXP', true); The problem still exists (Only first letter is returned). Here's the example file: http://sdteffen.de/1.jpg [2005-02-15 10:19:19] [EMAIL PROTECTED] > The constant EXIF_USE_MBSTRING is 0 - isn't this a > contradiction with the PHP Manual that says > "Windows users must also have the mbstring > extension enabled"? Loading the mbstring extension is one of the requirement, another is to specify the encoding (See http://de.php.net/exif) using either php.ini or ini_set. If the problem remains, please provide a link to the image as requested by Sniper. --Pierre [2005-02-15 10:11:26] [EMAIL PROTECTED] Put that image file somewhere where we can download it and try ourselves. [2005-02-15 07:47:36] sdteffen at gmail dot com Description: I'm trying to extract EXIF information created by the Windows XP Explorer (In particular the Comments field). Dumping the array created by exif_read_data('c:\test.jpg','WINXP',true); includes the following result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } The problem is that the comment is not only the letter "G", but a full sentence (starting with G). Apparently, the comment is UNICODE (UCS-2?). I tried to use mb_string (Loading php_mbstring.dll before php_exif.dll like outlined in the PHP manual) without success. The constant EXIF_USE_MBSTRING is 0 - isn't this a contradiction with the PHP Manual that says "Windows users must also have the mbstring extension enabled"? If this is not a bug, please consider it as a request to enhance the PHP Manual with a small example showing the necessary php.ini configurations to use in conjuction with Windows XP Explorer EXIF comments. Windows Explorer is the most convenient application for our users to add EXIF comments. PHP 4.3.10 Zipfile distribution, using the CGI (php.exe). Reproduce code: --- exif_read_data('c:\test.jpg','WINXP',true); Expected result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } Actual result: -- ["WINXP"]=> array(1) { ["Comments"]=> string(1) "Generator and pump" } -- Edit this bug report at http://bugs.php.net/?id=31980&edit=1
#31980 [NEW]: Unable to Extract Windows XP EXIF Information
From: sdteffen at gmail dot com Operating system: Windows XP PHP version: 4.3.10 PHP Bug Type: EXIF related Bug description: Unable to Extract Windows XP EXIF Information Description: I'm trying to extract EXIF information created by the Windows XP Explorer (In particular the Comments field). Dumping the array created by exif_read_data('c:\test.jpg','WINXP',true); includes the following result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } The problem is that the comment is not only the letter "G", but a full sentence (starting with G). Apparently, the comment is UNICODE (UCS-2?). I tried to use mb_string (Loading php_mbstring.dll before php_exif.dll like outlined in the PHP manual) without success. The constant EXIF_USE_MBSTRING is 0 - isn't this a contradiction with the PHP Manual that says "Windows users must also have the mbstring extension enabled"? If this is not a bug, please consider it as a request to enhance the PHP Manual with a small example showing the necessary php.ini configurations to use in conjuction with Windows XP Explorer EXIF comments. Windows Explorer is the most convenient application for our users to add EXIF comments. PHP 4.3.10 Zipfile distribution, using the CGI (php.exe). Reproduce code: --- exif_read_data('c:\test.jpg','WINXP',true); Expected result: ["WINXP"]=> array(1) { ["Comments"]=> string(1) "G" } Actual result: -- ["WINXP"]=> array(1) { ["Comments"]=> string(1) "Generator and pump" } -- Edit bug report at http://bugs.php.net/?id=31980&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31980&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31980&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31980&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=31980&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=31980&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31980&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31980&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31980&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31980&r=support Expected behavior: http://bugs.php.net/fix.php?id=31980&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31980&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31980&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=31980&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31980&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=31980&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31980&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31980&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31980&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31980&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31980&r=mysqlcfg