Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#59509 new defect (bug)

Shortcode attributes named 0 are ignored

Reported by: ourous's profile ourous Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.3.1
Component: Shortcodes Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

Shortcode attributes in the form 0=... are not picked up during parsing.
This is because the parser checks for an empty name with empty(..), which also returns true for the string '0'.

Change History (1)

#1 @SergeyBiryukov
12 months ago

  • Keywords needs-patch needs-unit-tests added

Hi there, welcome to WordPress Trac! Thanks for the report, I was able to reproduce the issue.

Looks like this happens because the shortcode_parse_atts() function has some checks like ! empty( $m[1] ), which should perhaps be replaced with '' !== $m[1].

Note: See TracTickets for help on using tickets.