Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contao 4.12-RC1 Error invoking template editor #3238

Closed
Seefahrer opened this issue Aug 2, 2021 · 15 comments · Fixed by #3243 or #3245
Closed

Contao 4.12-RC1 Error invoking template editor #3238

Seefahrer opened this issue Aug 2, 2021 · 15 comments · Fixed by #3243 or #3245
Labels
Milestone

Comments

@Seefahrer
Copy link

Contao 4.12-RC1:

Description

Invoking the template editor in the backend causes fllwg error message:

request.CRITICAL: Uncaught PHP Exception ValueError: "func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function" at /Users/georg/Websites/cmsc4ME/var/cache/prod/contao/dca/tl_templates.php line 345 {"exception":"[object] (ValueError(code: 0): func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function at /Users/georg/Websites/cmsc4ME/var/cache/prod/contao/dca/tl_templates.php:345)"} []

@leofeyer leofeyer added the bug label Aug 2, 2021
@leofeyer leofeyer added this to the 4.12 milestone Aug 2, 2021
@fritzmg
Copy link
Contributor

fritzmg commented Aug 2, 2021

I could not reproduce the problem. @Seefahrer enable the debug mode and post the stack trace for more information.

@ausi
Copy link
Member

ausi commented Aug 2, 2021

As the error message shows line 345 of the cached tl_templates.php file I would assume that the relevant code comes from an extension or a DCA file of the application.

@Seefahrer do you have any extensions installed?

@Seefahrer
Copy link
Author

Installed extensions as per composer.json:

"bugbuster/contao-visitors-bundle": "^1.7",
"contao/conflicts": "*@dev",
"contao/manager-bundle": "^4.12",
"do-while/contao-ticker-bundle": "^1.1",
"fritzmg/contao-lightcase": "dev-master",
"inspiredminds/contao-wowjs": "^1.1",
"jrgregory/m17-sticky-backend-footer": "^2.0",
"madeyourday/contao-rocksolid-custom-elements": "^2.2",
"madeyourday/contao-rocksolid-frontend-helper": "^2.0",
"madeyourday/contao-rocksolid-icon-picker": "^2.0",
"madeyourday/contao-rocksolid-slider": "^2.0",
"oveleon/contao-cookiebar": "^1.9“,
"terminal42/contao-ajaxform": "^1.0",
"terminal42/contao-changelanguage": "^3.1",
"terminal42/contao-easy_themes": "^2.2“

stack trace:

`
ErrorException:
Warning: Undefined array key "TL_EASY_THEMES_MODULES"

at vendor/terminal42/contao-easy_themes/config/config.php:65
at include('/Users/georg/Websites/carlito/vendor/terminal42/contao-easy_themes/config/config.php')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:179)
at Contao\Config->initialize()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:144)
at Contao\Config::getInstance()
(vendor/contao/core-bundle/src/Framework/Adapter.php:44)
at Contao\CoreBundle\Framework\Adapter->__call('getInstance', array())
(vendor/contao/core-bundle/src/Framework/ContaoFramework.php:301)
at Contao\CoreBundle\Framework\ContaoFramework->initializeFramework()
(vendor/contao/core-bundle/src/Framework/ContaoFramework.php:158)
at Contao\CoreBundle\Framework\ContaoFramework->initialize()
(vendor/contao/core-bundle/src/Security/User/ContaoUserProvider.php:69)
at Contao\CoreBundle\Security\User\ContaoUserProvider->loadUserByUsername('Georg')
(vendor/contao/core-bundle/src/Security/User/ContaoUserProvider.php:88)
at Contao\CoreBundle\Security\User\ContaoUserProvider->refreshUser(object(BackendUser))
(vendor/symfony/security-http/Firewall/ContextListener.php:216)
at Symfony\Component\Security\Http\Firewall\ContextListener->refreshUser(object(UsernamePasswordToken))
(vendor/symfony/security-http/Firewall/ContextListener.php:131)
at Symfony\Component\Security\Http\Firewall\ContextListener->authenticate(object(RequestEvent))
(vendor/symfony/security-bundle/Debug/WrappedLazyListener.php:49)
at Symfony\Bundle\SecurityBundle\Debug\WrappedLazyListener->authenticate(object(RequestEvent))
(vendor/symfony/security-http/Firewall/AbstractListener.php:26)
at Symfony\Component\Security\Http\Firewall\AbstractListener->__invoke(object(RequestEvent))
(vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php:62)
at Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener->callListeners(object(RequestEvent), object(Generator))
(vendor/symfony/security-http/Firewall.php:86)
at Symfony\Component\Security\Http\Firewall->onKernelRequest(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
(vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117)
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
(vendor/symfony/event-dispatcher/EventDispatcher.php:230)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(RequestEvent))
(vendor/symfony/event-dispatcher/EventDispatcher.php:59)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
(vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
(vendor/symfony/http-kernel/HttpKernel.php:133)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:79)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:195)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:31) `

