Problem/Motivation

My site has been upgraded to Drupal 10.1.2 and every pageload seems to generate an error in the system log.

Deprecated function: Creation of dynamic property Cleantalk\Common\Firewall\Modules\Sfw::$set_cookies is deprecated in Cleantalk\Common\Firewall\Modules\Sfw->__construct() (line 70 of /var/www/drupal/web/modules/contrib/cleantalk/lib/Cleantalk/Common/Firewall/Modules/Sfw.php)
#0 /var/www/drupal/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real()
#1 /var/www/drupal/web/modules/contrib/cleantalk/lib/Cleantalk/Common/Firewall/Modules/Sfw.php(70): _drupal_error_handler()
#2 /var/www/drupal/web/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(115): Cleantalk\Common\Firewall\Modules\Sfw->__construct()
#3 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle()
#4 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#5 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#6 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(166): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#7 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(119): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest()
#8 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(81): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->makeSubrequestToCustomPath()
#9 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php(109): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->on404()
#10 [internal function]: Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException()
#11 /var/www/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#12 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(240): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#13 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
#14 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#15 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#16 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#17 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#18 /var/www/drupal/web/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(187): Drupal\page_cache\StackMiddleware\PageCache->handle()
#19 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle()
#20 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#21 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#22 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#23 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#24 {main}

As best I can tell, Cleantalk is still working (I get very little spam to this site because I keep it out of Search Engines)

Steps to reproduce

Upgrade from Drupal 9 to Drupal 10 using composer. Notice your site works, but every page load adds a message to the system log.

Site Info:

www-data@X:~/drupal$ drush @X status
Drupal version   : 10.1.2
Site URI         : https://X.com
DB driver        : mysql
DB hostname      : localhost
DB port          : 3306
DB username      : X
DB name          : X
Database         : Connected
Drupal bootstrap : Successful
Default theme    : bootstrap5
Admin theme      : adminimal_theme
PHP binary       : /usr/bin/php8.2
PHP config       : /etc/php/8.2/cli/php.ini
PHP OS           : Linux
PHP version      : 8.2.7
Drush script     : /var/www/drupal/vendor/drush/drush/drush
Drush version    : 12.1.3.0
Drush temp       : /tmp
Drush configs    : /var/www/drupal/vendor/drush/drush/drush.yml
Install profile  : standard
Drupal root      : /var/www/drupal/web
Site path        : sites/X.com
Files, Public    : sites/X.com/files
Files, Temp      : /tmp

Proposed resolution

N/A

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork cleantalk-3385483

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tjharman created an issue. See original summary.

serge-m’s picture

Hello.
Thank you for your request.
We will look into it and test our Anti-Spam for Drupal 10 within 3 business days.
Please, wait.

shreya_th’s picture

Assigned: Unassigned » shreya_th

shubham_jain made their first commit to this issue’s fork.

shubham_jain’s picture

Assigned: shreya_th » shubham_jain

Hi, I have fixed deprecated function, please review and verify.

shubham_jain’s picture

Status: Active » Needs review

If the above merge doesn't solve the issue then you can code this

private $logTable;
    private $dataTable;
    private $params = [];

    public function __construct($log_table, $data_table, $params = []) {

in place of public function __construct($log_table, $data_table, $params = array())to solve the issue.

serge-m’s picture

Hello and thank you for your effort.
I added your suggestions to the task. Please, wait up to 3 work days.

tjharman’s picture

The patch in #5 breaks the website.

[Sat Sep 16 08:08:38.363144 2023] [proxy_fcgi:error] [pid 1851118:tid 129741197379264] [remote 192.168.0.131:51663] AH01071: Got error 'PHP message: PHP Fatal error: Attribute "AllowDynamicProperties" cannot target method (allowed targets: class) in /var/www/drupal/web/modules/contrib/cleantalk/lib/Cleantalk/Common/Firewall/Modules/Sfw.php on line 58'

shubham_jain’s picture

Hi @tjharman, please use the code in comment #7 and the original code.

znaeff’s picture

StatusFileSize
new8.02 MB

Dear customers

We have added a new feature, now you can send debug logs without having to provide access to your site.

Please install this version and send us the debug logs.

alfaguru’s picture

StatusFileSize
new325 bytes

The MR above is not correct because the annotation to suppress the message applies at the class level, not at the function level, and it's being applied to the wrong class. I attach a patch that works for me with PHP 8.2.

znaeff’s picture

Thank you @alfaguru. I will add this patch and all the info to the task. We will check it and will let you know the results.

agoradesign’s picture

+1 for #12

serge-m’s picture

Hello,

We have fixed the issues and released a new version 9.3.0:
https://www.drupal.org/project/cleantalk/releases/9.3.0

Please, update the module and clear your website cache.

Did it help?

agoradesign’s picture

no, not all of them. I was already using 9.3.0 and still had one of these deprecation warnings:

Deprecated function: Creation of dynamic property Cleantalk\Custom\Db\Db::$db_result is deprecated in Cleantalk\Custom\Db\Db->fetchAll() (Zeile 81 in /web/modules/contrib/cleantalk/lib/Cleantalk/Custom/Db/Db.php)

znaeff’s picture

Hello agoradesign,

The warning you specified is different. Please create a separate thread.
Our developers will deal with this issue and within 5 working days we will report the result in your new thread.

znaeff’s picture

Status: Needs review » Active
glomberg’s picture

Status: Active » Fixed

The notice `Creation of dynamic property Cleantalk\Common\Firewall\Modules\Sfw::$set_cookies is deprecated` was fixed by getting changes to the common library https://github.com/CleanTalk/_sfw/commit/f4ba5b514c042786156d9152c100a2c... and these changes was loaded into the module code base
The notice `Creation of dynamic property Cleantalk\Custom\Db\Db::$db_result` was fixed by commit https://git.drupalcode.org/project/cleantalk/-/commit/837d2d8ae622f724ac...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.