PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_AJAX » Bug #5751

Cant seem to get my flexy templates to output

Details

Submitted2005-10-22 02:30 UTC
Fromspam at electroteque dot org
Assignedjeichorn
StatusClosed
PackageHTML_AJAX
PHP Version5.1.0
OSn/a
Roadmaps(Not assigned)

Comments

[2005-10-22 02:30 UTC] spam at electroteque dot org

Description:
------------
For some strange reason, i cant seem to get my flexy
templates to output anything. I think there is an issue
with E_STRICT turned on for PHP5 which i turn off in the
base class of my class.

Here is the error i got

{"errNo":2048,"errStr":"var: Deprecated. Please use the
public\/private\/protected modifiers","errFile":"\/
Volumes\/DATA\/www\/musictrade\/classes\/PEAR\/HTML\/
Template\/Flexy\/Compiler.php","errLine":44}

Any i could only get it, if i tried to echo just above
that, any php parse error i tried to force, wouldnt
display, or execute the class for some reason.

class Musictrade_Admin_Releases_TrackList extends
Musictrade_Admin {

function Musictrade_Admin_Releases_TrackList()
{
parent::Musictrade_Admin();
}


function display()
{
echo "yes";
$this->tpl->compile('tracks_list.html');
echo $this->tpl->bufferedOutputObject($this);
exit;
}
}

whats the go ?

[2005-10-22 02:55 UTC] spam at electroteque dot org

just to make sure the actually class was workin

<?php
require_once 'Musictrade/Admin/Releases/TrackList.php';
$test = new Musictrade_Admin_Releases_TrackList();
echo $test->display();
?>

Its all fine, there is some wierd headers being
outputted in Ajax i think ??

[2005-10-22 05:34 UTC] spam at electroteque dot org

You seem to be overriding the error_reporting somewhere
down the line, i had to explicitly turn it off to make
everything work ok. I turned E_STRICT off in my custom
error handler so its somewhere else.

class Musictrade_Admin_Releases_TrackList extends
Musictrade_Admin {

function Musictrade_Admin_Releases_TrackList()
{
parent::Musictrade_Admin();
error_reporting(0);
}


function display()
{
$this->tpl->compile('tracks_list.html');
return $this->tpl->bufferedOutputObject($this);

}

}

[2005-10-24 17:12 UTC] jeichorn at php dot net

It could be related to the error handler we use to pass errors to js, it doesn't look at the value of error_reporting() right now.

[2005-10-25 05:37 UTC] spam at electroteque dot org

I dont know what else to say its clearly your error
handler is not ignoring E_STRICT for php4 packages in
php5. Therefore i am forced to turn error reporting off.
Its dieing but not displaying any error back to the
layer in the examples.

[2005-10-25 14:45 UTC] jeichorn at php dot net

Please check against the new release and close if the issue is fixed.

[2005-10-25 15:01 UTC] jeichorn at php dot net

0.2.3 checks the value of error_reporting in its custom error handler. If you have have error_reporting set to say E_ALL then you shouldn't run into problems with E_STRICT errors.

If this continues to be a problem we may auto ignore E_STRICT errors as well as looking at error_reporting, but I just want to verify that the change works for you without having to turn error reporting off.

[2005-10-25 23:26 UTC] spam at electroteque dot org

I suppose you mean grab from cvs ? Ill do it today and
let u know. Here is how i setup my custom error handler
at the moment, please let me know if its clashing, as
ive never had issues before.

error_reporting(E_ERROR | E_WARNING | E_PARSE &
~E_NOTICE & ~E_STRICT);
set_error_handler(array(&$errors,
'phpErrorHandler'));

Even with ignoring E_STRICT i still have to ignore it ,
in my custom error handler

function phpErrorHandler($code, $message, $file, $line,
$ctx)
{
global $settings;
if ($code !== E_STRICT && $code !==E_NOTICE) {
$this->_loadConfig();
switch ($code) {
case E_WARNING:
case E_USER_WARNING:

$priority = PEAR_LOG_WARNING;
break;
case E_ERROR:
case E_USER_ERROR:
$priority = PEAR_LOG_ERR;
break;
default:
$priority = PEAR_LOG_INFO;
}
if ($settings['project']['debug']) {

$conf = array('error_prepend' => '<font
color="#ff0000"><tt>',
'error_append' => '</tt></font>');
$logger = &Log::singleton('display', '',
'', $conf, PEAR_LOG_DEBUG);

$backtrace = @debug_backtrace();
for ($i=0;$i < 8;$i++) {
if (!
empty($backtrace[$i]['file'])) {
$message .= ' (' .
$backtrace[$i]['file'];
if (!
empty($backtrace[1]['line'])) {
$message .= ' at line ' .
$backtrace[$i]['line'];
}

$message .= ')'."\n";
}
}
$logger->log($message, $priority);

//$logger->log($message . ' in ' . $file
. ' at line ' . $line, $priority);
exit;
} else {
if ($settings['Logs']['log_errors']) {
if
($settings['Logs']['email_errors']) {
$conf = array(
'subject' =>
'PHP Compile Errors with the system '
.$settings['project']['project_name'],
'from' =>
$settings['Logs']['error_log_title'],
'preamble' =>
$settings['Logs']['log_preamble']
);
$logger = &Log::
singleton('mail', $settings['Logs']['error_log_email'],
'ident', $conf);
$logger->log($message . ' in ' .
$file . ' at line ' . $line, $priority);
}
}

$tpl = new
HTML_Template_Flexy($settings['HTML_Template_Flexy']);
$tpl->compile('errors.html');
echo $tpl->outputObject($this);
}

$conf = array('mode' => 0600, 'timeFormat'
=> '%X %x');
$file_logger = &Log::singleton('file',
'logs/php_errors.log', 'ident', $conf);
$file_logger->log($err['message']);
exit;
}

}

[2005-10-25 23:29 UTC] jeichorn at php dot net

Your custom error handler will get overridden but the error_reporting you set shouldn't.

This is in release 0.2.3 (released yesterday)

If there is away to detect a current custom handler i guess we should and not set our own in that case.

[2005-11-17 04:51 UTC] jeichorn at php dot net

This is fixed in 0.2.5