Error in Wordpress - elementor after ugrading PHP 7.4 - php

After upgrading to PHP 7.4, elemntor started giving error
url: www.aldon.ltd/
Cloud Service: GCP
Server: Openlitespeed Wordpress
Linux: Ubuntu 20.04 LTS
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451
Except this notice shown at the top of webpage, all other functions are working as expected.
Code causing error
/**
* End controls section.
*
* Used to close an existing open controls section. When you use this method
* it stops adding new controls to this section.
*
* This method should be used inside _register_controls().
*
* #since 1.4.0
* #access public
*/
Public function end_controls_section() {
$stack_name = $this->get_name();
// Save the current section for the action.
$current_section = $this->current_section;
$section_id = $current_section['section'];
$args = [
'tab' => $current_section['tab'],
];
Error Log at /usr/local/lsws/logs/error.log
PHP Notice: wp_deregister_script was called incorrectorrectly. Do not deregister the jquery-core script in the administration area. To target the front-end theme, use the wp_enqueue_scrip>
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451

I resolved it for a temporary solution. Changing line no. 1204 from
if ( $dynamic_property ) ) {
to
if ( $dynamic_property && isset($settings[ $control_name ][ $dynamic_property ]) ) {

Related

Error when trying create WooCommerce subscription as admin

I am trying to manually add a subscription in WooCommerce and keep getting this error.
I have located the PHP file but am unsure of the error. Any help would be appreciated. Thank you.
Fatal error: Uncaught Error: [] operator not supported for strings
in /nas/content/live/montkdev/wp-content/plugins/woocommerce-subscriptions/includes/data-stores/class-wcs-customer-store-cached-cpt.php on line 128
Call stack:
WCS_Customer_Store_Cached_CPT::add_subscription_id_to_cache()
wp-content/plugins/woocommerce-subscriptions/includes/data-stores/class-wcs-customer-store-cached-cpt.php:236
WCS_Customer_Store_Cached_CPT::maybe_update_for_post_meta_change()
wp-includes/class-wp-hook.php:303
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:327
WP_Hook::do_action()
wp-includes/plugin.php:470
do_action()
wp-content/plugins/woocommerce-subscriptions/includes/class-wcs-post-meta-cache-manager.php:234
WCS_Post_Meta_Cache_Manager::trigger_update_cache_hook()
wp-content/plugins/woocommerce-subscriptions/includes/class-wcs-post-meta-cache-manager.php:220
WCS_Post_Meta_Cache_Manager::maybe_trigger_update_cache_hook()
wp-content/plugins/woocommerce-subscriptions/includes/class-wcs-post-meta-cache-manager.php:124
WCS_Post_Meta_Cache_Manager::meta_updated_with_previous()
wp-includes/class-wp-hook.php:303
WP_Hook::apply_filters()
wp-includes/plugin.php:189
apply_filters()
wp-includes/meta.php:205
update_metadata()
wp-includes/post.php:2335
update_post_meta()
wp-content/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php:254
WC_Data_Store_WP::update_or_delete_post_meta()
wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:214
WC_Order_Data_Store_CPT::update_post_meta()
wp-content/plugins/woocommerce-subscriptions/includes/data-stores/class-wcs-subscription-data-store-cpt.php:218
WCS_Subscription_Data_Store_CPT::update_post_meta()
wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:173
Abstract_WC_Order_Data_Store_CPT::update()
wp-content/plugins/woocommerce-subscriptions/includes/data-stores/class-wcs-subscription-data-store-cpt.php:186
WCS_Subscription_Data_Store_CPT::update()
wp-content/plugins/woocommerce/includes/class-wc-data-store.php:179
WC_Data_Store::update()
wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:185
WC_Abstract_Order::save()
wp-content/plugins/woocommerce/includes/class-wc-order.php:221
WC_Order::save()
wp-content/plugins/woocommerce-subscriptions/includes/admin/meta-boxes/class-wcs-meta-box-subscription-data.php:375
WCS_Meta_Box_Subscription_Data::save()
wp-includes/class-wp-hook.php:303
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:327
WP_Hook::do_action()
wp-includes/plugin.php:470
do_action()
wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php:222
WC_Admin_Meta_Boxes::save_meta_boxes()
wp-includes/class-wp-hook.php:305
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:327
WP_Hook::do_action()
wp-includes/plugin.php:470
do_action()
wp-includes/post.php:4468
wp_insert_post()
wp-includes/post.php:4570
wp_update_post()
wp-admin/includes/post.php:423
edit_post()
wp-admin/post.php:227
WCS has this issue in the function in the line $subscription_ids[] = $subscription_id; .
/**
* Add a subscription ID to the cached subscriptions for a given user.
*
* #param int $user_id The user the subscription belongs to.
* #param int $subscription_id A subscription to link the user in the cache.
*/
protected function add_subscription_id_to_cache( $user_id, $subscription_id ) {
$subscription_ids = $this->get_users_subscription_ids( $user_id );
if ( ! in_array( $subscription_id, $subscription_ids ) ) {
$subscription_ids[] = $subscription_id;
$this->update_subscription_id_cache( $user_id, $subscription_ids );
}
}
Try adding the below code snippet while adding the subscription if the issue persists.
remove_all_actions('wcs_update_post_meta_caches');

Parse error: parse error, expecting `'{'' Laravel

I ran php artisan route:list in eclipse folder of a laravel project and got this error. I have checked the file and there is { there.
$ php artisan route:list
Warning: Unsupported declare 'strict_types' in
/Users/frankukachukwu/eclipse-workspace/essenceglobalmart.net/ap
p/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
on line 8
Parse error: parse error, expecting `'{'' in
/Users/frankukachukwu/eclipse-workspace/essenceglobalmart.net/app/
vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
on line 19
<?php
/**
* #see https://github.com/zendframework/zend-diactoros for the canonical source repository
* #copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* #license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
namespace Zend\Diactoros;
/**
* Create an uploaded file instance from an array of values.
*
* #param array $spec A single $_FILES entry.
* #throws Exception\InvalidArgumentException if one or more of the tmp_name,
* size, or error keys are missing from $spec.
*/
function createUploadedFile(array $spec) : UploadedFile {
if (! isset($spec['tmp_name'])
|| ! isset($spec['size'])
|| ! isset($spec['error'])
) {
throw new Exception\InvalidArgumentException(sprintf(
'$spec provided to %s MUST contain each of the keys "tmp_name",'
. ' "size", and "error"; one or more were missing',
__FUNCTION__
));
}
return new UploadedFile(
$spec['tmp_name'],
$spec['size'],
$spec['error'],
isset($spec['name']) ? $spec['name'] : null,
isset($spec['type']) ? $spec['type'] : null
);
}
It seems the package that you are using is not compatible with your PHP version
You need a compatible PHP version, which is 7.0.0 - 7.0.5 || ^7.0.7.
To solve this issue you can either update your PHP version or downgrade package

Amazon S3 and Yii2

I created a code to use Amazon S3 using this composer component:
https://github.com/2amigos/yii2-resource-manager-component
This worked very well.
But I changed my server and when I upload a image to Amazon S3 I received this error:
PHP Fatal Error – yii\base\ErrorException
Class 'Aws\S3\Enum\CannedAcl' not found
I did not change anything of code, I dont understand why this error, I cant find a solution
How can I fix it?
This is the complete error :
PHP Fatal Error – yii\base\ErrorException
Class 'Aws\S3\Enum\CannedAcl' not found
1. in /opt/app-root/src/admapps/vendor/2amigos/yii2-resource-manager-component/AmazonS3ResourceManager.php at line 78
69707172737475767778798081828384858687 * #return \Guzzle\Service\Resource\Model
*/
public function save($file, $name, $options = [])
{
$options = ArrayHelper::merge([
'Bucket' => $this->bucket,
'Key' => $name,
'SourceFile' => $file->tempName,
'ACL' => CannedAcl::PUBLIC_READ // default to ACL public read
], $options);
$this->getClient()->putObject($options);
}
/**
* Removes a file
* #param string $name the name of the file to remove
* #return boolean
*/
2. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – app\controllers\BeersController::actionUploadlogobeer()
3. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – call_user_func_array:{/opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php:55}()
4. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Controller.php at line 154 – yii\base\InlineAction::runWithParams()
5. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Module.php at line 454 – yii\base\Controller::runAction()
6. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/web/Application.php at line 87 – yii\base\Module::runAction()
7. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Application.php at line 375 – yii\web\Application::handleRequest()
8. in /opt/app-root/src/admapps/web/index.php at line 13 – yii\base\Application::run()
78910111213require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../helpers/Utils.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
Posted by Bizley
This extension uses "aws/aws-sdk-php": "2.5.2" and it's very old (at GitHub version 3.18 is latest). AWS said they've removed CannedAcl in version 3 so it should not make impact on 2.5.2 (it is present in 2.5.2). Anyway there is the same issue reported about this github.com/2amigos/yii2-resource-manager-component/issues/10 – Bizley

SilverStripe PaginatedList is throwing an exception

I'm using 3.1.13 SilverStripe CMS and Framework. I have ran into troubles after creating a function inside my Page.php (class Page) and initializing it in my views (page.ss).
I want to create a pagination for my project.
Here is my error with source and trace:
[User Error] Uncaught Exception: The request must be readable as an array.
GET /?flushtoken=88455a3cc5497ee38dd7a61d75370221&flush=all
Line 28 in /var/www/project-name/framework/core/PaginatedList.php
Source
19 * Constructs a new paginated list instance around a list.
20 *
21 * #param SS_List $list The list to paginate. The getRange method will
22 * be used to get the subset of objects to show.
23 * #param array|ArrayAccess Either a map of request parameters or
24 * request object that the pagination offset is read from.
25 */
26 public function __construct(SS_List $list, $request = array()) {
27 if (!is_array($request) && !$request instanceof ArrayAccess) {
28 throw new Exception('The request must be readable as an array.');
29 }
30
31 $this->request = $request;
32 parent::__construct($list);
33 }
34
Trace
PaginatedList->__construct(DataList,)
HomePage.php:182
HomePage->PaginatedPages()
call_user_func_array(Array,Array)
Object.php:731
Object->__call(PaginatedPages,Array)
ViewableData.php:361
HomePage_Controller->PaginatedPages()
ViewableData.php:361
ViewableData->obj(PaginatedPages,,1,,)
SSViewer.php:91
SSViewer_Scope->getObj(PaginatedPages,,1,,)
SSViewer.php:504
SSViewer_DataPresenter->getObj(PaginatedPages,,1,,)
SSViewer.php:111
SSViewer_Scope->obj(PaginatedPages,,1)
.cache.themes.project-name.templates.Layout.HomePage.ss:400
include(/tmp/silverstripe-cache-php5.5.9-1ubuntu4.11-var-www-project-name/www-data/.cache.themes.project-name.templates.Layout.HomePage.ss)
SSViewer.php:1031
SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php5.5.9-1ubuntu4.11-var-www-project-name/www-data/.cache.themes.project-name.templates.Layout.HomePage.ss,HomePage_Controller,,Array,)
SSViewer.php:1098
SSViewer->process(HomePage_Controller,)
SSViewer.php:1094
SSViewer->process(HomePage_Controller)
Controller.php:203
Controller->handleAction(SS_HTTPRequest,index)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
ContentController.php:198
ContentController->handleRequest(SS_HTTPRequest,DataModel)
ModelAsController.php:78
ModelAsController->handleRequest(SS_HTTPRequest,DataModel)
RootURLController.php:130
RootURLController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/,DataModel)
main.php:177
Where is the problem? I'm following this instructions and it fails when I'm calling my function in the view.
Nevermind! I just realized that if I want to get $this->request work, I need to place that function into class Page controller.

