Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2022-09-11 20:55:11 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-09-11 20:55:11 +0300
commit329eb3511c53e60d6ca04eed52efca5f5e3fb76d (patch)
treed9da4686c495f3a2e65e0e1d61318040c1a85fb9 /libraries/classes
parentb79b9e37a0b1f25a724d682a0765b58b6a1aea5c (diff)
Inline $isProcOrFunc variable in Routines::handleRequestCreateOrEdit
Improves type inference of item_original_type POST param Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries/classes')
-rw-r--r--libraries/classes/Database/Routines.php20
1 files changed, 6 insertions, 14 deletions
diff --git a/libraries/classes/Database/Routines.php b/libraries/classes/Database/Routines.php
index 729bcc1492..2f471d73cd 100644
--- a/libraries/classes/Database/Routines.php
+++ b/libraries/classes/Database/Routines.php
@@ -196,26 +196,18 @@ class Routines
if (! count($errors)) {
// Execute the created query
if (! empty($_POST['editor_process_edit'])) {
- $isProcOrFunc = in_array(
- $_POST['item_original_type'],
- [
- 'PROCEDURE',
- 'FUNCTION',
- ]
- );
-
- if (! $isProcOrFunc) {
+ if (! in_array($_POST['item_original_type'], ['PROCEDURE', 'FUNCTION'], true)) {
$errors[] = sprintf(
__('Invalid routine type: "%s"'),
htmlspecialchars($_POST['item_original_type'])
);
} else {
// Backup the old routine, in case something goes wrong
- $create_routine = $this->dbi->getDefinition(
- $db,
- $_POST['item_original_type'],
- $_POST['item_original_name']
- );
+ if ($_POST['item_original_type'] === 'FUNCTION') {
+ $create_routine = $this->dbi->getDefinition($db, 'FUNCTION', $_POST['item_original_name']);
+ } else {
+ $create_routine = $this->dbi->getDefinition($db, 'PROCEDURE', $_POST['item_original_name']);
+ }
$privilegesBackup = $this->backupPrivileges();