-
Notifications
You must be signed in to change notification settings - Fork 38
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
menu_get_item() attempts to load placeholders when called from Layout::save(). #2800
Comments
One line patch in PR fixes the immediate issue. |
This fixes a number of tests all for the same reason:
|
I may have a better patch for this. |
Thanks @jlfranklin! Even if PostGres is not supported, if we're making an invalid query at all it's still a bug. I'm marking this needs work to see what your better patch is, please move to needs review when ready. |
Re-rolled the PR. |
Given the amount of time this has been around, I first checked to see if it's still a problem, and it is. Checked by creating a layout with path Applying the patch of the PR fixes the issue; no bogus call (no call at all) to Code reviewed, LGTM. RTBC. |
@JFranklin, could you edit the first comment in your PR backdrop/backdrop#1961 to change "Addresses" to "Fixes" (which is a magic word that will connect that PR to this issue.) |
Thanks @bugfolder for reviewing this old PR. I merged in 1.x into the PR and we'll see if it's passing tests still. |
Oh look, |
All other tests are passing. We have a separate issue for I merged backdrop/backdrop#1961 into 1.x and 1.26.x. Thanks @jlfranklin and @bugfolder! |
Describe your issue or idea
The core bug here is a menu item placeholder
%
is used as a SQL string%
. (But not as a wildcard.)The
Layout::save()
function callsmenu_get_item()
with a path ofnode/%
.get_menu_item()
parses the path, matches it to the router item fornode/%
and eventually callsnode_load_multiple('%')
The node subsystem dutifully builds and executes a query withWHERE (base.nid IN ('%'))
.Steps to reproduce (if reporting a bug)
Run the tests with the PostgreSQL driver, possibly with MySQL's Strict SQL mode enabled, or by adding some debugging code in
node_load_multiple()
Actual behavior (if reporting a bug)
I discovered this bug while trying to get the tests to all pass while using the PostgreSQL driver imported back from Drupal 7. I know PostgreSQL is not supported here, but this bug is not in the database or driver, it is in the path handling of the menu subsystem.
The clue I had was the
NodeBlockFunctionalTest::testRecentNodeBlock()
test failed with an exception:MySQL executes this query without an error, returning no rows. Enabling MySQL's Strict SQL mode may trigger a warning.
Expected behavior (if reporting a bug)
PostgreSQL tests pass, MySQL doesn't bother with an obviously bad query.
Relevant version/system information (if applicable)
The text was updated successfully, but these errors were encountered: