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

PHP 7.3 regression/issue #7402

Closed
gnat42 opened this issue Sep 18, 2018 · 11 comments
Closed

PHP 7.3 regression/issue #7402

gnat42 opened this issue Sep 18, 2018 · 11 comments

Comments

@gnat42
Copy link

gnat42 commented Sep 18, 2018

Bug Report

Q A
BC Break no :)
Version 2.6.2

Summary

Just started to test our software against php7.3. We're using symfony, when it clears the cache we get a RuntimeException as follows. The issue being this line of code

Current behavior

[RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        
                                                                                                                                                                                                                                                         
                                                                                   
  In UnitOfWork.php line 2718:
                                                                                   
    Warning: "continue" targeting switch is equivalent to "break". Did you mean    
     to use "continue 2"?                                                          
                                           

How to reproduce

I started a docker container that has php 7.3 RC1. docker run -it gnat42/centos7-php73:latest and pulled in our symfony project. composer install -o. It failed on the cache clear step.

Expected behavior

No errors.

@Majkl578
Copy link
Contributor

This is already fixed by #7325 in 2.6 and will be released in 2.6.3.

@Majkl578
Copy link
Contributor

Ad:

BC Break | yesish :)

Incompatibility with new PHP version is not a BC break, it's rather a BC break in PHP 7.3. :)

@Ocramius
Copy link
Member

Changed it to "no" :-)

@gnat42
Copy link
Author

gnat42 commented Sep 18, 2018

Awesome. I tried searching for a pre-existing bug but didn't find one. Glad it's fixed. Thanks for all your hard work everyone

Adrien-H added a commit to Adrien-H/orm-pack that referenced this issue Nov 24, 2018
Current Doctrine version is meeting compatibility issues with
PHP 7.3.

See: [#7402](doctrine/orm#7402)
Adrien-H added a commit to Adrien-H/orm-pack that referenced this issue Nov 24, 2018
Current Doctrine version is meeting compatibility issues with
PHP 7.3.

See: doctrine/orm#7402
hoyes referenced this issue in camdram/camdram Dec 20, 2018
@VascoRatoGFI
Copy link

VascoRatoGFI commented Jan 9, 2019

EDIT: This issue has been fixed, ran composer update and the changes I was suggesting were already implemented. My bad :)

Just as a side note, checking the file where the warning comes from, UnitOfWork.php, we find the following structure:

foreach ($class->associationMappings as $field => $assoc) {

    //some logic

    switch (true) {
        case($assoc['type'] & ClassMetadata::TO_ONE):

            //some more logic

            if(isset($data[$field]) && is_object($data[$field]) && isset($this->entityStates[spl_object_hash($data[$field])])) {
                
                //do stuff
                
                continue;  // <---- Statement that gives the error
            }

            //some more code
    
    } //end of switch
} //end of foreach

Since the switch statement is the last statement on the foreach loop, then using break, continue and continue 2 will all have the same behavior.

Therefore, you are safe to edit the file and replace continue with either break or continue 2 to prevent the warning message. I did so and found no issues.

@Majkl578
Copy link
Contributor

Majkl578 commented Jan 9, 2019

@VascoRatoGFI Please upgrade, this has been already fixed.

meisterT added a commit to DOMjudge/orm that referenced this issue Feb 23, 2019
This is necessary to make doctrine/orm work both with php 7.0
(debian/stable) and 7.3 (debian/testing).

See also doctrine#7402.
meisterT added a commit to DOMjudge/domjudge that referenced this issue Feb 23, 2019
This is basically v2.5.14 plus DOMjudge/orm@0ea0a31
@AdamReece-WebBox
Copy link

Would I be right in guessing that the 2.5.x branch won't be getting this fix?

Our projects have to be able to run on anything from PHP 7.0 to 7.2, so we can't update to ORM 2.6.x yet. We did try out PHP 7.3 and had this issue, but we can stay away from that until 7.0 drops out of mainstream.

@SenseException
Copy link
Member

Yes, you're right. 2.5 is unmaintained and there is no plan to back-port that fix.

anderfrago added a commit to anderfrago/artean-bolsa-empleo that referenced this issue Dec 11, 2019
Error when updating from composer, [source](doctrine/orm#7402)
quayle pushed a commit to quayle/orm that referenced this issue Mar 16, 2020
quayle pushed a commit to quayle/orm that referenced this issue Mar 16, 2020
@7ochem
Copy link

7ochem commented Jun 27, 2020

I have a project with Doctrine ORM 2.5.14 installed. This is the latest 2.5 version, but this one still has this "bug" (and it won't be fixed, since 2.5 is unmaintained). I can't update to 2.6 or 2.7 because the project is still running on Symfony 2.8 and Doctrine ORM 2.6 needs symfony/console 3.0 or higher. So Composer update won't work in this case, because Composer can't update Doctrine ORM to any higher version than 2.5.14...

So now I'm considering a few options and so could others who end up here as well:

  • Upgrade the whole project to Symfony 3 (the best option and long term solution, but the most costly)
  • Downgrade PHP back to 7.2 (relatively easy for me, but not a long term solution [security support for 7.2 ends Nov 2020])
  • Fix the bug myself locally, via patching probably or forking the repo (worst solution, but fastest and cheapest)

@beberlei
Copy link
Member

@7ochem your reasoning is a bit flawed to me, you seem to be concerned about running php 7.2 after maintenance, but you are already running with unmaintained versions of Symfony and Doctrine for a long time, which should concern you even more imho.

@AdamReece-WebBox
Copy link

Upgrading S2 to S3 can certainly be a major task, but if you must run on PHP 7.2 that isn't really a bad option.

There are people/providers out there that will still support it. WHM/cPanel still let you run old PHP versions though don't patch the EOL ones. However if you add CloudLinux you will get security patches, way back to PHP 4.4 or something insane like that. You could also use the Sury repository if you're running on Debian (or derivatives), this chap seems to port in patches quite regularly. -- Certainly a viable option if you really don't need anything PHP 7.3+ that can't be provided with a polyfill.

@Majkl578 Majkl578 removed their assignment Jun 28, 2020
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

8 participants