Skip to content

Commit

Permalink
Merge pull request #36 from usox/preg_replace_callback_deprecation
Browse files Browse the repository at this point in the history
Use preg_replace_callback instead of preg_replace
  • Loading branch information
Ocramius committed Nov 10, 2014
2 parents 36fa578 + 1a7b408 commit ec1e3f4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/HTML5ModeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,20 @@ function testMixedModes()
$this->assertEquals('<input checked="checked"/>',$tpl->execute());
}

/**
* @param string $str
*/
private function decodeNumericEntities($str)
{
return normalize_html(@preg_replace('/&#x?[a-f0-9]+;/ie','htmlspecialchars(html_entity_decode("\\0"))', $str));
return normalize_html(
preg_replace_callback(
'/&#x?[a-f0-9]+;/i',
function (array $entities) {
return htmlspecialchars(html_entity_decode($entities[0]));
},
$str
)
);
}

function testAttributeQuotes()
Expand Down

0 comments on commit ec1e3f4

Please sign in to comment.