# phpmyadmin/phpmyadmin

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context does not exist. #13728

Closed
opened this Issue Oct 11, 2017 · 4 comments

## Comments

Projects
None yet
2 participants

### Steps to reproduce

1. Install a local copy of phpMyAdmin 4.7.4 english (https://files.phpmyadmin.net/phpMyAdmin/4.7.4/phpMyAdmin-4.7.4-english.zip). In my case, it is installed on path S:\xtack\bin\pma\
2. Open phpMyAdmin' main page
3. The Xdebug extension immediately raises 2 errors like this:

PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context ("\PhpMyAdmin\SqlParser\Contexts\ContextMySql50557") does not exist. in S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php on line 460

### Expected behaviour

No such errors detected by Xdebug should occur.

### Actual behaviour

The Xdebug extension immediately raises 2 errors like this:

PhpMyAdmin\SqlParser\Exceptions\LoaderException: Specified context ("\PhpMyAdmin\SqlParser\Contexts\ContextMySql50557") does not exist. in S:\xtack\bin\pma\vendor\phpmyadmin\sql-parser\src\Context.php on line 460

Call Stack
1 | 0.0000 | 377304 | {main}( ) | ...\index.php:0
2 | 0.0000 | 380544 | require_once( 'S:\xtack\bin\pma\libraries\common.inc.php' ) | ...\index.php:20
3 | 0.0312 | 535184 | PhpMyAdmin\SqlParser\Context::loadClosest( ) | ...\common.inc.php:809
4 | 0.0312 | 535184 | PhpMyAdmin\SqlParser\Context::load( ) | ...\Context.php:496

Member

### nijel commented Oct 11, 2017

 Again, what is problem with throwing exception and handing it? The exception is thrown here: https://github.com/phpmyadmin/sql-parser/blob/8ab57e737d634210c0f4dd742880c690bcdde0d0/src/Context.php#L464-L469 And handled here: https://github.com/phpmyadmin/sql-parser/blob/8ab57e737d634210c0f4dd742880c690bcdde0d0/src/Context.php#L499-L513

### caaguado commented Oct 23, 2017

 Hi nijel, Again, there is no problem with an exception being thrown and properly handled per se. But the code is not running optimal, as long as one gets exceptions. Now, if this issue is to be fixed, the software should be corrected so for it to instead of looking for a context file/class that includes the first digit in the minor MySQL version number in subfolder \vendor\phpmyadmin\sql-parser\src\Contexts\ right before the ".php" filename suffix, it should just look for the MySQL major version number, appending a "00" just before such ".php" filename suffix. Example for MySQL 5.5.58 (with the aim to illustrate): phpMyAdmin 4.7.5 looks for context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50550.php, but since this file doesn't exist, an exception is thrown. Instead, phpMyAdmin should ignore the first digit of the MySQL's 5.5.58 minor version number (58, in this case) and actually load context file \vendor\phpmyadmin\sql-parser\src\Contexts\ContextMySql50500.php, which indeed does exist in that subfolder. Otherwise, a context file including the first digit of MySQL's minor version number should be ideally provided with the code. That way, no exception would be thrown either. Again, exceptions are things that are pointing out to abnormal situations that should be prevented if the long term quality of the software package is to be kept at a healthy level. Thanks, Carlos.

### nijel added enhancement and removed question labels Dec 6, 2017

to join this conversation on GitHub. Already have an account? Sign in to comment