@bytehead
Copy link
Member

bytehead commented Aug 2, 2021

easy themes is not php8 compatible as far as I know.

@ausi
Copy link
Member

ausi commented Aug 2, 2021

The stack trace is from a different error/warning: Undefined array key "TL_EASY_THEMES_MODULES"

The error from your original post is func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function

@Seefahrer
Copy link
Author

it’s the only stack trace I can provide. The error is obviously not caused by Easy_Themes.
Removal of Easy_Themes did not solve the issue ...

@fritzmg
Copy link
Contributor

fritzmg commented Aug 2, 2021

it’s the only stack trace I can provide. The error is obviously not caused by Easy_Themes.

You need to first solve the warning from that extension.

Removal of Easy_Themes did not solve the issue ...

Now you should be able to provide the stack trace for your original error (unless there is another Warning before that).

@Seefahrer
Copy link
Author

Many thanks for the info!

Stack trace now:

`
ValueError:
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function

at vendor/contao/core-bundle/src/Resources/contao/dca/tl_templates.php:590
at func_get_arg(12)
(vendor/contao/core-bundle/src/Resources/contao/dca/tl_templates.php:590)
at tl_templates->editSource(array('id' => 'templates/freestyle-fx', 'fileNameEncoded' => 'freestyle-fx', 'type' => 'folder'), 'act=source', 'Den Quelltext der Datei "templates/freestyle-fx" bearbeiten', 'Den Quelltext der Datei "templates/freestyle-fx" bearbeiten', 'editor.svg', ' class="source"')
(vendor/madeyourday/contao-rocksolid-custom-elements/src/Resources/contao/dca/tl_templates.php:27)
at Contao\DcaLoader->{closure}(array('id' => 'templates/freestyle-fx', 'fileNameEncoded' => 'freestyle-fx', 'type' => 'folder'), 'act=source', 'Den Quelltext der Datei "templates/freestyle-fx" bearbeiten', 'Den Quelltext der Datei "templates/freestyle-fx" bearbeiten', 'editor.svg', ' class="source"', 'tl_templates', array(), null, false, null, null, object(DC_Folder))
(vendor/contao/core-bundle/src/Resources/contao/classes/DataContainer.php:813)
at Contao\DataContainer->generateButtons(array('id' => 'templates/freestyle-fx', 'fileNameEncoded' => 'freestyle-fx', 'type' => 'folder'), 'tl_templates')
(vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Folder.php:2814)
at Contao\DC_Folder->generateTree('/Users/georg/Websites/carlito/templates', 0, false, true, false, array())
(vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Folder.php:441)
at Contao\DC_Folder->showAll()
(vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:648)
at Contao\Backend->getBackendModule('tpl_editor', null)
(vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:167)
at Contao\BackendMain->run()
(vendor/contao/core-bundle/src/Controller/BackendController.php:49)
at Contao\CoreBundle\Controller\BackendController->mainAction()
(vendor/symfony/http-kernel/HttpKernel.php:157)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:79)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:195)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:31) `

@m-vo
Copy link
Member

m-vo commented Aug 2, 2021

Could it be the button callback here not including all parameters so that a func_get_arg(12) fails?

Seems func_get_arg fails even if the parameters are optional: https://3v4l.org/sAE40#v8.0.9

@ausi
Copy link
Member

ausi commented Aug 2, 2021

IMO this is a PHP 8 error on line

$dc = (@func_get_arg(12) ?: null);

We have to check func_num_args() first there I think.

Silencing with @ works in PHP 7, but not PHP 8.

@ausi ausi removed the unconfirmed label Aug 2, 2021
@ausi
Copy link
Member

ausi commented Aug 2, 2021

Same in

$dc = (@func_get_arg(12) ?: null);

@m-vo
Copy link
Member

m-vo commented Aug 2, 2021

Screenshot_20210802_131524

🙈

@ausi
Copy link
Member

ausi commented Aug 2, 2021

I will make a PR.

@ausi
Copy link
Member

ausi commented Aug 2, 2021

Closed in favor of #3243 and #3245

@ausi ausi closed this as completed Aug 2, 2021
leofeyer pushed a commit that referenced this issue Aug 2, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #3238

Commits
-------

199e421 Fix func_get_arg ValueError
This was linked to pull requests Aug 2, 2021
leofeyer pushed a commit that referenced this issue Aug 2, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #3238

Backport of #3243 for Contao 4.9

Commits
-------

afb783e Fix func_get_arg ValueError
@ausi
Copy link
Member

ausi commented Aug 2, 2021

@Seefahrer thank you for testing the RC version!

bezin pushed a commit to bezin/contao that referenced this issue Nov 26, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes contao#3238

Backport of contao#3243 for Contao 4.9

Commits
-------

afb783e Fix func_get_arg ValueError
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
6 participants