diff --git a/ChangeLog b/ChangeLog index f308f029e..3715bb0d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ $Id$ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/ChangeLog $ 3.1.0.0 (not yet released) +- bug #2046883 [core] Notices about deprecated dl() (so stop using it) 3.0.0.0 (not yet released) + [export] properly handle line breaks for YAML, thanks to Dan Barry - diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 39a79eaec..3c9f0a944 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -200,9 +200,6 @@ class PMA_Config } elseif ($this->get('GD2Available') == 'no') { $this->set('PMA_IS_GD2', 0); } else { - if (!@extension_loaded('gd')) { - PMA_dl('gd'); - } if (!@function_exists('imagecreatetruecolor')) { $this->set('PMA_IS_GD2', 0); } else { @@ -214,7 +211,7 @@ class PMA_Config $this->set('PMA_IS_GD2', 0); } } else { - /* We must do hard way... */ + /* We must do hard way... but almost no chance to execute this */ ob_start(); phpinfo(INFO_MODULES); /* Only modules */ $a = strip_tags(ob_get_contents()); diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 934eade98..bca40de6f 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -14,7 +14,7 @@ if (! defined('PHPMYADMIN')) { require './libraries/auth/swekey/swekey.auth.lib.php'; -if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) { +if (function_exists('mcrypt_encrypt')) { /** * Uses faster mcrypt library if available * (as this is not called from anywhere else, put the code in-line diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index bd405b24c..74bc8b98f 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -18,20 +18,14 @@ if (isset($cfg['AllowAnywhereRecoding']) if ($cfg['RecodingEngine'] == 'recode') { if (!@extension_loaded('recode')) { - PMA_dl('recode'); - if (!@extension_loaded('recode')) { - echo $strCantLoadRecodeIconv; - exit; - } + echo $strCantLoadRecodeIconv; + exit; } $PMA_recoding_engine = 'recode'; } elseif ($cfg['RecodingEngine'] == 'iconv') { if (!@extension_loaded('iconv')) { - PMA_dl('iconv'); - if (!@extension_loaded('iconv')) { - echo $strCantLoadRecodeIconv; - exit; - } + echo $strCantLoadRecodeIconv; + exit; } $PMA_recoding_engine = 'iconv'; } else { @@ -40,18 +34,8 @@ if (isset($cfg['AllowAnywhereRecoding']) } elseif (@extension_loaded('recode')) { $PMA_recoding_engine = 'recode'; } else { - PMA_dl('iconv'); - if (!@extension_loaded('iconv')) { - PMA_dl('recode'); - if (!@extension_loaded('recode')) { - echo $strCantLoadRecodeIconv; - exit; - } else { - $PMA_recoding_engine = 'recode'; - } - } else { - $PMA_recoding_engine = 'iconv'; - } + echo $strCantLoadRecodeIconv; + exit; } } } // end load recode/iconv extension diff --git a/libraries/config.default.php b/libraries/config.default.php index 5f083d815..18b90e573 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -1729,7 +1729,7 @@ $cfg['DefaultCharset'] = 'utf-8'; * Allow character set recoding of MySQL queries, must be also enabled in language * file to make harder using other language files than Unicode. * Default value is false to avoid problems on servers without the iconv - * extension and where dl() is not supported + * extension * * @global boolean $cfg['AllowAnywhereRecoding'] */ @@ -2247,8 +2247,7 @@ $cfg['TempDir'] = ''; /** * Is GD >= 2 available? Set to yes/no/auto. 'auto' does auto-detection, - * which is a bit expensive for PHP < 4.3.0, but it is the only safe way how to - * determine GD version. + * which is the only safe way to determine GD version. * * @global string $cfg['GD2Available'] */ diff --git a/libraries/core.lib.php b/libraries/core.lib.php index c312b16de..daa2ae4da 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -341,71 +341,6 @@ function PMA_get_real_size($size = 0) return $size; } // end function PMA_get_real_size() -/** - * loads php module - * - * @uses PHP_OS - * @uses extension_loaded() - * @uses ini_get() - * @uses function_exists() - * @uses ob_start() - * @uses phpinfo() - * @uses strip_tags() - * @uses ob_get_contents() - * @uses ob_end_clean() - * @uses preg_match() - * @uses strtoupper() - * @uses substr() - * @uses dl() - * @param string $module name if module to load - * @return boolean success loading module - */ -function PMA_dl($module) -{ - static $dl_allowed = null; - - if (extension_loaded($module)) { - return true; - } - - if (null === $dl_allowed) { - if (!@ini_get('safe_mode') - && @ini_get('enable_dl') - && @function_exists('dl')) { - ob_start(); - phpinfo(INFO_GENERAL); /* Only general info */ - $a = strip_tags(ob_get_contents()); - ob_end_clean(); - if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) { - if (preg_match('@Server API[[:space:]]*\(CGI\|CLI\)@', $a)) { - $dl_allowed = true; - } else { - $dl_allowed = false; - } - } else { - $dl_allowed = true; - } - } else { - $dl_allowed = false; - } - } - - if (!$dl_allowed) { - return false; - } - - /* Once we require PHP >= 4.3, we might use PHP_SHLIB_SUFFIX here */ - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $module_file = 'php_' . $module . '.dll'; - } elseif (PHP_OS=='HP-UX') { - $module_file = $module . '.sl'; - } else { - $module_file = $module . '.so'; - } - - return @dl($module_file); -} - /** * merges array recursive like array_merge_recursive() but keyed-values are * always overwritten. diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index c48cf92f8..91ca5ed8c 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -20,17 +20,13 @@ define('PMA_DBI_GETVAR_SESSION', 1); define('PMA_DBI_GETVAR_GLOBAL', 2); /** - * Loads the mysql extensions if it is not loaded yet + * Checks one of the mysql extensions * - * @param string $extension mysql extension to load + * @param string $extension mysql extension to check */ -function PMA_DBI_checkAndLoadMysqlExtension($extension = 'mysql') { +function PMA_DBI_checkMysqlExtension($extension = 'mysql') { if (! function_exists($extension . '_connect')) { - PMA_dl($extension); - // check whether mysql is available - if (! function_exists($extension . '_connect')) { - return false; - } + return false; } return true; @@ -40,14 +36,14 @@ function PMA_DBI_checkAndLoadMysqlExtension($extension = 'mysql') { /** * check for requested extension */ -if (! PMA_DBI_checkAndLoadMysqlExtension($GLOBALS['cfg']['Server']['extension'])) { +if (! PMA_DBI_checkMysqlExtension($GLOBALS['cfg']['Server']['extension'])) { // if it fails try alternative extension ... // and display an error ... /** - * @todo 2.7.1: add different messages for alternativ extension - * and complete fail (no alternativ extension too) + * @todo add different messages for alternative extension + * and complete fail (no alternative extension too) */ $error = sprintf(PMA_sanitize($GLOBALS['strCantLoad']), @@ -62,8 +58,8 @@ if (! PMA_DBI_checkAndLoadMysqlExtension($GLOBALS['cfg']['Server']['extension']) $alternativ_extension = 'mysql'; } - if (! PMA_DBI_checkAndLoadMysqlExtension($alternativ_extension)) { - // if alternativ fails too ... + if (! PMA_DBI_checkMysqlExtension($alternativ_extension)) { + // if alternative fails too ... PMA_fatalError( sprintf($GLOBALS['strCantLoad'], $GLOBALS['cfg']['Server']['extension']) diff --git a/libraries/dbg/setup.php b/libraries/dbg/setup.php index 86a46963a..233172fe7 100644 --- a/libraries/dbg/setup.php +++ b/libraries/dbg/setup.php @@ -8,7 +8,7 @@ if (! defined('PHPMYADMIN')) { } /** - * checks for DBG extension and tries to load if not loaded + * checks for DBG extension * * allways use $GLOBALS here, as this script is included by footer.inc.hp * which can also be included from inside a function @@ -17,7 +17,7 @@ if ($GLOBALS['cfg']['DBG']['php']) { /** * Loads the DBG extension if needed */ - if (! @extension_loaded('dbg') && ! PMA_dl('dbg')) { + if (! @extension_loaded('dbg') ) { $message = PMA_Message::error('strCantLoad'); $message->addParam('DBG'); $message->addMessage('', false); diff --git a/libraries/string.lib.php b/libraries/string.lib.php index 0cfc6a307..6cb2d60e1 100644 --- a/libraries/string.lib.php +++ b/libraries/string.lib.php @@ -13,7 +13,6 @@ * The SQL Parser code relies heavily on these functions. * * @version $Id$ - * @uses PMA_dl() * @uses extension_loaded() * @uses substr() * @uses function_exists() @@ -25,11 +24,6 @@ if (! defined('PHPMYADMIN')) { exit; } -/* Try to load mbstring */ - if (!@extension_loaded('mbstring')) { - PMA_dl('mbstring'); - } - $GLOBALS['PMA_allow_mbstr'] = @function_exists('mb_strlen'); if ($GLOBALS['PMA_allow_mbstr']) { @@ -53,10 +47,6 @@ if (defined('PMA_MULTIBYTE_ENCODING') || $GLOBALS['PMA_allow_mbstr']) { require './libraries/string_native.lib.php'; } -if (!@extension_loaded('ctype')) { - PMA_dl('ctype'); -} - if (@extension_loaded('ctype')) { require './libraries/string_type_ctype.lib.php'; } else { diff --git a/scripts/setup.php b/scripts/setup.php index 62c3f59c0..68412e515 100644 --- a/scripts/setup.php +++ b/scripts/setup.php @@ -13,7 +13,7 @@ * @version $Id$ */ -// Grab phpMyAdmin version and PMA_dl function +// Grab phpMyAdmin version define('PMA_MINIMUM_COMMON', TRUE); define('PMA_SETUP', TRUE); chdir('..'); @@ -1448,12 +1448,6 @@ switch ($action) { } // Guess MySQL extension to use, prefer mysqli - if (!function_exists('mysql_get_client_info')) { - PMA_dl('mysql'); - } - if (!function_exists('mysqli_get_client_info')) { - PMA_dl('mysqli'); - } if (function_exists('mysqli_get_client_info')) { $defaults['extension'] = 'mysqli'; } elseif (function_exists('mysql_get_client_info')) { @@ -1606,17 +1600,7 @@ switch ($action) { } elseif (@extension_loaded('recode')) { $d['RecodingEngine'] = 'recode'; } else { - PMA_dl('iconv'); - if (!@extension_loaded('iconv')) { - PMA_dl('recode'); - if (!@extension_loaded('recode')) { - message('warning', 'Neither recode nor iconv could be loaded so charset conversion will most likely not work.'); - } else { - $d['RecodingEngine'] = 'recode'; - } - } else { - $d['RecodingEngine'] = 'iconv'; - } + message('warning', 'Neither recode nor iconv could be loaded so charset conversion will most likely not work.'); } if (isset($d['RecodingEngine'])) { message('notice', 'Autodetected recoding engine: ' . $d['RecodingEngine']); @@ -1644,10 +1628,7 @@ switch ($action) { case 'feat_extensions': $d = $configuration; if (!@extension_loaded('mbstring')) { - PMA_dl('mbstring'); - } - if (!@extension_loaded('mbstring')) { - message('warning', 'Could not load mbstring extension, which is required for work with multibyte strings like UTF-8 ones. Please consider installing it.'); + message('warning', 'Could not find mbstring extension, which is required for work with multibyte strings like UTF-8 ones. Please consider installing it.'); } if (!isset($d['GD2Available'])) { if (PMA_IS_GD2 == 1) { @@ -1871,7 +1852,6 @@ switch ($action) { break; */ case 'versioncheck': // Check for latest available version - PMA_dl('curl'); $url = 'http://phpmyadmin.net/home_page/version.php'; $data = ''; $f = @fopen($url, 'r');