How to fix it? i was get error - php

[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 );

Related

TYPO3 [7.6.40] installation on localhost error

I tried to install TYPO3 [7.6.40] on my localhost using Xampp on Windows. Unfortunately I couldn't find a solution for my problem. I hope that somebody maybe knows the cause to this issue.
What I did so far:
Installed Xampp and started "Apache" and "MySQL"
Downloaded the TYPO3 [7.6.40] package, unzipped it and copied the files to "C:\xampp\htdocs"
Inside htdocs I created an empty file called "FIRST_INSTALL"
With my browser I tried to access http://localhost but only got warnings and errors
These are the warnings when I try access http://localhost :
Warning: Undefined array key "t3lib/class.t3lib_div.php" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 5095
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 5095
Warning: Undefined array key "SSL_SESSION_ID" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 3602
Warning: Undefined array key "HTTPS" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 3602
Warning: Undefined array key "HTTPS" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 3602
Warning: Undefined array key "ORIG_SCRIPT_NAME" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 3408
Warning: Undefined array key "systemLog" in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 5053
Warning: Undefined array key 1 in C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php on line 5062
Fatal error: Uncaught Error: Undefined constant "TYPO3\CMS\Core\Error\TYPO3_ERROR_DLOG" in C:\xampp\htdocs\typo3\sysext\core\Classes\Error\ErrorHandler.php:134 Stack trace: #0 C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php(3423): TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'Undefined array...', 'C:\\xampp\\htdocs...', 3423) #1 C:\xampp\htdocs\typo3\sysext\core\Classes\Utility\GeneralUtility.php(3566): TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') #2 C:\xampp\htdocs\typo3\sysext\core\Classes\Error\AbstractExceptionHandler.php(73): TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_U...') #3 C:\xampp\htdocs\typo3\sysext\core\Classes\Error\DebugExceptionHandler.php(50): TYPO3\CMS\Core\Error\AbstractExceptionHandler->writeLogEntries(Object(Error), 'WEB') #4 C:\xampp\htdocs\typo3\sysext\core\Classes\Error\AbstractExceptionHandler.php(45): TYPO3\CMS\Core\Error\DebugExceptionHandler->echoExceptionWeb(Object(Error)) #5 [internal function]: TYPO3\CMS\Core\Error\AbstractExceptionHandler->handleException(Object(Error)) #6 {main} thrown in C:\xampp\htdocs\typo3\sysext\core\Classes\Error\ErrorHandler.php on line 134
And some snippets from GeneralUtility.php (Hope this helps somehow):
GeneralUtility.php line 5094-5097
// Initialize logging
if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit']) {
self::initSysLog();
}
GeneralUtility.php line 3599-3603
if (self::cmpIP($_SERVER['REMOTE_ADDR'], $proxySSL)) {
$retVal = true;
} else {
$retVal = $_SERVER['SSL_SESSION_ID'] || strtolower($_SERVER['HTTPS']) === 'on' || (string)$_SERVER['HTTPS'] === '1';
}
GeneralUtility.php line 3403-3408
switch ((string)$getEnvName) {
case 'SCRIPT_NAME':
$retVal = self::isRunningOnCgiServerApi()
&& ($_SERVER['ORIG_PATH_INFO'] ?: $_SERVER['PATH_INFO'])
? ($_SERVER['ORIG_PATH_INFO'] ?: $_SERVER['PATH_INFO'])
: ($_SERVER['ORIG_SCRIPT_NAME'] ?: $_SERVER['SCRIPT_NAME']);
GeneralUtility.php line 3052-3062
// Init custom logging
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
$params = array('initLog' => true);
$fakeThis = false;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
self::callUserFunction($hookMethod, $params, $fakeThis);
}
}
// Init TYPO3 logging
foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) {
list($type, $destination) = explode(',', $log, 3);
Thank you in advance!
For me the problem was the wrong PHP version. I needed < 8 and had 8.0.9 or so.
I downloaded the correct XAMPP version with PHP 7.xxx and now it's running. I uninstalled the wrong version first.
Now I can start Typo3 installation.

PrestaShop Error 500 PREG_BACKTRACK_LIMIT_ERROR

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');
}

PHP Fatal PHP Fatal error: __clone method called on non-object

So, I am working on a project and I am having an issue as I keep getting both errors and warnings. I am quite new to PHP so be gentle. The program runs fine using PHP 5.5 However when I run the program in PHP 5.6 I receive several errors as follows;
[10-Oct-2016 10:04:46 America/Denver] PHP Warning: Erroneous data format for unserializing 'MMR\Bundle\CodeTyperBundle\Entity\User' in /hermes/bosnaweb14a/b1234/.../application/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php on line 833
[10-Oct-2016 10:04:46 America/Denver] PHP Notice: unserialize(): Error at offset 49 of 50 bytes in /hermes/bosnaweb14a/b1234/.../application/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php on line 833
[10-Oct-2016 10:04:46 America/Denver] PHP Fatal error: __clone method called on non-object in /hermes/bosnaweb14a/b1234/.../application/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php on line 837
Project Info
Platform: Symfony
PHP Version: 5.6
Affected Code
public function newInstance()
{
if ($this->_prototype === null) {
if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
$this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name)); //Line 833
}
}
return clone $this->_prototype; //Line 837
}
Any help would be greatly appreciated
I tested:
var_dump(clone $t=unserialize(sprintf('O:%d:"%s":0:{}', strlen('name'), 'name')));
And it works.
You have to check the value of $this->name maybe its empty or has illegal chars.
Where is $this->name set in the first place?
Quick Fix:
just add one more version i.e: PHP 5.6 for your if condition and it will be PHP_VERSION_ID === 50640 in your if condition
like:
if ($this->_prototype === null) {
if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513 || PHP_VERSION_ID === 50640) {
$this->_prototype = $this->reflClass>newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
}
}

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