Jump to content

Fatal error: Access to undeclared static property: Smarty::$_CHARSET


Recommended Posts

Hi everyone, I need some help urgently.

 

Let me explained what went wrong. Previously I was using PS 1.4.4.1 and then I tried upgrading to 1.5.2. Before I did so, I use cPanel to do a backup of my Home Directory, MySQL and etc. It went all wrong and I got kicked out from the Back Office, and I was forever stuccoed in the Admin Login Page, and no matter how many times I have entered my password, it would redirect me back to the Admin Login page.

 

So I did a fresh install of PS 1.5.2 and I managed to go back into Back Office. Unfortunately my products and everything else was gone even after I did a DB restore. I also created a new db2 but it didn't work, so I went back to cPanel and restored my Home Dir with the version I have backed up, and deleted db2 while I restored db1 (which was what I was using when everything was still working in PS 1.4.4.1).

 

Now I have PS 1.4.4.1 and I can login to my Back Office, my products and modules are still there. Then I opened my site and it gave me an error:

 

Fatal error: Access to undeclared static property: Smarty::$_CHARSET in /home/oharaflo/public_html/tools/smarty/plugins/modifiercompiler.escape.php on line 30

 

When I go into my cPanel and File Manager, under tools I do see a folder name "smarty" and "smarty_v2". I have cleared the "cache" folder for both but I am still getting the same error.

 

I then replaced the modifiercompiler.escape.php from my older back up and it is still the same. I set the file permission to 755 on the modifiercompiler.escape.php and it is still the same.

 

Can someone please help me?

Link to comment
Share on other sites

Oh, I forgot to mention that I went into Back Office, Preference > Performance, and did the "Force Compile" to yes and set "Cache" to No, saved it, and then it refreshed. But that didn't solve my problem of having the same error:

 

Fatal error: Access to undeclared static property: Smarty::$_CHARSET in /home/oharaflo/public_html/tools/smarty/plugins/modifiercompiler.escape.php on line 30

Link to comment
Share on other sites

I am also pasting my modifiercompiler.escape.php file here

 

<?php

/**

* Smarty plugin

*

* @package Smarty

* @subpackage PluginsModifierCompiler

*/

 

/**

* @ignore

*/

require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );

 

/**

* Smarty escape modifier plugin

*

* Type: modifier<br>

* Name: escape<br>

* Purpose: escape string for output

*

* @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)

* @author Rodney Rehm

* @param array $params parameters

* @return string with compiled code

*/

function smarty_modifiercompiler_escape($params, $compiler)

{

try {

$esc_type = smarty_literal_compiler_param($params, 1, 'html');

$char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);

$double_encode = smarty_literal_compiler_param($params, 3, true);

 

if (!$char_set) {

$char_set = Smarty::$_CHARSET;

}

 

switch ($esc_type) {

case 'html':

/* PrestaShop

return 'htmlspecialchars('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true) . ', '

. var_export($double_encode, true) . ')';

*/

return 'htmlspecialchars('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true) . ')';

/* END */

 

case 'htmlall':

/* PrestaShop

if (Smarty::$_MBSTRING) {

return 'mb_convert_encoding(htmlspecialchars('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true) . ', '

. var_export($double_encode, true)

. '), "HTML-ENTITIES", '

. var_export($char_set, true) . ')';

}

*/

if (Smarty::$_MBSTRING) {

return 'mb_convert_encoding(htmlspecialchars('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true)

. '), "HTML-ENTITIES", '

. var_export($char_set, true) . ')';

}

/* END */

 

// no MBString fallback

/* PrestaShop

return 'htmlentities('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true) . ', '

. var_export($double_encode, true) . ')';

*/

return 'htmlentities('

. $params[0] .', ENT_QUOTES, '

. var_export($char_set, true) . ')';

/* END */

 

case 'url':

return 'rawurlencode(' . $params[0] . ')';

 

case 'urlpathinfo':

return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';

 

case 'quotes':

// escape unescaped single quotes

return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';

 

case 'javascript':

// escape quotes and backslashes, newlines, etc.

return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';

 

}

} catch(SmartyException $e) {

// pass through to regular plugin fallback

}

 

// could not optimize |escape call, so fallback to regular plugin

if ($compiler->tag_nocache | $compiler->nocache) {

$compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';

$compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';

} else {

$compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';

$compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';

}

return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';

}

 

?>

Link to comment
Share on other sites

Okay, I think I have it fixed.

 

Under Preference, I set "Use Smarty 2 instead of 3" to YES and somehow that got rid of the error. Right now I am testing the site to ensure that I get the full functionality back. Will report in if it is working as it should be.

  • Like 3
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
  • 1 year later...

I can't due to: Uncaught Error: Access to undeclared static property

 

But the .htaccess seam already right:

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...