Best get this reviewed by @hafriedlander I suspect.
FIX: Fixes #2382
- Errors are thrown in front-end should the parser encounter a shortcode with a value of '0'
- Added test
Looks good. Won't work for [test_shortcode foo=""] though. Think that's a problem? If so, off the top of my head:
$attr = array_values(array_filter($attr, 'strlen'));
$list = array_shift($attr);
$name = array_shift($attr);
$value = $attr ? array_shift($attr) : '';
Yeah I had tests for that case also, which also failed prior to applying fix. I didn't consider it directly related to the current ticket, hence my not including them.
@hafriedlander I will change as per one of the above and add tests accordingly.
@phptek Any further updates for this? would be good to merge this one :)
@halkyon interesting. Just checked out latest 3.1, reverted my fixes and the issue no longer seems to arise:
I performed the following (rough and ready test)
Since the error this fixes can no longer be reproduced, I'm closing this.
Hi there! This issue is still around in 3.1.15. The fix supplied works fine for me.
Note that the issue only arises when the environment type is set to 'dev' or 'test', since it throws a PHP Notice.
This is an issue for me also
What kind of shortcodes are you using? Can you please give examples that would be useful to reproduce your error?
Using my shortcodable module, checkbox field values used to create shortcode attributes are 1 or 0. I could change it to use true/false strings but that seems like a work around for a core bug that should peobably be fixed?
[TrailforksWidget trailid="28447" map="1" elevation="1" photos="0"]
Still an existing issue, would be good to merge the pull request with the fix for this.
My shortcode looks like: [ItemType color="0"]
See #2382 (comment)
If someone wants to back-port this fix to 3.x then I'll review any PR. :)