From: Bharat M. <bh...@us...> - 2004-02-23 00:48:28
|
Update of /cvsroot/gallery/gallery2/modules/core/test/phpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4875/modules/core/test/phpunit Modified Files: UtilitiesTest.class Log Message: Fix uploads on Windows. The bug was that on Windows, the backslashes in temporary file names were being stripslash()'d. Turns out that we were looking for the wrong format in $_FILES in the unit test. Updated the unit test to reproduce the failure and then fixed it by adding slashes to the temp file name so that the unilateral stripslash() call later would not get rid of the slash altogether. Index: UtilitiesTest.class =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/core/test/phpunit/UtilitiesTest.class,v retrieving revision 1.25 retrieving revision 1.26 diff -w -u -r1.25 -r1.26 --- UtilitiesTest.class 16 Feb 2004 08:10:43 -0000 1.25 +++ UtilitiesTest.class 23 Feb 2004 00:35:02 -0000 1.26 @@ -112,23 +112,19 @@ } function testGetFormVariables2() { - $tmp_name = 'c:/apache/tmp\\php195.tmp'; - if (get_magic_quotes_gpc()) { - $tmp_name = addslashes($tmp_name); - } + /* Test windows and unix style tmp names */ $_FILES[GALLERY_FORM_VARIABLE_PREFIX . 'utilitiestest'] = - array('fileupload' => array('name' => 'DSCF0001.JPG', - 'type' => 'image/pjpeg', - 'tmp_name' => $tmp_name, - 'error' => 0, - 'size' => 1779802)); - - $this->assertEquals(array('fileupload' => - array('name' => 'DSCF0001.JPG', - 'type' => 'image/pjpeg', - 'tmp_name' => 'c:/apache/tmp\php195.tmp', - 'error' => 0, - 'size' => 1779802)), + array('name' => array('1' => 'DSCF0001.JPG', 'DSCF0002.GIF', null, null), + 'type' => array('1' => 'image/pjpeg', 'image/gif', null, null), + 'tmp_name' => array('1' => 'c:\apache\tmp\php195.tmp', '/tmp/php195.tmp', null, null), + 'error' => array('1' => 0, 0, 4, 4), + 'size' => array('1' => 1779802, 102323, 0, 0)); + + $this->assertEquals(array('name' => array('1' => 'DSCF0001.JPG', 'DSCF0002.GIF', null, null), + 'type' => array('1' => 'image/pjpeg', 'image/gif', null, null), + 'tmp_name' => array('1' => 'c:\apache\tmp\php195.tmp', '/tmp/php195.tmp', null, null), + 'error' => array('1' => 0, 0, 4, 4), + 'size' => array('1' => 1779802, 102323, 0, 0)), GalleryUtilities::getFormVariables('utilitiestest')); } @@ -522,7 +518,7 @@ } function file_exists($path) { - switch($path) { + switch(realpath($path)) { case __FILE__: case realpath(dirname(__FILE__) . '/../../classes/GalleryAlbumItem.class'): return true; |