diff options
author | Michal Čihař <michal@cihar.com> | 2016-04-06 15:59:28 +0200 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-04-06 15:59:28 +0200 |
commit | 8de4749d803858859fcf7a39b1bbf058745920f0 (patch) | |
tree | 4b8cb5f98fac792083bc57a2dad9a9e72b5cacb4 | |
parent | ec788810957bb91c7ae2655fb8361a49aa82f9db (diff) | |
download | sql-parser-8de4749d803858859fcf7a39b1bbf058745920f0.zip sql-parser-8de4749d803858859fcf7a39b1bbf058745920f0.tar.gz sql-parser-8de4749d803858859fcf7a39b1bbf058745920f0.tar.bz2 |
Correctly compare for empty string
The empty('0') returns true, so we need to be careful when handling
expressions in strings.
Fixes https://github.com/phpmyadmin/phpmyadmin/issues/12165
Signed-off-by: Michal Čihař <michal@cihar.com>
-rw-r--r-- | src/Components/Expression.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Components/Expression.php b/src/Components/Expression.php index 8a83584..ab855f6 100644 --- a/src/Components/Expression.php +++ b/src/Components/Expression.php @@ -396,7 +396,7 @@ class Expression extends Component // White-spaces might be added at the end. $ret->expr = trim($ret->expr); - if (empty($ret->expr)) { + if ($ret->expr === '') { return null; } @@ -415,7 +415,7 @@ class Expression extends Component if (is_array($component)) { return implode($component, ', '); } else { - if (!empty($component->expr)) { + if ($component->expr !== '' && !is_null($component->expr)) { $ret = $component->expr; } else { $fields = array(); |