We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Exception loading Smarty_Security class [Answered] | Forum

Karl Pietsch
Karl Pietsch Nov 24 '13

the following exception is triggered constantly.


this line in  init.php 

OW_ViewRenderer::getInstance()->registerFunction('display_rate', array('BASE_CTRL_Rate', 'displayRate'));

causes a class "smarty" to autoload but then tries to autoload "Smarty_Security" which fails.


Smarty not registered
 > autoload.php!OW_Autoload->getClassPath() Line 130 PHP
  autoload.php!OW_Autoload::autoload() Line 103 PHP
  autoload.php!include() Line 0 PHP
  autoload.php!OW_Autoload::autoload() Line 110 PHP
  view_renderer.php!OW_ViewRenderer->__construct() Line 0 PHP
  view_renderer.php!OW_ViewRenderer::getInstance() Line 55 PHP
  init.php!include() Line 122 PHP
  plugin_manager.php!OW_PluginManager->initPlugins() Line 107 PHP
  application.php!OW_Application->init() Line 133 PHP
  index.php!{main} Line 43 PHP

The Forum post is edited by Alia Dec 12 '13
Alia Team
Alia Nov 25 '13
Karl Pietsch,

1. Make sure that you have correct permissions for  all smarty files ( under ow_smarty folder).
They all should be readable.

2. If this doesn't help, can you PM me admin panel username/password and FTP access details?

Alia Team
Alia Dec 12 '13
Karl, were you able to resolve this yourself?
Karl Pietsch
Karl Pietsch Dec 19 '13

It doesn't stop the site functioning it's just a nuisance when debugging the code as it fires an exception loading classes on every page load making it hard annoying to debug legitimate problems.  The issue is simply one of refactoring.

the class  "OW_Security"   loads a class called "Smarty_Security", the prefix of this class is "SMARTY" which is not valid and thus it constantly throws an exception trying to autoload that class. the start of the class name must match a valid package pointer, eg.

OW

INC

UTIL

BOL

BASE_CMP

BASE_CTRL

etc.


Karl Pietsch
Karl Pietsch Dec 19 '13

maybe solution is to add a package pointer in  ow_includes\init.php


$autoloader->addPackagePointer('SMARTY', OW_DIR_LIB . 'smarty3' . DS . 'sysplugins');


Karl Pietsch
Karl Pietsch Dec 19 '13

solution is

add $autoloader->addPackagePointer('Smarty', OW_DIR_LIB . 'smarty3' . DS . 'sysplugins');

N.B. 'Smarty'  not 'SMARTY'

N.B. that the smarty classes do not follow naming convention of all capitals for  class name prefix so you also need to change this line in ow_core\autoload.php

//$this->packagePointers[trim(strtoupper($packagePointer))] = $dir;

$this->packagePointers[trim($packagePointer)] = $dir;






       

Karl Pietsch
Karl Pietsch Dec 19 '13

better yet to work for all smarty classes


instead of

//$this->packagePointers[trim(strtoupper($packagePointer))] = $dir;

$this->packagePointers[trim($packagePointer)] = $dir;



if(strpos($className, 'Smarty') === 0) return'SMARTY';


in

publicfunctiongetPackagePointer( $className)