summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-12 12:11:37 -0800
committerEvan Prodromou <evan@status.net>2010-01-12 12:11:37 -0800
commit392bc728c795dd50e19a56cb097ab9a64f129573 (patch)
treeb81eb9e2f45003859f554978fd1e9534d5f9c9e0
parent7e5c15fa80e23d1fb22744553156bcebad716ae8 (diff)
parentcbc3c7b141b8cfd8baa35a580e9fc9ae4f50343c (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
-rw-r--r--lib/common.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/common.php b/lib/common.php
index 7342c177a..b280afec0 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -45,11 +45,20 @@ define('FOREIGN_FRIEND_RECV', 2);
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
-# To protect against upstream libraries which haven't updated
-# for PHP 5.3 where dl() function may not be present...
+// To protect against upstream libraries which haven't updated
+// for PHP 5.3 where dl() function may not be present...
if (!function_exists('dl')) {
- function dl($library) {
- return false;
+ // function_exists() returns false for things in disable_functions,
+ // but they still exist and we'll die if we try to redefine them.
+ //
+ // Fortunately trying to call the disabled one will only trigger
+ // a warning, not a fatal, so it's safe to leave it for our case.
+ // Callers will be suppressing warnings anyway.
+ $disabled = array_filter(array_map('trim', explode(',', ini_get('disable_functions'))));
+ if (!in_array('dl', $disabled)) {
+ function dl($library) {
+ return false;
+ }
}
}