bug #3026400 [PHP] ereg functions are deprecated

This commit is contained in:
Marc Delisle
2010-07-08 07:49:11 -04:00
parent 104b0ee99a
commit 20d4c3a894
3 changed files with 16 additions and 15 deletions

View File

@@ -14,6 +14,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug [js] Avoid loading twice a js file - bug [js] Avoid loading twice a js file
- bug #3024344 [setup] Setup forces numeric MemoryLimit - bug #3024344 [setup] Setup forces numeric MemoryLimit
- bug #3025975 [auth] Odd LoginCookieValidity default value - bug #3025975 [auth] Odd LoginCookieValidity default value
- bug #3026400 [PHP] ereg functions are deprecated
3.3.4.0 (2010-06-28) 3.3.4.0 (2010-06-28)
- bug #2996161 [import] properly escape import value - bug #2996161 [import] properly escape import value

View File

@@ -349,26 +349,26 @@ foreach ($tables as $keyname => $each_table) {
$ignored = false; $ignored = false;
$do = false; $do = false;
if ($server_slave_status) { if ($server_slave_status) {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
if ((strlen(array_search($truename, $server_slave_Do_Table)) > 0) if ((strlen(array_search($truename, $server_slave_Do_Table)) > 0)
|| (strlen(array_search($db, $server_slave_Do_DB))>0) || (strlen(array_search($db, $server_slave_Do_DB)) > 0)
|| (count($server_slave_Do_DB)==1 && count($server_slave_Ignore_DB)==1) || (count($server_slave_Do_DB) == 1 && count($server_slave_Ignore_DB) == 1)
) { ) {
$do = true; $do = true;
} }
foreach ($server_slave_Wild_Do_Table as $table) { foreach ($server_slave_Wild_Do_Table as $table) {
if (($db == PMA_replication_strout($table)) && (ereg("^".substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true))-1), $truename))) if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename)))
$do = true; $do = true;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
if ((strlen(array_search($truename, $server_slave_Ignore_Table))>0) || (strlen(array_search($db, $server_slave_Ignore_DB))>0)) { if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0)) {
$ignored = true; $ignored = true;
} }
foreach ($server_slave_Wild_Ignore_Table as $table) { foreach ($server_slave_Wild_Ignore_Table as $table) {
if (($db == PMA_replication_strout($table)) && (ereg("^".substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true))-1), $truename))) if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename)))
$ignored = true; $ignored = true;
} }
}/* elseif ($server_master_status) { }/* elseif ($server_master_status) {

View File

@@ -840,8 +840,8 @@ $import_notice = NULL;
* @uses SIZES * @uses SIZES
* @uses strcmp() * @uses strcmp()
* @uses count() * @uses count()
* @uses ereg() * @uses preg_match()
* @uses ereg_replace() * @uses preg_replace()
* @uses PMA_isView() * @uses PMA_isView()
* @uses PMA_backquote() * @uses PMA_backquote()
* @uses PMA_importRunQuery() * @uses PMA_importRunQuery()
@@ -912,17 +912,17 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
* *
* $pattern = 'CREATE (TABLE|VIEW|TRIGGER|FUNCTION|PROCEDURE)'; * $pattern = 'CREATE (TABLE|VIEW|TRIGGER|FUNCTION|PROCEDURE)';
*/ */
$pattern = 'CREATE .*(TABLE)'; $pattern = '/CREATE .*(TABLE)/';
$replacement = 'CREATE \\1 IF NOT EXISTS'; $replacement = 'CREATE \\1 IF NOT EXISTS';
/* Change CREATE statements to CREATE IF NOT EXISTS to support inserting into existing structures */ /* Change CREATE statements to CREATE IF NOT EXISTS to support inserting into existing structures */
for ($i = 0; $i < $additional_sql_len; ++$i) { for ($i = 0; $i < $additional_sql_len; ++$i) {
$additional_sql[$i] = ereg_replace($pattern, $replacement, $additional_sql[$i]); $additional_sql[$i] = preg_replace($pattern, $replacement, $additional_sql[$i]);
/* Execute the resulting statements */ /* Execute the resulting statements */
PMA_importRunQuery($additional_sql[$i], $additional_sql[$i]); PMA_importRunQuery($additional_sql[$i], $additional_sql[$i]);
} }
} }
if ($analyses != NULL) { if ($analyses != NULL) {
$type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal"); $type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal");
@@ -1047,8 +1047,8 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
/* Add the viewable structures from $additional_sql to $tables so they are also displayed */ /* Add the viewable structures from $additional_sql to $tables so they are also displayed */
$view_pattern = 'VIEW `[^`]+`\.`([^`]+)'; $view_pattern = '@VIEW `[^`]+`\.`([^`]+)@';
$table_pattern = 'CREATE TABLE IF NOT EXISTS `([^`]+)`'; $table_pattern = '@CREATE TABLE IF NOT EXISTS `([^`]+)`@';
/* Check a third pattern to make sure its not a "USE `db_name`;" statement */ /* Check a third pattern to make sure its not a "USE `db_name`;" statement */
$regs = array(); $regs = array();
@@ -1057,10 +1057,10 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
$additional_sql_len = count($additional_sql); $additional_sql_len = count($additional_sql);
for ($i = 0; $i < $additional_sql_len; ++$i) { for ($i = 0; $i < $additional_sql_len; ++$i) {
ereg($view_pattern, $additional_sql[$i], $regs); preg_match($view_pattern, $additional_sql[$i], $regs);
if (count($regs) == 0) { if (count($regs) == 0) {
ereg($table_pattern, $additional_sql[$i], $regs); preg_match($table_pattern, $additional_sql[$i], $regs);
} }
if (count($regs)) { if (count($regs)) {