|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-08-18 20:37 UTC] franck dot tab at gmail dot com
Description: ------------ filename containing spaces are truncated. Important note: only php function uploadprogress_get_info return bad information. Seem's the temporary file created while uploading contain the good informations. In my test here is my tmp file: upload_id=974489 fieldname=fichier_video filename=C:\Documents and Settings\franck\Bureau\taf\tevasia\1and1\video\Kumar.flv time_start=1219105999 time_last=1219106351 speed_average=49492 speed_last=51190 bytes_uploaded=17421484 bytes_total=28610177 files_uploaded=0 est_sec=226 Reproduce code: --------------- Just upload a file from a Windows XP and, while uploading, take a look at what uploadprogress_get_info() return : $infos=uploadprogress_get_info($id); $filename=$infos['filename'); echo $filename; Expected result: ---------------- C:\Documents and Settings\franck\Bureau\taf\tevasia\1and1\video\Kumar.flv Actual result: -------------- C:\Documents PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 23:00:01 2025 UTC |
The bug is when spaces are cleaned from the tmp file, line 393: for (e=v; *e; e++) if (*e <= 32) { *e = 0; break; } I'm not a C developper, but i'll try to find help and submit a patch. I have to take a look at chop() and trim() php function perhaps.Fixed with this the patch, any feedback will be appreciated: 381c381 < char *k, *v, *e; --- > char *k, *v, *e, *z; 392,393c392 < for (e=k; *e; e++) if (*e <= 32) { *e = 0; break; } < for (e=v; *e; e++) if (*e <= 32) { *e = 0; break; } --- > for (e=k; *e; e++) if (*e <= 32) { *e = 0; break; } 394a394,403 > /* http://pecl.php.net/bugs/bug.php?id=14525 */ > // for (e=v; *e; e++) if (*e <= 32) { *e = 0; break; } > > if (v != NULL) { > *z = v[strlen(v)]; > while (*z == ' ') { > *z = 0; > z--; > } > }Here is the good one : 383a384 > int index = 0; 389c390 < /* trim spaces in front and after the name/value */ --- > /* trim spaces in front of the name/value */ 391a393,394 > > /* trim spaces everywhere in the name */ 393d395 < for (e=v; *e; e++) if (*e <= 32) { *e = 0; break; } 394a397,407 > /* trim spaces only at the end of the value */ > > /* http://pecl.php.net/bugs/bug.php?id=14525 */ > //for (e=v; *e; e++) if (*e <= 32) { *e = 0; break; } > > if (v != NULL) { > for (index = strlen(v); index > 0; index--) { > if (v[index] > 32) break; > v[index] = 0; > } > } Thanks to matthieu estrade and myself :)