Creation of dynamic property Drupal\commerce\Plugin\ is deprecated - php

AFAIK, Drupal Commerce 2.33 is not fully compatible with PHP 8 yet. Still, I installed the module in Drupal 10 which is run only on PHP 8.
When I flush all caches, I receive the error
Deprecated function: Creation of dynamic property
Drupal\commerce\Plugin\Field\FieldType\PluginItemDeriver::$basePluginId
is deprecated in
Drupal\commerce\Plugin\Field\FieldType\PluginItemDeriver->__construct()
(line 36 of
modules\contrib\commerce\src\Plugin\Field\FieldType\PluginItemDeriver.php).
The line 36 is the second one in the following function
public function __construct($base_plugin_id, EventDispatcherInterface $event_dispatcher) {
$this->basePluginId = $base_plugin_id;
$this->eventDispatcher = $event_dispatcher;
}
First I tried to add line #[AllowDynamicProperties] but it didn't help
Then I added protected $basePluginId; before protected $eventDispatcher; and now the error is not displayed
But will everything work correctly after such a modification?
Or maybe there is another safe way to resolve the issue?
Or maybe it's just a "warning" and everything will be working fine without any modifications?

Related

Call to undefined method Illuminate\Foundation\Application::share() when use breadcrumbs package

Today, I want to use Laravel Breadcrumbs package with laravel 5.4. I used that with laravel 5.3 without any problem and all things worked fine.
But when run the application I got this error :
FatalErrorException in ServiceProvider.php line 34:
Call to undefined method Illuminate\Foundation\Application::share()
I searched for that and I found that As of laravel 5.4 share has been removed. and I must to use the singleton instead.
But when I did that changes In the ServiceProvider.php like this :
public function register()
{
$this->app['breadcrumbs'] = $this->app->singleton(function($app)
{
$breadcrumbs = $this->app->make('DaveJamesMiller\Breadcrumbs\Manager');
$viewPath = __DIR__ . '/../views/';
$this->loadViewsFrom($viewPath, 'breadcrumbs');
$this->loadViewsFrom($viewPath, 'laravel-breadcrumbs'); // Backwards-compatibility with 2.x
$breadcrumbs->setView($app['config']['breadcrumbs.view']);
return $breadcrumbs;
});
}
I got another error. like this :
ErrorException in Container.php line 1057:
Illegal offset type in unset
I do not know what is problem. can anyone help me ?
Update :
I found the solution Here.
The first problem is that the singleton instance expects a class to bind to as the first argument, which in this case is 'breadcrumbs'.
The second problem is that you don't need to explicitly declare the array key for the singleton instance. So this is how it should look:
$this->app->singleton('breadcrumbs', function($app)
The next problem is that the package you're using has been abandoned. The developer will no longer maintain it.
The final problem is that you're using a version < 3.0.2. So change the version in your composer.json to 3.0.2 and then install that, then you shouldn't need to be modifying any files.

Issue upgrading Joomla 1.5 to Joomla 2.5

I'm having many issues upgrading a custom Joomla site from Joomla 1.5 to 2.5. I have the template installed on the back end, but the front end keeps displaying error messages. I don't really know too much PHP, so I'm having a hard time trying to figure out what is all going on.
First, I use jupgrade to upgrade the core of the site.
Then I followed this video to make the custom site template ready for Joomla 2.5:
http://www.youtube.com/watch?v=xqnm1DJn3jE
In my "/jupgrade/templates/my-template/menus/ folder there is a file called Base.class.php.
When I try to go the new home page of my site, in the /jupgrade/ folder, I get the following error:
Fatal error: Class 'JParameter' not found in ../public_html/jupgrade/templates/my-template/menus/Base.class.php on line 46
Line 46 reads:
function createParameterObject($param, $path='', $type='menu') {
return new JParameter($param, $path); }
According to this website (http://docs.joomla.org/Upgrading_a_Joomla_1.5_extension_to_Joomla_1.6#Converting_Your_JParameters_to_JForms) I need to change "JParameters" to "JForm".
When I change it, I now am getting the following error when going to the home page:
Catchable fatal error: Argument 2 passed to JForm::__construct() must be an array, string given, called in ../public_html/jupgrade/templates/my-template/menus/Base.class.php on line 46 and defined in ../public_html/jupgrade/libraries/joomla/form/form.php on line 80
Line 80 of the form.php file is:
public function __construct($name, array $options = array())
{
// Set the name for the form.
$this->name = $name;
// Initialise the JRegistry data.
$this->data = new JRegistry;
// Set the options if specified.
$this->options['control'] = isset($options['control']) ? $options['control'] : false;
}
Does anyone have any advice on how to solve this issue?
Actually you don't need to change JParameter to JForm. We had the exact issues before and we have explained them here.
JParameter is no longer included by default in Joomla 2.5. In short, you will need to include using the jinclude directive. That's actually the fastest way to solve your problem.
Revert back your changes and just include the JParameter class.

Laravel 3 - PHP Warning: in_array() expects parameter 2 to be array

I am working with a code that was not written by me. It is a Laravel 3 application, it is giving me the following error:
PHP Warning: in_array() expects parameter 2 to be array, null given in /Users/use/Documents/project/laravel/error.php on line 87
Can you give me pointers on how to debug it? It is giving error in the file which was included in the framework. Also I using the php's inbuilt server to run the application. Does that cause problems? Any pointers are helpful.
PS: I am on a mac.
After looking at the source code it appears that you are getting the error from this file:
// laravel/error.php
// line 86
if (in_array($code, Config::get('error.ignore')))
{
return static::log($exception);
}
The method appears to be looking for the error.ignore config variable:
// application/config/error.php
// line 16
'ignore' => array(),
Check the application/config/error.php file, make sure that 'ignore' is set to an array. If it already is, then you likely have an error in one of the other config files which is corrupting the array.
Hopefully this helps and shows the steps you can take in tracking down the source of an error.
You can get this also if you're using composer and the required files have not been installed after a fresh checkout of the project. To resolve:
$ composer install
Or similar. To actually get a head on this information I had to throw $exception in the error.php file around line 87, then I saw the reason in the Apache error logs.
Most of this errors is about of parameters definition bug.
for example sometimes coder write
protected $guarded = 'title';
instead of
protected $guarded = ['title'];
That makes the paroblem

Fatal error: Call to undefined method Zend_XmlRpc_Value::getGenerator() magento

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.

Symfony2 - How to delete/move an entity?

I am learning symfony2 and atfer creating some Doctrine Entities in a bundle, I wanted to move them.
However, after moving, and changing any instances of them being referenced, I was getting errors when trying to run my application.
I moved them back, and everything was fine.
Now I am just tyring to remove them completly, but again, I get errors when doing so.
Any help on removing Entities entirely?
I did exactly the same thing that Mr Pablo did, but for a bundle : I moved a bundle (renamed) and modified all calls to it.
I have the same error :
ErrorException: Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php line 65
at ErrorHandler->handle() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
at AbstractToken->getUsername() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php line 56
at SecurityDataCollector->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php line 174
at Profiler->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php line 90
at ProfilerListener->onKernelResponse()
at call_user_func() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php line 82
at TraceableEventDispatcher->doDispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3678
at EventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4754
at ContainerAwareEventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3904
at HttpKernel->filterResponse() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3896
at HttpKernel->handleRaw() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3846
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4791
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/bootstrap.php.cache line 547
at Kernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/web/app_dev.php line 20
Some help will be very welcomed :)
EDIT:
Well I solved the problem, Adam Stacey had heard it well :)
Before changing anything, I was logged in the website, by using FOSUserBundle firewall.
By changing the name of the bundle, it fooled the firewall and it was stuck at line 70 of ./vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
Here is the function :
public function getUsername()
{
if ($this->user instanceof UserInterface) {
return $this->user->getUsername();
}
return (string) $this->user;
}
So I commented out the line return (string) $this->user;, reloaded the webpage, logged out, than reverted the comment. And voilà !
What kind of errors were you getting?
Make sure you:
Clear cache
Rebuild database
Don't have any entity relationships with it
Don't have any code based on the entities
Like Inori mentioned have you tried rebuilding your entities?
If not try this from the CLI:
php app/console doctrine:generate:entities Acme
php app/console doctrine:schema:update --force
Replace "Acme" with your name, company name or whatever you have used in your bundles.
The other thing you may have to do is remove any instances where you have used the entities.
For example, you may have some entities in the controllers that look like this:
use Acme\BundleName\Entity\SomeEntity;
use Acme\BundleName\Entity\AnotherEntity;
They will need to be removed.
If you have the details of the particular errors that are coming up let me know what they are and I will try and help you further.
I have heard that this can also sometimes be to do with sessions. Are you using any bundles for authentication or anything like that?
In your php.ini file do you have your set to:
session.auto_start = Off
This may be way off, but worth a go. Let me know.
On a separate note. Did your server setup pass the checks in the app/check.php file that you can run via CLI?

Categories