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 Manager Database Migration - database problem found - can't migrate #7082

Open
cubex-hro opened this issue Apr 4, 2024 · 2 comments

Comments

@cubex-hro
Copy link

cubex-hro commented Apr 4, 2024

Affected version(s)

5.3.3

Description

Hey guys,

i want to explain my problem as clearly as possible, but it's very strange :)

This is my local development environment:

  • Docker Container with PHP8.1-FPM / nginx / MySQL
  • Contao 5.3.3 and contao-manager 1.8.4.

When I develop a bundle I often copy many parts from my "most recent" bundles such as: DCA definitions and change them to how I need them (because I'm lazy). As a result the following “outdated” snippet ends up in the DCA:

'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'

This leads to that pending migrations cannot be executed from the CLI or Contao Manager.

If I change this to (e.g. like in tl_form_field.php from contao-core)

'attributes' => 'data-action="contao--scroll-offset#store" onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false"',

everything is fine. I'm not sure if this is really a worth a issue, but I didn't want to hide this behavior from you.

image
@ameotoko
Copy link
Contributor

ameotoko commented May 20, 2024

The reason most probably is $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] vs $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null. My guess is – there's probably an Illegal string offset warning thrown which you cannot see, but it prevents the migration step from succeeding behind the scenes.

Short answer: $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null is the correct way to do it.

@aschempp
Copy link
Member

The reason most probably is $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] vs $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null. My guess is – there's probably an Illegal string offset warning thrown which you cannot see, but it prevents the migration step from succeeding behind the scenes.

Short answer: $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null is the correct way to do it.

That is exactly correct. And there's really not much Contao can do about that, because it's a PHP8 issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants