X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftemplate_processor.php;h=46252c355f54b5509ab34a8f2e2fec7925fbaae2;hb=f0cf0ebb485432b444b1d85843385ebfda0260fd;hp=7f7b0b55bd727c16524d03ebef5ed045f5a7a691;hpb=4fcdada4320d5d5619eb3a1f517d0fea6b26857b;p=friendica.git diff --git a/include/template_processor.php b/include/template_processor.php old mode 100755 new mode 100644 index 7f7b0b55bd..46252c355f --- a/include/template_processor.php +++ b/include/template_processor.php @@ -13,12 +13,14 @@ var $debug=false; private function _preg_error(){ + switch(preg_last_error()){ case PREG_INTERNAL_ERROR: echo('PREG_INTERNAL_ERROR'); break; case PREG_BACKTRACK_LIMIT_ERROR: echo('PREG_BACKTRACK_LIMIT_ERROR'); break; case PREG_RECURSION_LIMIT_ERROR: echo('PREG_RECURSION_LIMIT_ERROR'); break; case PREG_BAD_UTF8_ERROR: echo('PREG_BAD_UTF8_ERROR'); break; - case PREG_BAD_UTF8_OFFSET_ERROR: echo('PREG_BAD_UTF8_OFFSET_ERROR'); break; +// This is only valid for php > 5.3, not certain how to code around it for unit tests +// case PREG_BAD_UTF8_OFFSET_ERROR: echo('PREG_BAD_UTF8_OFFSET_ERROR'); break; default: //die("Unknown preg error."); return; @@ -96,7 +98,7 @@ $this->_push_stack(); $r = $this->r; $r[$varname] = $v; - if ($keyname!='') $r[$keyname] = $k; + if ($keyname!='') $r[$keyname] = (($k === 0) ? '0' : $k); $ret .= $this->replace($args[3], $r); $this->_pop_stack(); } @@ -203,7 +205,7 @@ $os=$s; $count++; $s = $this->var_replace($s); } - return template_unescape($s); + return $s; } }