Magento: White page on order view page

Posted this on http://magento.stackexchange.com but I haven't gotten an answer.
I am getting this error for a while and I am clueless to what is wrong with it. Whenever I click the view order page, I get a blank page. Now I installed some code on my index.php that displays the errors.
This is the error that I get:
Array ( [type] => 1 [message] => Class
'Mage_Sales_Block_Order_Info' not found [file] =>
/app/code/core/Mage/Core/Model/Layout.php [line] => 491 )
This is line 491 (and context)
/**
* Create block object instance based on block type
*
* #param string $block
* #param array $attributes
* #return Mage_Core_Block_Abstract
*/
protected function _getBlockInstance($block, array $attributes=array())
{
if (is_string($block)) {
if (strpos($block, '/')!==false) {
if (!$block = Mage::getConfig()->getBlockClassName($block)) {
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
}
}
if (class_exists($block, false) || mageFindClassFile($block)) {
$block = new $block($attributes);
}
}
if (!$block instanceof Mage_Core_Block_Abstract) {
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
}
return $block;
}
Seems nothing is wrong there (and why should it, its magento default code)
Now the next part is somewhat strange. I expected the class to live in app/code/core/Mage/Sales/Block/Order/Info I looked it up. The folders Order/Info didnt exist in my folder. Nor in the fresh install zip.
What is going on and more importantly, how can I fix this?
I hope you are using latest version of magento never mind even if it is old looks like you are missing some order block files try copying all the files properly. some times you may miss some files while you download the files from magento website check your magento zip file size that you downloaded.

Categories