Divne chovani latte parseru v php 5.2.6?
- chemix
- Nette Core | 1310
na lokalu nocni verze jede jak vino (php 5.3.5) ale na serveru (php 5.2.6) to hlasi divnost :(
Modifier name must be alphanumeric string, ‚e‘ given in …/templates/@layout.latte:15
8: * @param string $robots tell robots how to index the content of a page (optional)
9: * @param array $flashes flash messages
10: * @param string $theme design layout using
11: * @param string $language selected language
12: *}
13:
14: <!DOCTYPE html>
15: <html lang="{$language}" class="no-js {$language}">
16: <head>
17: <meta charset="utf-8" />
18: <meta name="description" content="Contract">
19: <meta name="robots" content="{$robots}" n:ifset="$robots">
20:
21: <title>{block #title}Contract{/block}</title>
22:
Modifier name must be alphanumeric string, ‚e‘ given in …/Front/default.latte:16
9: <div class="box-growyoung" id="box-growyoung">
10: <div class="top"></div>
11: <div class="body">
12: <p>Uma Therman returns to her child­hood to preparate for new movie.
13: <br />
14: <a href="http://www.google.com" rel="external" class="arrow">Read the whole story</a><br /><br />
15:
16: <a href="{$basePath}/grow-young" class="arrow">More on Grouw Young</a>
17: </p>
18:
19: </div>
20: <div class="bottom"></div>
21: </div>
22:
23: {/block}
Nejaky napad ?
- pepko
- Člen | 12
Problém bude s regulárním výrazem, viz Tokenizer
Vrací to
Array
(
[0] => Array
(
[0] => e
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] => e
)
[1] => Array
(
[0] => s
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] => s
)
[2] => Array
(
[0] => c
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] => c
)
[3] => Array
(
[0] => a
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] => a
)
[4] => Array
(
[0] => p
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] => p
)
[5] => Array
(
[0] => e
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] => e
)
)
Správně to má ale vrace
Array
(
[0] => Array
(
[0] => content
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] => content
)
)
Zajímavý, že na produkčním serveru, kde je taky 5.2.6 mi to nedělá.
- pepko
- Člen | 12
Dle konzultace s Majklem zkus
Nahradit
self::T_SYMBOL => '[\d\pL_]+(?:-[\d\pL_]+)*',
za toto
self::T_SYMBOL => '[\d\w_]+(?:-[\d\w_]+)*',
- Majkl578
- Moderator | 1364
Problém je v tom, že vaše PCRE nepodporuje (nemá tu podporu
zkompilovanou) matchování pomocí Unicode property (tj. to \pL
), a proto to vůbec
nefunguje.
Nahrazení \pL
za \w
v MacroTokenizeru
na řádcích 43, 45 a 47 je workaround, který ovšem vylučuje použití
znaků z Unicode v názvech proměnných apod.