PrestaShop Error 500 PREG_BACKTRACK_LIMIT_ERROR - php

I've got a problem with PrestaShop's site.
After I add product to comparison and following a link to the page it shows 500 server error. In server logs:
ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML, referer: https://svdd.ru/products-comparison
PHP Notice: Undefined index: search_query in /var/www/svddru/data/www/svdd.ru/cache/smarty/compile/9e/0b/2e/9e0b2eed3cabe548854f824a36411cf7b41c2feb.file.blocksearch-top.tpl.php on line 37, referer: https://svdd.ru/products-comparison
PHP Notice: Trying to get property of non-object in /var/www/svddru/data/www/svdd.ru/cache/smarty/compile/9e/0b/2e/9e0b2eed3cabe548854f824a36411cf7b41c2feb.file.blocksearch-top.tpl.php on line 37, referer: https://svdd.ru/products-comparison
PHP Notice: Undefined index: ajax_allowed in /var/www/svddru/data/www/svdd.ru/cache/smarty/compile/ed/74/9d/ed749d2af11acf978d4f6deb923e55d40a3b9d12.file.blockcart.tpl.php on line 86, referer: https://svdd.ru/products-comparison
PHP Notice: Trying to get property of non-object in /var/www/svddru/data/www/svdd.ru/cache/smarty/compile/ed/74/9d/ed749d2af11acf978d4f6deb923e55d40a3b9d12.file.blockcart.tpl.php on line 86, referer: https://svdd.ru/products-comparison
PHP Fatal error: Cannot use object of type Product as array in /var/www/svddru/data/www/svdd.ru/cache/smarty/compile/ed/74/9d/ed749d2af11acf978d4f6deb923e55d40a3b9d12.file.blockcart.tpl.php on line 121, referer: https://svdd.ru/products-comparison
In console log:
jquery-1.11.0.min.js:169 Uncaught ReferenceError: FancyboxI18nClose is not defined at HTMLDocument.<anonymous> (jquery-1.11.0.min.js:169) at j (jquery-1.11.0.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2) at Function.ready (jquery-1.11.0.min.js:2) at HTMLDocument.K (jquery-1.11.0.min.js:2)
Almost a month I can't understand what's wrong. Thank you in advance for any answer!

This error is thrown by this function:
public static function packJSinHTML($html_content)
{
if (strlen($html_content) > 0) {
$html_content_copy = $html_content;
if (!preg_match('/'.Media::$pattern_keepinline.'/', $html_content)) {
$html_content = preg_replace_callback(
Media::$pattern_js,
array('Media', 'packJSinHTMLpregCallback'),
$html_content,
Media::getBackTrackLimit());
// If the string is too big preg_replace return an error
// In this case, we don't compress the content
if (function_exists('preg_last_error') && preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
if (_PS_MODE_DEV_) {
Tools::error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
}
return $html_content_copy;
}
}
return $html_content;
}
return false;
}
And the problem seems to be that the content is too big for preg_replace. so you can try to increase pcre.backtrack_limit value to 1000000000.
You could also override this function and comment out these lines:
if (_PS_MODE_DEV_) {
Tools::error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
}

Related

How to reference a Class Method using an array variable in PHP7?

I've moved from PHP5 to PHP7.
The following code no longer works.
<?php
class sandbox {
function doit() {
$method = array('name' => 'testresponse');
return $this->$method['name']();
}
function testresponse(){
return "Hi!";
}
}
$h = new sandbox();
echo "Hello, " . $h->doit();
I'm wondering what is the new syntax for this?
Here are the PHP errors I'm getting
A PHP Error was encountered Severity: Notice
Severity: Notice
Message: Array to string conversion
Filename: front/sandbox.php
Line Number: 20
And
Fatal error: Uncaught Error: Function name must be a string in /var/www/application/controller/sandbox.php:20 Stack trace: #0
Change this
return $this->$method['name']();
to this
return $this->{$method['name']}();

How to fix it? i was get error

