pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
387 stars 42 forks source link

enable_profiler => true shows php notices (undefined index) #236

Closed sandrodz closed 4 years ago

sandrodz commented 4 years ago

Hello,

Recently tried enable_profiler parameter and got some undefined index errors:

Notice: Undefined index: timeprecision in /vendor/phug/phug/src/Phug/Util/Util/Partial/OptionTrait.php on line 226

Notice: Undefined index: lineheight in /vendor/phug/phug/src/Phug/Util/Util/Partial/OptionTrait.php on line 226

Thanks!

kylekatarnls commented 4 years ago

OK,

I see it happens with:

<?php

include __DIR__.'/vendor/autoload.php';

error_reporting(E_NOTICE);

$pug = new Pug([
    'enable_profiler' => true,
]);

$pug->display('p Hello');

Indeed I have to map the options from Pug to Phug.

sandrodz commented 4 years ago

Hey @kylekatarnls !

Have a look, this is where I run it: https://github.com/kubikplugins/pugpress/blob/master/src/class-pugpress.php#L167-L175

And options: https://github.com/kubikplugins/pugpress/blob/master/src/class-pugpress.php#L77-L86

kylekatarnls commented 4 years ago

It should be fixed in the next version, you can try it requiring "pug-php/pug": "dev-master"

kylekatarnls commented 4 years ago

Released in 3.4.1. Thanks!

sandrodz commented 4 years ago

Thank you. Your awlays super efficient and fast.