mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 12:37:15 +00:00
fixed compiler when mbstring.func_overload is set to 2 (closes #731)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
* 1.8.2 (2012-XX-XX)
|
||||
|
||||
* n/a
|
||||
* fixed compiler when mbstring.func_overload is set to 2
|
||||
|
||||
* 1.8.1 (2012-05-17)
|
||||
|
||||
|
||||
@@ -192,7 +192,15 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
public function addDebugInfo(Twig_NodeInterface $node)
|
||||
{
|
||||
if ($node->getLine() != $this->lastLine) {
|
||||
$this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset);
|
||||
// when mbstring.func_overload is set to 2
|
||||
// mb_substr_count() replaces substr_count()
|
||||
// but they have different signatures!
|
||||
if (((int) ini_get('mbstring.func_overload')) & 2) {
|
||||
// this is much slower than the "right" version
|
||||
$this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n");
|
||||
} else {
|
||||
$this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset);
|
||||
}
|
||||
$this->sourceOffset = strlen($this->source);
|
||||
$this->debugInfo[$this->sourceLine] = $node->getLine();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user