MinkSelenium2Driver icon indicating copy to clipboard operation
MinkSelenium2Driver copied to clipboard

fix: Check if cookies are iterable before iterating

Open das-peter opened this issue 3 years ago • 3 comments

It can happen that the returned value is not iterable. The geetAllCookies() methode also declares the its return as "mixed". Just about having slightly more defensive code.

das-peter avatar Apr 28 '22 07:04 das-peter

Codecov Report

Merging #356 (f387514) into master (e5f8421) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #356      +/-   ##
============================================
+ Coverage     90.02%   90.04%   +0.02%     
- Complexity      150      151       +1     
============================================
  Files             1        1              
  Lines           421      422       +1     
============================================
+ Hits            379      380       +1     
  Misses           42       42              
Impacted Files Coverage Δ
src/Selenium2Driver.php 90.04% <100.00%> (+0.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e5f8421...f387514. Read the comment docs.

codecov[bot] avatar Apr 28 '22 07:04 codecov[bot]

In which case does this happen ?

stof avatar Apr 28 '22 08:04 stof

I had a request to wd/hub/session/chrome-100-0-4896-75-1-bc5dc535-0653-4f64-814c-d172db4c1582/session/bed6779a89bb52104cef11e83d40d7e6/cookie return null as value. Underlying library is instaclick/php-webdriver - \WebDriver\Session::getAllCookies() which just passes the value as received from the endpoint back to the consumer. It is highly likely this is / was an error on the endpoint but I don't think this warrants a generic failure.

das-peter avatar Apr 28 '22 13:04 das-peter