Got error 'PHP message: PHP Warning - "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Your software
My Mautic version is: 2.16
My PHP version is:7.3.14

Your problem
My problem is:
errors generating
These errors are showing in the log:
SERVER LOG:
[Thu Feb 13 13:15:17.461213 2020] [proxy_fcgi:error] [pid 33967:tid 139796110354176] [client 23.100.232.233:47882] AH01071: Got error ‘PHP message: PHP Warning - “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? - in file /var/www/vhosts/MYDOMAIN/MY SUBDOMAIN/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636PHP message: PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /var/www/vhosts/MYDOMAIN/MY SUBDOMAIN/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636PHP message: PHP Warning - “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? - in file MYMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665PHP message: PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in MYMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665’

Mautic Logs:

[2020-02-13 17:45:19] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO mauhu_campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from mauhu_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':dateAdded as date_added, :message as reason from mauhu_campaign_lead_event_log ’ at line 2

Steps I have tried to fix the problem: Cleared cache
looked to open unitofwork.php line 2665 but it does not exist in the file structure in error

@EJL
Thanks for posting this issue. If you’re looking for a quick fix, try switching back from PHP 7.3 to PHP 7.2.

I’ve seen the error you posted, “continue” targeting switch is equivalent to “break”, only happening on PHP 7.3, but I didn’t come across it anymore after the team added support for 7.3 in Mautic 2.16. Did you upgrade to PHP 7.3 before or after upgrading to Mautic 2.16?

Could you please give a bit more details about your environment, like the server software you’re using? From the folder structure, may I assume you’re using Plesk for Linux?

Thanks in advance!!

1 Like

7.3 was in place on this machine for several months.
I upgraded to Mautic 2.16 this afternoon

CPU Intel® Xeon® CPU E5-2660 v4 @ 2.00GHz 6 core
Plesk Obsidian v18.0.23_build1800200206.14 os_CentOS 7
CentOS Linux 7.7.1908 (Core)

Memory Usage
12 GB Total 53% Usage
MariaDB 10.4.12

  • Edit* Changing to PHP 7.2 seemed to fix the error
    The database field error was unrelated and still present

7.3 support was only added in 2.16.0 which was released today, so the error might be related to that (from before the upgrade). If you switch back to 7.3 again now, does Mautic work without errors? Or are you still experiencing issues then?

Thanks!

switching back to PHP 7.3 bring the error right back:

[Mon Feb 17 16:14:01.971372 2020] [proxy_fcgi:error] [pid 29058:tid 140621524117248] [client 198.147.23.149:35746] AH01071: Got error ‘PHP message: PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /var/www/vhosts/mautic-install/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636PHP message: PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /var/www/vhosts/mautic-install/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665’,

Found the issue. I wrote down more details about it, including current workarounds, here: https://github.com/mautic/mautic/issues/7843#issuecomment-587360150

We’re planning to fix this in 2.16.1, for workarounds until that time please check the GitHub issue. :slight_smile:
Thanks for reporting this!

1 Like

Your software
My Mautic version is: 2.16.0
My PHP version is: 7.3.14

Your problem
I repeatedly get the following PHP Error messages in my Error logs while I normally use Mautic.
Just updated to 2.16.0 this morning. Mautic seems to run okay. Will see latest tomorrow when other campaign messages are sent.

Here are the error log entries that repeat:
[25-Feb-2020 13:15:04 Europe/Berlin] PHP Notice: Undefined offset: 0 in /PathToMautic/app/bundles/LeadBundle/Views/Auditlog/details.html.php on line 62
[25-Feb-2020 12:15:59 UTC] PHP Warning - “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? - in file /PathToMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2636
[25-Feb-2020 12:15:59 UTC] PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /PathToMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2636
[25-Feb-2020 12:15:59 UTC] PHP Warning - “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? - in file /PathToMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php - at line 2665
[25-Feb-2020 12:15:59 UTC] PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /PathToMautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2665

These errors are showing in the log: Not in the Mautic log

Steps I have tried to fix the problem:
None, as I have no clue what to do about it. As Mautic works, I just wanted to let everyone know. Maybe its something that could be resolved with the next update.

Hi @stemautic88 and welcome to the Mautic Community Forum!

I have moved your message into the existing thread about this problem which I found by searching for your error message ’ Warning - “continue” targeting switch is equivalent to “break”’.

Please read up in the threads, where you’ll find a workaround to address this issue.

Thanks!
My bad, haven’t searched the forum prior to posting.

No worries, the GitHub link above gives instructions on how to workaround until we address the issue with the next release :slight_smile: