BUG 13974 "Error in triggers in lines of code commented" SOLVED
- Error in triggers in lines of code commented. - Problema Resuelto, Se valida el Script del triggers quitando todo los comnetarios que existe en el codigo antes de ser ejecutado, el cambio se lo realizo en el metodo "setScript($sScript = '')".
This commit is contained in:
@@ -151,38 +151,36 @@ class PMScript
|
|||||||
*/
|
*/
|
||||||
public function setScript ($sScript = '')
|
public function setScript ($sScript = '')
|
||||||
{
|
{
|
||||||
$nrt = array("\n", "\r", "\t");
|
if (!defined("T_ML_COMMENT")) {
|
||||||
$nrthtml = array("(n /)", "(r /)", "(t /)");
|
define("T_ML_COMMENT", T_COMMENT);
|
||||||
|
} else {
|
||||||
$script = $sScript;
|
define("T_DOC_COMMENT", T_ML_COMMENT);
|
||||||
$script = str_replace($nrt, $nrthtml, $script);
|
|
||||||
|
|
||||||
while (preg_match("/^(.*)\/\*(.*)$/", $script, $arrayMatch)) {
|
|
||||||
$scriptAux = "";
|
|
||||||
|
|
||||||
if (preg_match("/^.*\*\/.*$/", $arrayMatch[2])) {
|
|
||||||
$arrayAux = explode("*/", $arrayMatch[2]);
|
|
||||||
unset($arrayAux[0]);
|
|
||||||
$scriptAux = implode("*/", $arrayAux);
|
|
||||||
}
|
|
||||||
|
|
||||||
$script = $arrayMatch[1] . $scriptAux;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (preg_match("/^(.*)(?:\/\/|#)(.*)$/", $script, $arrayMatch)) {
|
$script = "<?php " . $sScript;
|
||||||
$scriptAux = "";
|
$tokens = token_get_all($script);
|
||||||
|
$result = "";
|
||||||
|
|
||||||
if (preg_match("/^.*\(n\s\/\).*$/", $arrayMatch[2])) {
|
foreach ($tokens as $token) {
|
||||||
$arrayAux = explode("(n /)", $arrayMatch[2]);
|
if (is_string($token)) {
|
||||||
unset($arrayAux[0]);
|
$result = $result . $token;
|
||||||
$scriptAux = implode("(n /)", $arrayAux);
|
} else {
|
||||||
|
list($id, $text) = $token;
|
||||||
|
|
||||||
|
switch ($id) {
|
||||||
|
case T_COMMENT:
|
||||||
|
case T_ML_COMMENT: //we've defined this
|
||||||
|
case T_DOC_COMMENT: //and this
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = $result . $text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$script = $arrayMatch[1] . $scriptAux;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$script = str_replace($nrthtml, $nrt, $script);
|
$result = trim(str_replace(array("<?php", "<?", "?>"), array("", "", ""), $result));
|
||||||
$sScript = $script;
|
$sScript = $result;
|
||||||
|
|
||||||
$this->sScript = $sScript;
|
$this->sScript = $sScript;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user