8000 Fixed skipping shortcodes in RegularParser by thunderer · Pull Request #75 · thunderer/Shortcode · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Parser/RegularParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ private function value()
return $this->match(self::TOKEN_DELIMITER, false) ? $value : false;
}

if($tmp = $this->match(self::TOKEN_STRING, false)) {
if('' !== $tmp = $this->match(self::TOKEN_STRING, false)) {
$value .= $tmp;
while($tmp = $this->match(self::TOKEN_STRING, false)) {
while('' !== $tmp = $this->match(self::TOKEN_STRING, false)) {
$value .= $tmp;
}

Expand Down
6 changes: 5 additions & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ public function provideShortcodes()
new ParsedShortcode(new Shortcode('y', array(), ' ] [] [ [z] [/#] [/z] [ [] ] [/] ', null), '[y] ] [] [ [z] [/#] [/z] [ [] ] [/] [/y]', 27),
new ParsedShortcode(new Shortcode('z', array(), ' [ [/ [/] /] ] ', null), '[z] [ [/ [/] /] ] [/z]', 70),
)),
// falsy string values
array($s, '[a=0 b=0]0[/a]', array(
new ParsedShortcode(new Shortcode('a', array('b' => '0'), '0', '0'), '[a=0 b=0]0[/a]', 0),
)),
);

/**
Expand All @@ -239,7 +243,7 @@ public function provideShortcodes()
*
* Tests cases from array above with identifiers in the array below must be skipped.
*/
$wordpressSkip = array(3, 6, 16, 21, 22, 23, 25, 32, 33, 34, 46, 47, 49);
$wordpressSkip = array(3, 6, 16, 21, 22, 23, 25, 32, 33, 34, 46, 47, 49, 51);
$result = array();
foreach($tests as $key => $test) {
$syntax = array_shift($test);
Expand Down
0