Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I ran the Upload user picture test locally when debugging another issue, and it failed consistently with a fatal error.
Asked in #drupal-contribute, both Heine and swentel ran the test. Heine's failed (on 5.3), swentel's passed (on 5.2). So this looks like a failure specific to PHP 5.3.
Haven't tried to debug why it's failing yet.
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedOur test bots run PHP 5.3, so I doubt this is PHP 5.3 specific.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedTest bot results on PHP 5.3:
Comment #3
catchHmm, maybe the sample was too small.
This is the error both me and Heine got (except I'm not on windows):
" Fatal error: Call to a member function getDirectoryPath() on a non-object in C:\www\core7\modules\image\image.module on line 808"
This is because NULL is getting passed into image_style_url() from user.test itself.
Comment #4
catchGrrr, so i had a clean install except for settings.php, which is months old by now, and guess which variable was hardcoded in there:
$conf['user_pictures'] = 0;
Yet another reason to use drush vset. Sorry for the false alarm.
However, unless Heine has the same variable set, that doesn't at all explain why this test failed on his machine, so we should keep this open a bit longer.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis test works on my Windows test environments too. Not sure what happens here.
Comment #6
Heine CreditAttribution: Heine commentedThis is related to the use of
C:\Windows\Temp
as upload_tmp_dir. IIS_USR doesn't have sufficient rights statting files causing the drupal_realpath->realpath() call in image_gd_get_info's getimagesize() to return FALSE.In the case of a test, this also prevents building the stream URL, thus later causing the message on getDirectoryPath().
I don't think this is a bug. Leaving open for eyeballs.
Comment #7
Heine CreditAttribution: Heine commentedComment #8
Heine CreditAttribution: Heine commentedThis might be a PHP issue/bug: http://bugs.php.net/bug.php?id=54110
Comment #9
droplet CreditAttribution: droplet commentedduplicated issue ?
#1019470: file_directory_temp() fails to set valid temporary directory on Windows
Comment #10
Heine CreditAttribution: Heine commentedNo, #1019470: file_directory_temp() fails to set valid temporary directory on Windows is about setting the Drupal temporary directory for tmp://, this issue is about upload_tmp_dir in PHP where uploaded files are stored before they are handled by Drupal and on which realpath causes issues.
Comment #11
KarlSheaIUSR and IIS_IUSRS both need read/write access to that folder.
Comment #12
teddyboar CreditAttribution: teddyboar commentedStill the same issues after adding IUSR and IIS_IUSRS with full control. Same even after adding Everyone with full control. Cannot upload any user picture at all atm even if I put upload_tmp_dir inside or outside the www root, or disabling upload_tmp_dir in php.ini, or giving any permission anywhere.
One strange thing; if I try to upload a picture via image fields to a basic page for example, it works. So in general, permissions should be ok, picture formats should be ok (tried a self created png and a heavily customized jpg).
This is what I get at the user pic upload:
I have everything on localhost, so feel free to ask me to do any testing (if any needed).
Specs: Drupal7.2, Windows 7 x64 SP1, IIS7.5, PHP5.3.6
Comment #13
marco68 CreditAttribution: marco68 commentedI also have exactly the same issue of teddyboar, and also exactly the same specs.
Comment #14
teddyboar CreditAttribution: teddyboar commentedOk now I have some weird results after done some testing:
-Under Debian with php5.3 the very same picture is working out of box, so non-php-bug confirmed and also no problem with the picture.
-Under IIS I set php.ini's upload_temp_dir to C:\tmp2, but the function realpath(sys_get_temp_dir()) pops up C:\Windows\Temp. Maybe something else configures back to that? No idea atm.
Update: Stupid Web Platform Installer (WebPI) tampered this back, so beware and check for it! Anyway, realpath(sys_get_temp_dir()) still shows C:\Windows\Temp, but the error messages disappeared! Kind of confusion..
-In function image_gd_get_info(), right at getimagesize(drupal_realpath($image->source)) the value of image->source is C:\Windows\Temp\phpxyz.tmp, but drupal_realpath($image->source) shows empty. That's why the error message tells about empty filename it seems.
-variable_get('file_temporary_path') shows C:\tmp what i set before in filesystem configuration. How is that then now?
Comment #15
Heine CreditAttribution: Heine commentedSee #10 - this is a PHP setting where files go before they are handled by Drupal.
See #6 for realpath, which return FALSE.
Comment #16
Heine CreditAttribution: Heine commentedHere's a procmon trace (only where access is denied) for those interested:
This is clearly a server configuration issue hence a won't fix.
Some quick options for local dev sites:
Better option (for production): get to know more about best practices and reach out to MS on http://groups.drupal.org/drupal-windows.
Comment #17
tomlichaj CreditAttribution: tomlichaj commentedTry adding IIS_WPG with read/write access to the temp folder.
I had a similar permission issue with uploads on IIS 7 and my temp directory on the test server was C:\windows\temp, after adding IIS_WPG to it with those permissions everything worked as expected.