tempnam() warnings with PHP 7.1

af123

Member
Testing with PHP 7.1, I see lots of errors like the following in my server error log:

Code:
Error Info
ErrorException: tempnam(): file created in the system's temporary directory - library/XenForo/Model/Avatar.php:124
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(8, 'tempnam(): file...', '/data/web/hummy...', 124, Array)
#1 /data/web/hummy.tv/html/forum/library/XenForo/Model/Avatar.php(124): tempnam('/data/web/hummy...', 'xf')
#2 /data/web/hummy.tv/html/forum/library/XenForo/Model/Avatar.php(69): XenForo_Model_Avatar->applyAvatar(734, '/tmp/phpxQaO_Z', 2, 1536, 2048, Array)
#3 /data/web/hummy.tv/html/forum/library/XenForo/ControllerPublic/Account.php(563): XenForo_Model_Avatar->uploadAvatar(Object(XenForo_Upload), 734, Array)
#4 /data/web/hummy.tv/html/forum/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Account->actionAvatarUpload()
#5 /data/web/hummy.tv/html/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /data/web/hummy.tv/html/forum/index.php(13): XenForo_FrontController->run()
#7 {main}

I guess this is due to the new exception handling converting what was an error previously into an exception.
 

Mike

XenForo developer
Staff member
I think this may actually indicate that permissions haven't been set on the internal_data/temp/ directory as expected. Can you confirm whether the web server can write into that directory?
 

af123

Member
That directory doesn't exist in my installation but the parent (internal_data/) is writeable by the web server user.
I don't get the error with PHP 5.6 (and attachment/avatar uploads work fine), just with PHP 7.1.

I'll create that directory and see if it improves things.
 

af123

Member
I recently took over the forum and transferred it to a new host but the temp/ directory definitely isn't in the zip they gave me. Creating the directory resolves the problem though, thanks.
 

Mike

XenForo developer
Staff member
Well at least we know a simple fix. We'll keep an eye out to see if others run into this as they upgrade to PHP 7.1.
 

af123

Member
Thanks, this is just on my test site - I'm not planning to switch production to PHP 7.1 just yet.
The error must have been there with the old PHP version, just didn't trigger an exception before PHP 7.1.
 
Top