minkphp / MinkSelenium2Driver

Selenium2 (webdriver) driver for Mink framework
MIT License
507 stars 163 forks source link

avoid passing null to strtolower #329

Closed cdaguerre closed 3 years ago

cdaguerre commented 3 years ago

Calling $element->attribute('type') on an <option> element returns null, passing null to strtolower triggers a PHP error. Frankly, I don't know why this started to fail all of the sudden in our test suite. I'm guessing it's due to a different selenium version, but this fixes it. ($elementType is not used in the case of a <select> element).

aik099 commented 3 years ago

@cdaguerre , I've tried doing strtolower(null) on all PHP versions (see https://3v4l.org/X0WM5) and it doesn't trigger a Fatal Error.

Could you please share the error message you're getting with a backtrace and PHP version/OS you're using?

mvorisek commented 3 years ago

Yes, this should be closed as strict types are not defined for that changed file.

stof commented 3 years ago

@aik099 it will trigger a deprecation warning on 8.1 (see the branches tag of 3v4l.org to see the result on the php-src master branch)

aik099 commented 3 years ago

Then this needs to be merged.

alexpott commented 3 years ago

There are 4 instances of strtolower($element->attribute('type')) in the codebase - I guess they all need this change.

aik099 commented 3 years ago

There are 4 instances of strtolower($element->attribute('type')) in the codebase - I guess they all need this change.

@alexpott , please change them all as well.

alexpott commented 3 years ago

There are 4 instances of strtolower($element->attribute('type')) in the codebase - I guess they all need this change.

@alexpott , please change them all as well.

Done in https://github.com/minkphp/MinkSelenium2Driver/pull/334

aik099 commented 3 years ago

Closed via #334.