Skip to content
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

FIX: Fixes #2382 #2417

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions parsers/ShortcodeParser.php
Expand Up @@ -218,9 +218,9 @@ protected function extractTags($content) {
preg_match_all(self::attrrx(), $match['attrs'][0], $attrmatches, PREG_SET_ORDER);

foreach ($attrmatches as $attr) {
list($whole, $name, $value) = array_values(array_filter($attr));
list($whole, $name, $value) = array_values(array_filter($attr, 'strlen'));
$attrs[$name] = $value;
}
}
}

// And store the indexes, tag details, etc
Expand Down
12 changes: 12 additions & 0 deletions tests/parsers/ShortcodeParserTest.php
Expand Up @@ -88,6 +88,18 @@ public function testOneArgument() {
}
}

public function testOneFalseishArgumentWhereIsZero() {
$tests = array (
'[test_shortcode foo="0"]', "[test_shortcode foo='0']",
'[test_shortcode foo=0]'
);

foreach($tests as $test) {
$this->parser->parse($test);
$this->assertEquals(array('foo' => 0), $this->arguments, $test);
}
}

public function testMultipleArguments() {
$this->parser->parse('[test_shortcode foo = "bar",bar=\'foo\', baz="buz"]');

Expand Down