joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.73k stars 3.64k forks source link

Error "setcookie(): Expects exactly 3 arguments when argument #3 ($expires_or_options) is an array" when Cookie Lifetime in Language Filter is set to Year #40421

Closed ahotzler closed 1 year ago

ahotzler commented 1 year ago

Steps to reproduce the issue

Set up a Joomla with multilanguage. In the plugin "Language Filter" set the "Cookie Lifetime" to "Year". Update it to 4.3.0 Then the error appears "setcookie(): Expects exactly 3 arguments when argument #3 ($expires_or_options) is an array": regardless of template or addons.

Expected result

No Error

Actual result

Error: "setcookie(): Expects exactly 3 arguments when argument #3 ($expires_or_options) is an array"

System information (as much as possible)

Update Joomla (4.x to 4.3.0) Tested on 2 installations

Setting Value PHP Built On Linux xxx.andrehotzler.de 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 Database Type mysql Database Version 10.5.18-MariaDB-0+deb11u1 Database Collation utf8mb4_general_ci Database Connection Collation utf8mb4_general_ci Database Connection Encryption None Database Server Supports Connection Encryption No PHP Version 8.0.28 Web Server Apache WebServer to PHP Interface cgi-fcgi Joomla! Version Joomla! 4.3.0 Stable [ Bora ] 18-April-2023 16:00 GMT User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Additional comments

Log from "everything.php":

2023-04-19T10:39:15+00:00 CRITICAL 91.35.2.88 error Uncaught Throwable of type ArgumentCountError thrown with message "setcookie(): Expects exactly 3 arguments when argument #3 ($expires_or_options) is an array". Stack trace: #0 [ROOT]/libraries/src/Input/Cookie.php(102): setcookie('f9a9fa82b2a777f...', 'de-DE', Array, '', '', false, false)

1 [ROOT]/plugins/system/languagefilter/languagefilter.php(807): Joomla\CMS\Input\Cookie->set('f9a9fa82b2a777f...', 'de-DE', Array)

2 [ROOT]/plugins/system/languagefilter/languagefilter.php(481): PlgSystemLanguageFilter->setLanguageCookie('de-DE')

3 [ROOT]/libraries/src/Router/Router.php(384): PlgSystemLanguageFilter->parseRule(Object(Joomla\CMS\Router\SiteRouter), Object(Joomla\CMS\Uri\Uri))

4 [ROOT]/libraries/src/Router/Router.php(144): Joomla\CMS\Router\Router->processParseRules(Object(Joomla\CMS\Uri\Uri), 'preprocess')

5 [ROOT]/libraries/src/Application/SiteApplication.php(746): Joomla\CMS\Router\Router->parse(Object(Joomla\CMS\Uri\Uri), true)

6 [ROOT]/libraries/src/Application/SiteApplication.php(232): Joomla\CMS\Application\SiteApplication->route()

7 [ROOT]/libraries/src/Application/CMSApplication.php(293): Joomla\CMS\Application\SiteApplication->doExecute()

8 [ROOT]/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()

9 [ROOT]/index.php(32): require_once('/var/www/k24950...')

10 {main}

brianteeman commented 1 year ago

https://docs.joomla.org/J4.x:Error_setCookie()

ahotzler commented 1 year ago

Ah, i didnt find this using google

Fedik commented 1 year ago

Please test https://github.com/joomla/joomla-cms/pull/40414

ahotzler commented 1 year ago

will test tomorrow, thank you

sentixGmbH commented 1 year ago

40414 will not bring a solution. Problem still exists with Google Chrome (not with Firefox). But error message changes from setcookie-Error to a 503 error code (service unavailable)
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40421.

sentixGmbH commented 1 year ago

Error does not happen if language filter plugin is disabled. If enabled, cookie lifetime changed to "session" doesn't help


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40421.