Skip to content
New issue

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

Fatal Error: DatabaseException - SELECT SQL_CACHE- The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. #2909

Open
wdebusschere opened this issue Mar 27, 2020 · 6 comments
Assignees
Milestone

Comments

@wdebusschere
Copy link

wdebusschere commented Mar 27, 2020

Affected Symphony version(s) : 2.7.10 - 3.0.0
PHP version(s) : 7.1 - 7.3
MySQL version(s): 8.0
OS(es) :

To be able for symphonycms to work with MySql 8.0 i need to disable 'query_caching'.

  1. For installation: the
    installer/config_default.php 'query_caching' => 'off', did not work, i need to disable it in the symphony code: $query = preg_replace('/^SELECT\s+/i', 'SELECT SQL_CACHE ', $query);

Error:

Fatal Error: DatabaseException 0 - MySQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.name, t2.page, t2.delegate, t2.callback
                FROM `sym_extensions` a' at line 1 in query: SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback
                FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id
                WHERE t1.status = 'enabled'
                ORDER BY t2.delegate, t1.name
  1. Running symphony:
    In the config.php 'query_caching' => 'off', works.
@wdebusschere wdebusschere changed the title MySQL 8.0 + default config query_caching does not work Fatal Error: DatabaseException - SELECT SQL_CACHE- The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. Mar 27, 2020
@nitriques
Copy link
Member

Yeah I already left a comment in the code regarding that ;)
Can you var_dump(Symphony::Database()->getVersion()); please ?

@nitriques nitriques self-assigned this Mar 30, 2020
@nitriques nitriques added this to the 3.0.1 milestone Mar 30, 2020
@wdebusschere
Copy link
Author

Symphony::Database()->getVersion() = Symphony Fatal Error: Call to undefined method MySQL::getVersion()

MySQL version | 8.0.19

@nitriques
Copy link
Member

@wdebusschere Did run ran composer install and uploaded all file ? Because the Symphony::Database() instance does not return a MySQL class anymore.

@wdebusschere
Copy link
Author

wdebusschere commented Apr 1, 2020

@nitriques

Can't test anymore, getting now Symphony Notice: Undefined index errors.

Symphony Notice: Undefined index: data_sources
An error occurred in /Users/xxx/Sites/symphonycms3/symphony/content/content.blueprintspages.php around line 696

691                 $types = preg_split('/\s*,\s*/', $fields['type'], -1, PREG_SPLIT_NO_EMPTY);
692                 $types = array_map('trim', $types);
693                 unset($fields['type']);
694 
695                 $fields['parent'] = ($fields['parent'] != __('None') ? $fields['parent'] : null);
696                 $fields['data_sources'] = is_array($fields['data_sources']) ? implode(',', $fields['data_sources']) : null;
697                 $fields['events'] = is_array($fields['events']) ? implode(',', $fields['events']) : null;
698                 $fields['path'] = null;
699 
700                 if ($fields['parent']) {

@nitriques
Copy link
Member

@wdebusschere 763305c should take care of this

nitriques added a commit that referenced this issue Apr 24, 2020
Since the feature is deprecated, the first step is to at least disable
it for real, by not usign the SQL_NO_CACHE directive at all. This is the
first step towards removing this API.

Re #2909
@nitriques
Copy link
Member

@wdebusschere Also check the other 2 commits ^^^ which should take care of mysql 8 if mysql's doc is right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants