Change error-handling from exceptions to returning a boolean#383
Change error-handling from exceptions to returning a boolean#383annexus254 wants to merge 5 commits intophpmyadmin:masterfrom
Conversation
In case an error occurs during loading of a context, let the Context::load() method return a boolean value indicating whether the context was successfully loaded or not. Throwing an Exception causes a false positive in debuggers,since the Context::load() method does the correct thing anyway
In case an error occurs during loading of a context, let the Context::load() method return a boolean value indicating whether the context was successfully loaded or not. Throwing an Exception causes a false positive in debuggers,since the Context::load() method does the correct thing anyway
Resolve Merge Conflict caused by ./vendor/bin/phpcbf
|
|
||
| if (isset(static::$KEYWORDS[$str])) { | ||
| if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { | ||
| if ($isReserved && !(static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
There was a problem hiding this comment.
| if ($isReserved && !(static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { | |
| if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
| public static function isOperator($str) | ||
| { | ||
| if (! isset(static::$OPERATORS[$str])) { | ||
| if (!isset(static::$OPERATORS[$str])) { |
There was a problem hiding this comment.
| if (!isset(static::$OPERATORS[$str])) { | |
| if (! isset(static::$OPERATORS[$str])) { |
| } | ||
|
|
||
| if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (! static::isKeyword($str, true))) { | ||
| if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (!static::isKeyword($str, true))) { |
There was a problem hiding this comment.
| if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (!static::isKeyword($str, true))) { | |
| if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (! static::isKeyword($str, true))) { |
williamdes
left a comment
There was a problem hiding this comment.
This looks good, can you squash the commits and also delete the LoaderException class file ?
|
By the way because this PR is open using your |
Sure, the important commits are now present on the exceptionRemoval branch
Done. The new branch is exceptionRemoval and is based off of the main branch. |
Thanks ! |
|
Duplicate of #384 |
When loading the Database Context using the Context::load() method, throwing a LoaderException triggers most, if not all debuggers e.g. Xdebug. However, this is a false positive since the caller of the Context::load() method catches the exception thrown and takes the necessary action which is to attempt and load the next closest context.
Hence I think it is more apt for Context::load() method to return a boolean indicating a success or failure, in order to deal with this problem of debuggers being falsely triggered.