Symfony2 dev.log since weeks I'm seeing this php.INFO lines - php

php.INFO: The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the setMethods() method instead.
{"type":16384,"file":"/martin/home/www/test/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php","line":652,"level":28928}
php -v
PHP 5.5.9-1ubuntu4.21
Symfony version 2.8.18
Does someone get this also ? I'm trying to optimize the dev logging and get as few lines as possible.

You are getting this as a pre-caution before you decide to upgrade to Symfony 3. Since this is deprecated, you can (should) change your routing from something like:
$route = new Route();
$route->setPattern('/article/{id}');
$route->setRequirement('_method', 'POST|PUT');
$route->setRequirement('_scheme', 'https');
To:
$route = new Route();
$route->setPath('/article/{id}');
$route->setMethods(array('POST', 'PUT'));
$route->setSchemes('https');
Notice specially the change of setRequirement('_method', ... to setMethods() (what the dev log is suggesting basically).
You can find more info here: https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md

Related

How to replace this php line =& from php 5.6 to 7.4? [duplicate]

I've just got an error.
When I try to assign an object like this:
$obj_md = new MDB2();
The error I get is "Assigning the return value of new by reference is deprecated". Actually I've been looking for a solution but the only one I've seen is just turn down the politicy of php.ini (error_reporting). I've tried it too, but it didn't work.
In PHP5 this idiom is deprecated
$obj_md =& new MDB2();
You sure you've not missed an ampersand in your sample code? That would generate the warning you state, but it is not required and can be removed.
To see why this idiom was used in PHP4, see this manual page (note that PHP4 is long dead and this link is to an archived version of the relevant page)
I recently moved a site using SimplePie (http://simplepie.org/) from a server that was using PHP 5.2.17 to one that is using PHP 5.3.2. It was after this move that I began receiving a list of error messages such as this one:
Deprecated: Assigning the return value of new by reference is
deprecated in .../php/simplepie.inc on line 738
After reviewing several discussions of this issue, I cleared things up by replacing all the instances of =& new with = new in the simplepie.inc file.
I'm not experienced enough to know if this will work in all instances where these error messages are received but it worked in this particular case and it may be worth trying.
Perhaps the constructor of MDB2 has some code that uses a $variable =& new ClassName();
Nitin is correct - the issue is actually in the MDB2 code.
According to Replacement for PEAR: MDB2 on PHP 5.3 you can update to the SVN version of MDB2 for a version which is PHP5.3 compatible.
As that answer was given in March 2010, and http://pear.php.net/package/MDB2/ shows a release some months later, I expect the current version of MDB2 will solve the issue also.
I had the same problem. I already had the '&' and still it was giving the same warning.
I'm using PHP 5.3 with WAMP and all i did was REMOVE '&' sign and the warning was gone.
$obj= new stdClass(); //Without '&' sign.
& is used in PHP to pass an object to a method / assign a new object to a variable by reference. It is deprecated in PHP 5 because PHP 5 passes all objects by reference by default.
just remove new in the $obj_md =& new MDB2();
It happened because of PHP 5.3 , which comes in WAMP 2.0i package and not Joomla.
You have two choices to fix it,
either use WAMP 2h (previous version) or download PHP 5.2.9-2 addon from WAMP website.
Upgrade your pear/MDB2 from console:
# pear upgrade MDB2-beta
# pear upgrade MDB2_Driver_Mysql-beta
Problem solved at version 2.5.0b3
C:\wamp\www\..\libraries\pattemplate
1.ini_set('display_errors', 0);
$this->_modules[$moduleType][$sig] =&new $moduleClass; wrong
$this->_modules[$moduleType][$sig] =new $moduleClass; Right

Method setSQLLogger deprecated - Doctrine\DBAL\Configuration

I am in the process of upgrading an application from Symfony 5.4 to Symfony 6.0. Along the way, I had to upgrade some doctrine libraries.
We are currently using setSQLLogger(null) to avoid having SQL logging enabled. By using the newer version of Doctrine, I am getting a warning:
The Doctrine\DBAL\Configuration::setSQLLogger method is deprecated (Use {#see setMiddlewares()} and {#see \Doctrine\DBAL\Logging\Middleware} instead.).
I could not figure out how can I replace setSQLLogger(null) with setMiddlewares so I could disable the SQL logging.
Did anyone have this issue and managed to fix it?
Thanks.
I replaced this code:
$em->getConnection()->getConfiguration()->setSQLLogger(null);
With:
$em->getConnection()->getConfiguration()->setMiddlewares([new \Doctrine\DBAL\Logging\Middleware(new \Psr\Log\NullLogger())]);
This puts the NullLogger as the only middleware.
You should configure a middleware in order to accept the NullLogger, then use it along with setMiddlewares method.
So from symfony standpoint, you can do something like
# configuration.yaml // or whatever name you have
services:
doctrine.logging.middleware.null: // or whatever name you prefer
class: Doctrine\DBAL\Logging\Middleware
autowire: false
arguments:
- #FQCN or service id of NullLogger
Then you can inject it where you were using setLogger and replace that method call with setMiddlewares.
I didn't tried it myself, as we're running on older version, but I'm pretty confident this should resolve your issue.

Quickest way to get Expression Engine v 2.5.5 working with PHP7

A client’s host has recently updated their server to run PHP 7, which has broken their EE 2.5.5. site (“Call to undefined function mysql_connect()”).
I tried upgrading EE to version 2.11.9 but get errors:
Frontend: can’t find safecracker_lib
Control Panel: PATH_MOD not defined in mod_structure.php, fixing this leads down a rabbit hole starting with an error related to not being able to instantiate the pagination class somewhere.
I just need to get the site running until I build a new site, what is the quickest way I can get the site running with PHP 7?
In your config folder there is a file named database.php
change the line:
$db['expressionengine']['dbdriver'] = 'mysql';
to
$db['expressionengine']['dbdriver'] = 'mysqli';
mysql_connect() has been deprecated since PHP 5 and removed in PHP 7 so you cannot use this function or any of the old mysql functions.
You need to upgrade your codebase, or downgrade your PHP version (highly discouraged).
In regards to your missing pagination class, you may not have implemented core classes that were required when upgrading.
Try running on your command line:
php system/ee/eecms upgrade
You can also read the documentation on how to upgrade the codebase for Expression Engine here.

TYPO3 9.5.11: No class named EXT: ap_docchecklogin (but class exists)

I use the extension "ap_docchecklogin" (https://extensions.typo3.org/extension/ap_docchecklogin/), which works under Typo3 8.7.29. Only under a fresh TYPO3 version 9.5.11 I get the following message:
No class named EXT:ap_docchecklogin/Classes/DocCheckAuthenticationService.php:&Antwerpes\ApDocchecklogin\DocCheckAuthenticationService
This is the code where the error happends:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'][] = 'EXT:ap_docchecklogin/Classes/DocCheckAuthenticationService.php:&Antwerpes\ApDocchecklogin\DocCheckAuthenticationService->bypassLoginForCrawling';
Of course, I cleared the cache and renewed PHP Autoload. I also looked at the extension and the class definitely exists.
Both Typo3 versions run on the same server under the same settings.
Where is the difference between the Typo3 versions? Why it works in version 8? Has anyone ever had similar problems?
According to the changelog here: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Deprecation-86279-VariousHooksAndPSR-15Middlewares.html, Hooks which is used in the extension has deprecated in the TYPO3 9 LTS version.
You can see the issue here: https://forge.typo3.org/issues/87357
you can use a custom PSR-15 middleware instead.
I made small changes in the code and it's no longer showing an error. Don't know this works for you or not (Functionality I am talking about)
But try this way...
$GLOBALS['TYPO3_CONF_VARS']
['SC_OPTIONS']
['tslib/class.tslib_fe.php']
['initFEuser'][] = 'Antwerpes\\ApDocchecklogin\\DocCheckAuthenticationService->bypassLoginForCrawling';
Does this help?

Assigning the return value of new by reference is deprecated

I've just got an error.
When I try to assign an object like this:
$obj_md = new MDB2();
The error I get is "Assigning the return value of new by reference is deprecated". Actually I've been looking for a solution but the only one I've seen is just turn down the politicy of php.ini (error_reporting). I've tried it too, but it didn't work.
In PHP5 this idiom is deprecated
$obj_md =& new MDB2();
You sure you've not missed an ampersand in your sample code? That would generate the warning you state, but it is not required and can be removed.
To see why this idiom was used in PHP4, see this manual page (note that PHP4 is long dead and this link is to an archived version of the relevant page)
I recently moved a site using SimplePie (http://simplepie.org/) from a server that was using PHP 5.2.17 to one that is using PHP 5.3.2. It was after this move that I began receiving a list of error messages such as this one:
Deprecated: Assigning the return value of new by reference is
deprecated in .../php/simplepie.inc on line 738
After reviewing several discussions of this issue, I cleared things up by replacing all the instances of =& new with = new in the simplepie.inc file.
I'm not experienced enough to know if this will work in all instances where these error messages are received but it worked in this particular case and it may be worth trying.
Perhaps the constructor of MDB2 has some code that uses a $variable =& new ClassName();
Nitin is correct - the issue is actually in the MDB2 code.
According to Replacement for PEAR: MDB2 on PHP 5.3 you can update to the SVN version of MDB2 for a version which is PHP5.3 compatible.
As that answer was given in March 2010, and http://pear.php.net/package/MDB2/ shows a release some months later, I expect the current version of MDB2 will solve the issue also.
I had the same problem. I already had the '&' and still it was giving the same warning.
I'm using PHP 5.3 with WAMP and all i did was REMOVE '&' sign and the warning was gone.
$obj= new stdClass(); //Without '&' sign.
& is used in PHP to pass an object to a method / assign a new object to a variable by reference. It is deprecated in PHP 5 because PHP 5 passes all objects by reference by default.
just remove new in the $obj_md =& new MDB2();
It happened because of PHP 5.3 , which comes in WAMP 2.0i package and not Joomla.
You have two choices to fix it,
either use WAMP 2h (previous version) or download PHP 5.2.9-2 addon from WAMP website.
Upgrade your pear/MDB2 from console:
# pear upgrade MDB2-beta
# pear upgrade MDB2_Driver_Mysql-beta
Problem solved at version 2.5.0b3
C:\wamp\www\..\libraries\pattemplate
1.ini_set('display_errors', 0);
$this->_modules[$moduleType][$sig] =&new $moduleClass; wrong
$this->_modules[$moduleType][$sig] =new $moduleClass; Right

Categories