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

dom-crawler bug with PHP 8.1: please use a newer version #325

Open
cscrewsandcaptains opened this issue Apr 28, 2022 · 7 comments
Open

dom-crawler bug with PHP 8.1: please use a newer version #325

cscrewsandcaptains opened this issue Apr 28, 2022 · 7 comments

Comments

@cscrewsandcaptains
Copy link

Please add "|~4.4" to the composer.json entries of the required symfony packages:
"symfony/css-selector":"~2.8|~3.0|~4.4",
"symfony/dom-crawler": "~2.8|~3.0|~4.4"
Because 4.4 is the last version that get bugfixes.
There is a bug in the 3.0 version of dom-crawler, so your control cannot be used with PHP 8.1.

A workaround for my own project is to add this to composer.json:
"symfony/css-selector": "4.4.37 as 3.0.0",
"symfony/dom-crawler": "4.4.39 as 3.0.0"

@gthaka
Copy link

gthaka commented Aug 2, 2022

Same issue as @cscrewsandcaptains. was able to bypass the error using @cscrewsandcaptains workaround. Thanks

Discomania added a commit to Discomania/yii2-dynamicform that referenced this issue Nov 3, 2022
@charmy93
Copy link

charmy93 commented Nov 4, 2022

Trying to resolve this issue for php8, ran into another error after making above changes to composer file
"Call to undefined method Symfony\Component\DomCrawler\Crawler::rewind()"

@bugToaster
Copy link

In order to solve the issue with Symfony DOM Crawler, I resolved it by changing the version of the main composer package in the following manner in composer.json file:

###From###

  • "codeception/module-filesystem": "^2.0 || ^1.1",
  • "symfony/browser-kit": "^6.0 || >=2.7 <=4.2.4"

###To###

  • "codeception/module-filesystem": "^3.0 || ^1.1",
  • "symfony/browser-kit": "^6.2 || >=2.7 <=4.2.4"

@cscrewsandcaptains
Copy link
Author

My suggestion to add
"symfony/css-selector":"~2.8|~3.0|~4.4",
"symfony/dom-crawler": "~2.8|~3.0|~4.4"
(what Discomania have done in the fix) doesn't resolve the issue.
A downgrade to 3.4.47 of symfony/dom-crawler and symfony/css-selector will be done, if I remove my workaround ("symfony/css-selector": "4.4.37 as 3.0.0", "symfony/dom-crawler": "4.4.39 as 3.0.0") in my composer.json and then an exception will thrown if using the control.
Sorry I have no other suggestion. I use my workaround again.

@cscrewsandcaptains
Copy link
Author

@bugToaster: I have no "codeception/module-filesystem" or "symfony/browser-kit" line in my composer.json.

@bugToaster
Copy link

I got the above packages when creating a project from yii template (eg. advance). can you try the above packages & let's see what happens?
Screenshot from 2023-03-21 17-30-11

@cscrewsandcaptains
Copy link
Author

I have not install this packages ("composer show"). So there is no need for me to install them.

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

No branches or pull requests

4 participants