Skip to content

Commit

Permalink
Quote delimiter before using preg_replace
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Jun 20, 2016
1 parent 4bcc606 commit 1cc7466
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion import.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
&& is_array($_REQUEST['parameters'])) {
$parameters = $_REQUEST['parameters'];
foreach ($parameters as $parameter => $replacement) {
$quoted = preg_quote($parameter);
$quoted = preg_quote($parameter, '/');
// making sure that :param does not apply values to :param1
$sql_query = preg_replace(
'/' . $quoted . '([^a-zA-Z0-9_])/',
Expand Down
2 changes: 1 addition & 1 deletion libraries/Tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ static public function handleQuery($query)

// Cut off `dbname`. from query
$query = preg_replace(
'/`' . preg_quote($dbname) . '`\s?\./',
'/`' . preg_quote($dbname, '/') . '`\s?\./',
'',
$query
);
Expand Down
2 changes: 1 addition & 1 deletion libraries/plugins/export/ExportSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ public function getTableDef(
*/
if ($view) {
$create_query = preg_replace(
'/' . preg_quote(Util::backquote($db)) . '\./',
'/' . preg_quote(Util::backquote($db), '/') . '\./',
'',
$create_query
);
Expand Down
4 changes: 2 additions & 2 deletions templates/columns_definitions/transformation.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<?php
$checked = isset($columnMeta['Field'])
&& isset($mime_map[$columnMeta['Field']][$type])
&& preg_match('@' . preg_quote($available_mime[$type . '_file'][$mimekey]) . '3?@i',
&& preg_match('@' . preg_quote($available_mime[$type . '_file'][$mimekey], '@') . '3?@i',
$mime_map[$columnMeta['Field']][$type]) ? 'selected ' : '';
$tooltip = PMA_getTransformationDescription(
$available_mime[$type . '_file'][$mimekey]
Expand All @@ -24,4 +24,4 @@
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</select>
2 changes: 1 addition & 1 deletion test/libraries/core/PMA_warnMissingExtension_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function testMissingExtensionFatal()
. '" target="Documentation"><em>' . $ext
. '</em></a> extension is missing. Please check your PHP configuration.';

$this->expectOutputRegex('@' . preg_quote($warn) . '@');
$this->expectOutputRegex('@' . preg_quote($warn, '@') . '@');

PMA_warnMissingExtension($ext, true);
}
Expand Down

0 comments on commit 1cc7466

Please sign in to comment.