-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 on Saving Navigation Block with URL Containing Array-Like Query Parameters #58020
Comments
I am working on this bug. |
I can see the same error for theme Twenty Twenty-Four but it works fine on Twenty Twenty-One. |
It seems my errors have different file paths. Warning: rawurldecode() expects parameter 1 to be string, array given in /var/www/src/wp-includes/blocks/navigation-link.php on line 135 Warning: rawurldecode() expects parameter 1 to be string, array given in /var/www/src/wp-includes/blocks/navigation-link.php on line 135 |
Ah, I think there are two different failure modes
I gave instructions to reproduce (1) but my error lines stated were actually from (2). My apologies. |
It seems like a PHP issue instead of ReactJS. Still working on it. Not sure why it works fine on Twenty Twenty-One. |
After I npm run build and dev, the error show in Warning: rawurldecode() expects parameter 1 to be string, array given in /var/www/src/wp-content/plugins/gutenberg/build/block-library/blocks/navigation-link.php on line 135 |
In PHP 7 and earlier, it's a warning, but in PHP 8 or later, it's a fatal error: Example w/ output. |
Thanks. |
Can deactive the Gutenberg to see if you get the same error? |
Can you add a more complex custom url? Like this: example.com/page?param[0]=value¶m[1]=value1 |
Using param[0] is not a proper way to write querystring. It should be like this: example.com/page?id=1&name=John I also found that the custom link value saved and the hyperlink are not matched. It could be the Gutenberg redux didn't get updated and saved correctly. It can also be the default themes are not up-to-date. I'll check both tomorrow. Here is an example: Text displays 'example.com/page?id=1&name=John' but the hyperlink is previous the saved value 'https://example.com/page?param%5B0%5D=value' https://help.marketruler.com/wiki/What_is_the_correct_syntax_for_query_strings%3F |
I work with premium themes like Elegant Divi themes. It has no problem with Gutenberg. I think the current default themes are not up-to-date. I tested some other default themes. I got errors messages saying themes are not compatible with Gutenberg. Why don't you try out with a premium theme to see if it has the same problem. On my end, I looked at almost every codes. |
Reproduction ReportEnvironment
Actual Results
Additional Notes
<!-- wp:navigation-link {"label":"example.com/page?param[0]=value","url":"https://example.com/page?param%5B0%5D=value","kind":"custom","isTopLevelLink":true} /--> Screenshots |
Description
When attempting to save a navigation block in the Gutenberg editor that contains a custom link with a URL having array-like query parameters (e.g., param[0]=value), a fatal error occurs, preventing the save operation.
The line that crashes is:
gutenberg/packages/block-library/src/navigation-link/index.php
Line 135 in 7105a03
$query_param is an array:
And the fatal error is:
Step-by-step reproduction instructions
https://example.com/page?param[0]=value
and press enter.Screenshots, screen recording, code snippet
Environment info
Fresh wp-env as of 2024-01-19.
WP 6.4.2 (bundled Gutenberg editor)
Theme: Twenty Twenty-Four
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: