Download & Extend

mm_s3 calls dl() in hook_requirements, dl() is disabled in PHP 5.3

Project:Media Mover
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

(This is also an issue for 6.x-2.x-dev, but you can only select one release)

On line 8 of media_mover/contrib/mm_s3/mm_s3.install, there's the following check:

<?php
  
if (extension_loaded('curl') && !@dl(PHP_SHLIB_SUFFIX == 'so' ? 'curl.so' : 'php_curl.dll')) { $has_curl = true; }
?>

This causes a particularly nasty WSOD in PHP 5.3: dl() is deprecated, and in many installs, completely missing. The error suppression on dl() causes a silent WSOD with no errors anywhere.

I'm not sure why mm_s3 even calls dl(): shouldn't extension_loaded('curl') be sufficient? Attached are two patches (one for 6.x-1.x-dev and one for 6.x-2.x-dev) that removes the dl() call and rewrites the check to conform to Drupal coding standards.

AttachmentSize
mm_s3-php53-drupal-6--1.patch898 bytes
mm_s3-php53-drupal-6--2.patch894 bytes

Comments

#1

Title:mm_s3 calls dl() in hook_requirements, dl() is removed in PHP 5.3» mm_s3 calls dl() in hook_requirements, dl() is disabled in PHP 5.3

Update to more accurate title. It's not actually removed, it's just disabled unless explicitly enabled except for certain SAPIs.

According to the Changelog, it was deprecated and disabled for stability issues, and the recommended workaround is to use extension loading directives instead of dynamically loading an extension at runtime: http://php.net/manual/en/function.dl.php

#2

One last comment, I swear. Now that dl() is removed, there's no need to perform logic on extension_loaded: it returns TRUE or FALSE. Rerolled patches.

AttachmentSize
mm_s3-php53-drupal-6--1.patch 883 bytes
mm_s3-php53-drupal-6--2.patch 879 bytes

#3

Sorry I'm going to add my two cents and include the use of get_t() function as specified in the hook_requirements API.

Hopefully this can be added to DEV soonish as I didn't see your issue before I started investigating the cause!

AttachmentSize
mm_s3_6.x-1-dev.install.patch 1.64 KB

#4

I committed a slightly different version of these patches. Please let me know if it works for you

#5

Running PHP 5.3 and tried the Oct 20, 2010 Dev release. Still get a WSOD when saving S3 settings.

#6

Status:needs review» needs work

Guess I should change the status?

#7

Status:needs work» active

@mjvesper can you provide the actual error you're getting?

#8

There is no error reported. I fill out the S3 form and save then it fails silently with a WSOD with no errors anywhere as the OP described.

#9

Did you check your php error log?

#10

Sorry, had to reinstall Media Mover and get a fresh message. This is from the Apache error log for the latest dev while saving the mm_s3 settings:

[Sat Nov 20 13:29:23 2010] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to undefined method S3::checkKeys() in /home/[path]/sites/all/modules/media_mover/contrib/mm_s3/mm_s3.module on line 141, referer: https://[path]/admin/build/media_mover/settings/mm_s3

So not dl() I guess, but still a WSOD.

#11

Status:active» needs review

@mjvesper I removed the dl from the class check function. Feel free to give the dev version a try

#12

Thanks arthurf. Looking forward to giving it a retry. This module has a lot of potential.

nobody click here