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

Fix manager menu for sql_mode "ANSI_QUOTES" #16680

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

halftrainedharry
Copy link
Contributor

What does it do?

Fixes the SQL query that is used for the manager submenus.

Why is it needed?

With the sql_mode ANSI_QUOTES, the generated SQL query returns the error Unknown column 'installer' in 'order clause'.

How to test

  • Add ANSI_QUOTES to the sql_mode setting in the MySQL config file my.ini
  • Clear the cache
  • Make sure the manager menu displays all submenus

Related issue(s)/PR(s)

Related forum topic: https://community.modx.com/t/3-1-0-missing-left-side-menu/8236

Copy link
Collaborator

@smg6511 smg6511 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix works as advertised.

I'd also replace the comment/note as seen in the suggestion so someone doesn't come through and change the format down the road.

@opengeek - For cases like this, would it be worth looking into having xpdo transform string literals to being single-quoted as a part of the query building process?

core/src/Revolution/modMenu.php Outdated Show resolved Hide resolved
@opengeek
Copy link
Member

@opengeek - For cases like this, would it be worth looking into having xpdo transform string literals to being single-quoted as a part of the query building process?

This is the result of someone manually building part of the query. I don't see how xPDO would have any ability to handle that intelligently. My rule of thumb when manually building queries is to use double-quotes to enclose the SQL so I can just use single-quotes as required inside the string. Or you can use the \PDO->quote() function itself, which is accessible from xPDO.

@opengeek opengeek merged commit c0414ba into modxcms:3.x Jan 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants