Problème "undefined_function" avec create_function()
Bonjour,
En exécutant ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| class AppModel extends Model {
/**
* Retourne $texte coloré synthaxiquement grâce à l'API PHP Geshi.
* Parsing de <code></code> pour la coloration;
*/
function getContentGeshi($texte){
return preg_replace_callback('#\<code=(.+)\>(.*)\</code\>#isU', create_function('$matches', 'return modifyWithGeshi($matches[2], $matches[1]);'), $texte);
}
/**
* Fonction qui retourne le code $source coloré synthaxiquement grâce
* à Geshi avec le language $language choisi.
*/
function modifyWithGeshi($source, $language){
App::import('Vendor', 'geshi/geshi');
return geshi_highlight($source, $language, $path);
}
} |
J'obtiens cette erreur :
Fatal error: Call to undefined function modifyWithGeshi() in C:\wamp\www\ShareYourGeekEdge\app\models\app_model.php(37) : runtime-created function on line 1
Or, je ne vois pas du tout d'où cela proviens car ma fonction appelé dans preg_replace_callback est pourtant bien définie =/
Mais le problème viens bien du create_function, il ne trouve pas modifyWithGeshi(). Et pourtant elle est juste en dessous...
Pouvez vous m'aider svp ?