I have used ionCube(ver. 8.3) to encrypt .tpl,.php files including smarty library files, I am able to encode them successfully with all Obfuscation options checked and able to generate Key file also. But when I try to open my index.php page it gives me following error ...
Fatal error: Uncaught exception 'LogicException' with message 'Function 'smartyAutoload' not found (function 'smartyAutoload' not found or invalid function name)' in C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php:0 Stack trace: #0 C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php(0): obfuscated #1 C:\cc\htdocs\App_Encode\index_standard_creation.php(0): unknown() #2 {main} thrown in C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php on line 0
The patch which is provided by ionCube is for Smarty 2.*
..since I am using Smarty 3.1.18 version and PHP Ver. 5.5...
I am not able to understand where problem lies as I am new to PHP programming.
I have tried following patch in getContent() function in \libs\plugins\smarty_internal_resource_file.php ..But it's no use :(
public function getContent(Smarty_Template_Source $source)
{
if ($source->timestamp) {
if (function_exists('ioncube_read_file')) {
return ioncube_read_file($source->filepath);
} else {
return file_get_contents($source->filepath);
}
}
if ($source instanceof Smarty_Config_Source) {
throw new SmartyException("Unable to read config {$source->type} '{$source->name}'");
}
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
Please help me out!!
You've used the good patch for Smarty 3 from http://www.smarty.net/forums/viewtopic.php?t=20562
You must also encode Smarty, or at least the patched file, as ioncube_read_file() can only be used in an encoded file (in this scenario it would be pointless to have a decrypt routine in a non-encoded file). ioncube_read_file() will return an error code as an integer instead of the file contents as a string if there is an error, so you could extend the patch to test for that and log the error code somewhere. The error codes also exist as constants defined by the ionCube Loader, and the codes and constants are documented in the User Guide PDF.
Related
I am using WooCommerce on Wordpress 4.7.1. Previously, I was running 4.7.0. When Wordpress automatically upgraded to 4.7.1, I suddenly began seeing checkouts fail to redirect to the "Thank you" page, and the UI showed that a fatal error had occurred.
Turning on debugging revealed the following error:
PHP Fatal error: Cannot redeclare get_cc() (previously declared in .../templates/emails/email-addresses.php:36) in .../templates/emails/email-addresses.php on line 36
I also confirmed that this file is never directly called with require, require_once, include, or include_once. It is, however, called with wc_get_template().
A quick search brought me to this similar question. So I added the following to email-addresses.php:
if (!function_exists('get_cc')) {
function get_cc( $code ) {
... function body
}
}
After making this change, I now receive the following error in the debug log:
PHP Fatal error: Call to undefined function get_cc() in .../templates/emails/email-addresses.php on line 32
This means that, for whatever reason, PHP believes that the function get_cc already exists, but at the same time it is undefined.
I was not the original developer. I took over the project from a contractor who is not available. It does seem clear that this file is heavily modified from the original. I am certain that the value returned by the function must be kept, so I cannot just comment out the call.
Given the information above, what options do I have to either workaround or fix this issue?
It turns out that, unlike a standard function definition in PHP, function definitions wrapped in if (!function_exists('function_name')) { ... } block must precede any call to that function.
In this case, the function definition (line 36) followed the call (line 32). This caused the function to appear to PHP as undefined:
// Not working!
$value = get_cc($code);
if (!function_exists('get_cc')) {
function get_cc( $code ) {
...
}
}
Switching the order so that the function definition came first fixed the issue:
// Working!
if (!function_exists('get_cc')) {
function get_cc( $code ) {
...
}
}
$value = get_cc($code);
As of right now, PHP's documentation does not mention this issue.
I have an existing, well functional PHP Application. I am looking into an server upgrade which includes moving from PHP5 to PHP7. As far as I can tell from the documentation Smarty3 should be compatible with PHP7. However, when testing this, it turns out that Smarty refuses to compile the templates after the upgrade.
The source of the problem seems to be this line:
$this->smarty->registerPlugin('compiler', 'asset_url', array(&$this, 'asset_url'));
which causes the PHP application to crash like this:
Notice: Array to string conversion in /usr/share/php/smarty3/sysplugins/smarty_internal_templatecompilerbase.php on line 415
Notice: Undefined property: template::$Array in /usr/share/php/smarty3/sysplugins/smarty_internal_templatecompilerbase.php on line 415
Fatal error: Uncaught Error: Function name must be a string in /usr/share/php/smarty3/sysplugins/smarty_internal_templatecompilerbase.php:415
Stack trace:
#0 /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php(3585): Smarty_Internal_TemplateCompilerBase->compileTag('asset_url', Array)
#1 /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php(4413): Smarty_Internal_Templateparser->yy_r32()
#2 /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php(4515): Smarty_Internal_Templateparser->yy_reduce(32)
#3 /usr/share/php/smarty3/sysplugins/smarty_internal_smartytemplatecompiler.php(118): Smarty_Internal_Templateparser->doParse(3, '}')
#4 /usr/share/php/smarty3/sysplugins/smarty_internal_templatecompilerbase.php(283): Smarty_Internal_SmartyTemplateCompiler->doCompile('<!DOCTYPE html>...')
#5 /usr/share/php/smarty3/sysplugins/smarty_internal_template.php(197): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template))
#6 /usr/share/php/smarty3/sysplugins/sm in /usr/share/php/smarty3/sysplugins/smarty_internal_templatecompilerbase.php on line 415
The suspicious line 415 looks like this:
$function = $this->smarty->registered_plugins[$plugin_type][$tag][0];
if (!is_array($function)) {
return $function($new_args, $this);
} elseif (is_object($function[0])) {
return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this); <- Crash here!
} else {
return call_user_func_array($function, array($new_args, $this));
}
I assume this is some fundamental difference between PHP5 and PHP7 which is biting me, but I can't seem to figure out what it is. Could somebody give me a few pointers to how to sort this out?
If you're using an older version of Smarty, you might want to update. There were some fixes added in 3.1.28 for PHP 7 compatibility that will probably help with this.
See https://github.com/smarty-php/smarty/blob/master/change_log.txt
The explanation of this issue (besides the most common ones like "you have an outdated version") is that in PHP 7 it has been changed the way how code is parsed. In your case:
$this->smarty->registered_plugins[$plugin_type][$tag][0];
is parsed differently in PHP 5 and 7:
PHP 5: $this->smarty->{registered_plugins[$plugin_type][$tag][0]};
PHP 7: ($this->smarty->registered_plugins)[$plugin_type][$tag][0];
You can try fixing these code pieces by placing braces and brackets to indicate the parser what are your exact intentions, but I'd suggest you to upgrade Smarty.
errors in Artio Booking with Joomla 3.3.6
Fatal error: Declaration of TableReservation::bind() must be
compatible with JTableInterface::bind($src, $ignore = Array)
Fatal error: Declaration of TableSubject::store() must be compatible
with JTableInterface::store($updateNulls = false)
Ok, After some internal plugin coding, I managed to fix this issue.
Replace your files with these in administrator\components\com_booking\tables
Note : Please take a backup before proceeding.
Download
As the error tells you should change function parameter as there in the error -
You should edit your file(inside table folder of component) which has definition of TableReservation class and search for bind function and change
function bind()
to
function bind($src, $ignore = Array)
similarly search for TableSubject class and there change
function store()
to
function store($updateNulls = false)
You should also check on the component site if they provide update.There might be more errors once you fix this.
I was upgrading magento when something went wrong and now when I try to login to admin, I am unable to log in to back end admin of magento and I get the following error
Fatal error: Call to undefined method Zend_XmlRpc_Value::getGenerator() in /home/boutique/public_html/app/code/core/Zend/XmlRpc/Request.php on line 413
and the code on respective lines is
/**
* Create XML request
*
* #return string
*/
public function saveXml()
{
$args = $this->_getXmlRpcParams();
$method = $this->getMethod();
$generator = Zend_XmlRpc_Value::getGenerator();
$generator->openElement('methodCall')
->openElement('methodName', $method)
->closeElement('methodName');
I cant understand why this issue is happening, I tried replacing request.php and response.php files from fresh download of magento..
can body help me? why this eror is popping?
There's something about your installation of PHP and Magento that's broken — for some reason the Zend_XmlRpc_Value object that's instantiated doesn't contain a getGenerator method. The class for this object is normally defined in
lib/Zend/XmlRpc/Value.php
However, it's possible there may be a class override in place at
app/code/core/Zend/XmlRpc/Value.php
app/code/community/Zend/XmlRpc/Value.php
app/code/local/Zend/XmlRpc/Value.php
It's also possible your system may have another version of the zend framework installed somewhere in the PHP include path.
By default error page in ZF looks like this:
Fatal error: Uncaught exception 'Zend_Form_Exception' with message 'Method setDeault does not exist' in /usr/home/.../library/Zend/Form.php:2838
Stack trace:
#0 [internal function]: Zend_Form->__call('setDeault', Array)
#1 /usr/home/.../application/admin/controllers/TagsController.php(40): Web_Form_Admintags->setDeault('tagstext', '....')
#2 /usr/home/.../library/Zend/
Is there any ways to change this messy error description to more clearly form (something like Django error page)?
This is not an error page but a standard PHP output for uncaught exceptions. As far as I know there is no default error page in Zend Framework -- you will have to create your own by creating an appropriate view for the ErrorController.
AFAICR this is using the Error controller right? That message is basically the dump of the exception object. You can split this up by calling different parts individually rather than dumping the whole lot as a string. See the manual page I linked to.
Make sure you're only providing exception information when the APPLICATION_ENVIRONMENT is set to development as well.
The exception is formatted using new lines, which are however not transformed to in html.
You have several options...
Wrap the error with <pre></pre> tags
Create custom exception handler
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
}
set_exception_handler('exception_handler');