dwoo-project / dwoo

[UNMAINTAINED] php template engine
http://dwoo.org
GNU Lesser General Public License v3.0
167 stars 58 forks source link

Compiler issues #22

Closed temp closed 8 years ago

temp commented 10 years ago

In some cases I can't use a native php function like count() inside a template. Haven't yet found out when this happens, but it seems like he tries to call the CountCharacters Plugin instead of the native function count().

I tried to validate this with a small template, but it works like expected there. Seems like this happens somewhere in Compiler.php around line 3200, in the "if ($pluginType === - 1) {}" block. Any clues why this might be happening?

Another problem, I'm getting this error on loading of a custom plugin:

Catchable fatal error: Argument 1 passed to Dwoo\Plugin::__construct() must be an instance of Dwoo\Core, none given in /.../vendor/dwoo/dwoo/lib/Dwoo/Plugin.php on line 35

The referenced line is this:

$output = $reflectionClass->getMethod('compile')->invokeArgs($reflectionClass->newInstance(), $params);

It works fine here with this line:

$output = $reflectionClass->getMethod('compile')->invokeArgs(null, $params);

Any idea here?

emulienfou commented 10 years ago

Hi, this is steel a beta of Dwoo 2, however, I fixed some bugs yesterday, can you update your classes and tell me if you have always the same bug ?

In a template file, I used this code:

<?php
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;

echo count($a); // Output 3
?>

And it's working fine!