-
Notifications
You must be signed in to change notification settings - Fork 9
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
Do not call strtolower on null (PHP 8.1 warning) #76
Conversation
@oleg-andreyev, any chance we can land this. We're trying to get compatibility with PHP 8.1 ASAP and this is a blocker for us. |
One thing that bugs me, input has missing or unknown "type" it should fallback "text" MDN:
|
src/WebDriver.php
Outdated
@@ -575,7 +575,7 @@ public function getValue($xpath) | |||
{ | |||
$element = $this->findElement($xpath); | |||
$elementName = strtolower($element->getTagName()); | |||
$elementType = strtolower($element->getAttribute('type')); | |||
$elementType = strtolower($element->getAttribute('type') ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add fallback to "text" and please search for other places (line 650)
also I've done some work on https://github.com/oleg-andreyev/MinkPhpWebDriver/releases/tag/v1.2.0 now PHP >= 7.4 and build is working. |
FYI In minkphp/MinkSelenium2Driver it is changed to The value of the variable is never compared to |
option and select elements return null as their element type and it causes a notice in PHP 8.1: 8192: strtolower(): Passing null to parameter oleg-andreyev#1 () of type string is deprecated in /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php line 578
hi @oleg-andreyev , thanks for reviewing it. Is there any chance to get it merged and tagged? TIA |
Hi @oleg-andreyev , any reason the new release is not showing @ packagist? https://packagist.org/packages/oleg-andreyev/mink-phpwebdriver Was just trying to update our repos here to use it and composer cannot find it, so far. Ciao :-) Edited: Ah, maybe I need to patiently wait 24 hours or so? Sorry for the pressure, if that's the case, heh! I'm just used to see the new tags/releases happening almost immediately @ packagist. |
@stronk7 fixed. It appears I made a typo in tag/release tag is updated https://packagist.org/packages/oleg-andreyev/mink-phpwebdriver#v1.2.1 |
Aha, great! Heap thanks! |
Elements such as "option", "select" and "textarea" do not have 'type' property and it causes a notice in PHP 8.1: