eibiflo / cf_cookiemanager

Simple Typo3 Cookie Manager
GNU General Public License v2.0
11 stars 6 forks source link

Deprecation Notice: Creation of dynamic property #52

Closed worldwidehigh closed 6 days ago

worldwidehigh commented 1 week ago

In TYPO3 v12.4.23, PHP v8.2.24 I get this error message in the backend:

PHP Runtime Deprecation Notice: Creation of dynamic property CodingFreaks\CfCookiemanager\Domain\Model\Scans::$unknownProvider is deprecated in /home/www/drk-webseite-v2/vendor/codingfreaks/cf-cookiemanager/Classes/Domain/Repository/ScansRepository.php line 131

eibiflo commented 6 days ago

Thanks for the issue, will be fixed in the next public release.

worldwidehigh commented 6 days ago

Thank you for your quick reply. I have downloaded the new files and changed it in my version, now a new error occurs:

(1/1) TypeError
CodingFreaks\CfCookiemanager\Domain\Model\Scans::setUnknownprovider(): Argument #1 ($unknownprovider) must be of type array, int given, called in /home/www/drk-webseite-v2/vendor/codingfreaks/cf-cookiemanager/Classes/Domain/Repository/ScansRepository.php on line 131

in /home/www/drk-webseite-v2/vendor/codingfreaks/cf-cookiemanager/Classes/Domain/Model/Scans.php line 211
     *
     * @param array $unknownprovider
     * @return void
     */
    public function setUnknownprovider(array $unknownprovider)
    {
        $this->unknownprovider = $unknownprovider;
    }

at CodingFreaks\CfCookiemanager\Domain\Model\Scans->setUnknownprovider(0)
in /home/www/drk-webseite-v2/vendor/codingfreaks/cf-cookiemanager/Classes/Domain/Repository/ScansRepository.php line 131
            if(!empty($provider)){
                $foundProvider = count($provider);
            }
            $scan->setFoundProvider($foundProvider);
            $scan->setUnknownProvider($unknownProvider);
            $preparedScans[] = $scan->_getProperties();
        }
        return $preparedScans;
    }
eibiflo commented 6 days ago

Thank you! I overlooked the edge case, this happens when no unknown providers are found during the scan.

worldwidehigh commented 6 days ago

What can I do in this case? Can I skip or reset the scan?

eibiflo commented 6 days ago

The problem is that the logic is not perfectly implemented, sorry for this. The scan and import logic will be refactored soon once I finish the new scanner api, so it can be handled more cleanly.

For now, I would simply treat the variable as mixed. It's not ideal, but it still works with the Autoconfig Logic.