? ? Failure

User tests: Successful: Unsuccessful:

avatar Quy
Quy
15 Jul 2017

Pull Request for Issue #16970 .
Fix regression for Issue #15228 .

Summary of Changes

Revert to previous individual preg_match rather than combine them into 1.

Testing Instructions

Check your PHP error log.

or

Create the following PHP script and run it. 1st preg_match( (previous) outputs no error. 2nd preg_match( (current) outputs error.

<?php

$agent = "Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/59.0.3071.102 Mobile/14F89 Safari/602.1";

echo 'v3.6.5 ';
preg_match('|CriOS[/ ]([0-9.]+)|', $agent, $version);
var_dump($version);
list ($majorVersion, $minorVersion) = explode('.', $version[1]);

echo 'v3.7.3 ';
preg_match('/Chrome[\/ ]([0-9.]+)|CrMo[\/ ]([0-9.]+)|CriOS[\/ ]([0-9.]+)/i', $agent, $version);
var_dump($version);
list ($majorVersion, $minorVersion) = explode('.', $version[1]);

?>

results (1st array is v3.6.5 and 2nd array is v3.7.3):

v3.6.5 array(2) {
  [0]=>
  string(19) "CriOS/59.0.3071.102"
  [1]=>
  string(13) "59.0.3071.102"
}
v3.7.3 array(4) {
  [0]=>
  string(19) "CriOS/59.0.3071.102"
  [1]=>
  string(0) ""
  [2]=>
  string(0) ""
  [3]=>
  string(13) "59.0.3071.102"
}
<br />
<b>Notice</b>:  Undefined offset: 1 in <b>C:\xampp\htdocs\agent.php</b> on line <b>14</b><br />

Expected result

No PHP Notice

Actual result

PHP message: PHP Notice: Undefined offset: 1 in /libraries/joomla/environment/browser.php on line 282\n

Documentation Changes Required

None

avatar Quy Quy - open - 15 Jul 2017
avatar Quy Quy - change - 15 Jul 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jul 2017
Category Libraries
avatar Quy Quy - change - 15 Jul 2017
Title
Fix undefined offset: 1
Regression: Fix undefined offset: 1
avatar Quy Quy - change - 15 Jul 2017
Title
Fix undefined offset: 1
Regression: Fix undefined offset: 1
avatar Quy Quy - edited - 15 Jul 2017
avatar Quy
Quy - comment - 16 Jul 2017

@rdeutz I have two v3.7.3 installs where the second install has this PR. The first install is littered with Fix undefined offset: 1 daily in the PHP error log file and not in the second install. This is a regression from v.3.7.2.

avatar photodude
photodude - comment - 16 Jul 2017

@Quy we should add new UA to the unit tests for the noted regression(s) here. (UA's listed in the previous version of this PR #16989)

This is a merge by code review / unit tests pass. No easy way to user test the browser cases.

avatar mbabker
mbabker - comment - 16 Jul 2017

There are no unit tests for JBrowser yet (#17140 starts it but it's a very limited subset). If someone wants to generate a list, we can add them as part of that PR or later on after that one's merged.

avatar Quy
Quy - comment - 16 Jul 2017

@photodude I don't know how to do it. Would you mind doing it? Thanks.

avatar photodude
photodude - comment - 16 Jul 2017

@mbabker I'll put a list together for that PR.

avatar photodude
photodude - comment - 25 Jul 2017

@Quy can you fix the merge conflict

avatar Brian5600
Brian5600 - comment - 29 Jul 2017

Hello
I tried to change browser.php with the changes about Chrome today like shown in "Files changed", and the error went away from Chrome browser (ver. 60.x) on Ipad (Ios 10.3.2). I am on Joomla 3.7.4.
I have not tested regarding to IE. I am on Win7, IE 11, and don't see any issues with "default" code.
Hope it will be fixed in Joomla.
Thanks @Brian5600.

avatar Quy
Quy - comment - 10 Aug 2017

@Brian5600 Please mark it a successful test here: https://issues.joomla.org/tracker/joomla-cms/17139

avatar franz-wohlkoenig franz-wohlkoenig - alter_testresult - 10 Aug 2017 - Brian5600: Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Aug 2017

@Quy i altered successfully Test for @Brian5600

avatar Brian5600
Brian5600 - comment - 11 Aug 2017

@franz-wohlkoenig @Quy thanks.
I also tested with success in Chrome installed on Win8 today.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17139.

avatar photodude
photodude - comment - 12 Aug 2017

@mbabker @wilsonge Could either of you, or someone else, consider marking RTC for this since there are two reported successful tests (also drone seems to need a restart here).

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Aug 2017

@photodude who is second successfully Test?

avatar photodude
photodude - comment - 12 Aug 2017

@franz-wohlkoenig I guess I miss read it, I thought you had done a test.

Really this is a "by code review" item as there is no good/easy way to test this and there are not really any unit tests for it either.

I'll mark approved by code review.

avatar franz-wohlkoenig franz-wohlkoenig - alter_testresult - 12 Aug 2017 - photodude: Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Aug 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Aug 2017

RTC after two successful tests.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Aug 2017

@photodude i altered your Review as successfully Test at Issue Tracker.

avatar mbabker mbabker - change - 12 Aug 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-08-12 16:28:34
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 12 Aug 2017
avatar mbabker mbabker - merge - 12 Aug 2017

Add a Comment

Login with GitHub to post a comment