[29-Jul-2018 21:05:03 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361
[29-Jul-2018 21:05:04 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361
[29-Jul-2018 21:07:23 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361
[29-Jul-2018 21:07:24 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361
how to fix it?
this sc
https://raw.githubusercontent.com/mgp25/Instagram-API/master/src/Utils.php
Code of function is:
public static function checkFFPROBE()
{
// We only resolve this once per session and then cache the result.
if (self::$ffprobeBin === null) {
#exec('ffprobe -version 2>&1', $output, $statusCode);
if ($statusCode === 0) { // <-- line nr 361
self::$ffprobeBin = 'ffprobe';
} else {
self::$ffprobeBin = false; // Nothing found!
}
}
return self::$ffprobeBin;
}
You dont get error, it is just a php notice.
exec() as 3rd argument return status of the executed command (see more exec )
I think, you can resolve it in 3 ways:
Declare $statusCode just before 361 line ( e.g. $statusCode = null; )
Change exec() to shell_exec() ( see more shell_exec )
You can ignore php notices by setting error reporting level error_reporting( E_ALL & ~E_NOTICE );

Message: Undefined variable: get

I'm trying to join my table and it's working but I don't know why I got the following error messages.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: get
Filename: views/tambah_wali.php
Line Number: 13
Fatal error: Call to a member function result() on a non-object in C:\xampp\htdocs\ujikom_sekolah\application\views\tambah_wali.php on line 13
This is my controller:
public function tambah_wali($kode){
$data['get']=$this->madm->join_wali_siswa($kode);
$this->load->view('tambah_wali');
}
This is my model:
public function join_wali_siswa($kode) {
$this->db->select('wali_murid.nisn');
$this->db->from('siswa');
$this->db->join('wali_murid','siswa.nisn=wali_murid.nisn','right');
$this->db->where('siswa.nisn',$kode);
$query=$ambildata=$this->db->get();
if($ambildata->num_rows > 0)
return $query;
else
return null;
}
This is line 13 on my view:
<?php foreach($get->result() as $row): ?>
Load your $data['get'] in your view seems to be missing when have a $data variable must add it to view like below.
$data['get'] = $this->madm->join_wali_siswa($kode);
$this->load->view('tambah_wali', $data);

returning a json encode on an api layer i'm getting the following errors

api layer (move_shopping_list.php):
if (!isset($_GET['i_sign_in_token'])){
die(json_encode('Must pass in the i_sign_in_token into the url'));
}
if (!isset($_GET['itm_cd'])){
die(json_encode('Must pass in itm_cd into the URL'));
}
if (!isset($_GET['list_id_old']) || !isset($_GET['list_id_new'])){
die(json_encode('Must pass in the list_id_old or new value into the URL'));
}
$list = new ShoppingListItem($_GET['i_sign_in_token'], $_GET['itm_cd'], $_GET['list_id_old'], $_GET['list_id_new']);
$moveItems = $item->move_between_lists($token, $_GET['itm_cd'], $_GET['list_id_old'], $_GET['list_id_new']);
echo json_encode($moveItems);
Here is my move between lists method inside of my ShoppingListItem class:
public function move_between_lists($shopper, $new_list_id) {
global $pd, $db;
// todo: don't forget to update $this->ShoppingList
$vars = array();
$vars[] = array('i_sign_in_token', $shopper);
$vars[] = array('itm_cd', $this->ITM_CD);
$vars[] = array('list_id_old', $this->SHOPPING_LIST_ID);
$vars[] = array('list_id_new', $new_list_id);
$rows = $db->get_function_as_proc('custom.japi_shopping_list.Move_Bewteen_Lists(:i_sign_in_token, :itm_cd, :list_id_old, :list_id_new)', $vars);
if ($rows == 'Y') {
// Must have worked or it would have returned.
$this->SHOPPING_LIST_ID = $new_list_id;
return true;
} else {
return false;
}
}
I keep getting these errors and i have no idea why.. any help would be greatly appreciated.
Notice: Undefined index: i_sign_in_token in /var/www/api/move_shopping_list.php on line 3 Notice: Undefined index: itm_cd in /var/www/api/move_shopping_list.php on line 7 Notice: Undefined index: list_id_old in /var/www/api/move_shopping_list.php on line 11 Notice: Undefined index: list_id_new in /var/www/api/move_shopping_list.php on line 15 Notice: Undefined index: i_sign_in_token in /var/www/api/move_shopping_list.php on line 19 Notice: Undefined index: itm_cd in /var/www/api/move_shopping_list.php on line 19 Notice: Undefined index: list_id_old in /var/www/api/move_shopping_list.php on line 19 Notice: Undefined index: list_id_new in /var/www/api/move_shopping_list.php on line 19 Notice: Undefined variable: item in /var/www/api/move_shopping_list.php on line 20 Fatal error: Call to a member function move_between_lists() on a non-object in /var/www/api/move_shopping_list.php on line 20
If the array key in $_GET is not set, you are explicitly checking whether or not this nonexistant key is also not an empty string. The logic is wrong, you must not use && (and) but || (or).

Notice: Undefined variable: this in C:\dev\workspaces\adxweb\library\Adx\Datagrid\class.eyedatagrid.inc.php on line 885

Hii,
When I am trying to use eyedatagrid, I am getting the following error message and the datagrid is not displayed, any idea why I am getting this error message, thanx
Notice: Undefined variable: this in
Datagrid\class.eyedatagrid.inc.php on
line 885
and line 885 holds this ----
if ($this)
{
$page = $this->page;
$order = (($this->order) ? implode(':', $this->order) : '');
$filter = (($this->filter) ? implode(':', $this->filter) : '');
}
You are calling the function in static context (as I just deduced from the code you didn't show).
EyeDataGrid::printJavascript()
This is why $this isn't present.
Change the if ($this) into if (isset($this)) or disable the debug mode if you don't want notices.

Categories