You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging an issue with the Grav Shortcode UI plugin: (getgrav/grav-plugin-shortcode-ui#29) I discovered the regular parser will skip over an x param with the following format: [shortcode x=0].
[shortcode x="0"] works, as well as [shortcode x=1], but not x=0. This only seems to affect the regular parser. It works fine and as expected with regex and wordpress parsers.
I gave it a quick debug and it seems like the match() method in the regular parser is trying to match the wrong type (6 vs 5?). I dunno, it's a bit hard for me to fully debug this as I'm not super familiar with this tokenized parser.
The result is the parent shortcode is completely skipped, causing child shortcodes to not have a parent, hence the exception to be thrown. This seems like a pretty nasty issue as any shortcode with x=0 type params will just be skipped entirely.
The text was updated successfully, but these errors were encountered:
Hi @rhukster, thanks for the report. The actual problem is in how PHP handles value comparison, especially for string '0' (the only falsy non-empty string). RegularParser didn't take this edge case into account, which caused exactly the behavior you described. I fixed this issue in #75, please test it on your side and tell me whether it fixes all your issues.
While debugging an issue with the Grav Shortcode UI plugin: (getgrav/grav-plugin-shortcode-ui#29) I discovered the
regular
parser will skip over anx
param with the following format:[shortcode x=0]
.[shortcode x="0"]
works, as well as[shortcode x=1]
, but notx=0
. This only seems to affect theregular
parser. It works fine and as expected withregex
andwordpress
parsers.I gave it a quick debug and it seems like the
match()
method in the regular parser is trying to match the wrong type (6 vs 5?). I dunno, it's a bit hard for me to fully debug this as I'm not super familiar with this tokenized parser.The result is the parent shortcode is completely skipped, causing child shortcodes to not have a parent, hence the exception to be thrown. This seems like a pretty nasty issue as any shortcode with
x=0
type params will just be skipped entirely.The text was updated successfully, but these errors were encountered: