? Success

User tests: Successful: Unsuccessful:

avatar jo-sf
jo-sf
3 May 2016

If a full URL is redirected the fields selected from the database are "new_url", "header" and "published" but if a server-relative URL is redirected only the fields "new_url" and "published" are selected from the database.

This has two implications:

  • you will find an error message in your webserver error log file whenever a server-relative URL is redirected, this error message looks like: PHP Notice: Undefined property: stdClass::$header in .../plugins/system/redirect/redirect.php on line 142
  • if you enable the advanced feature for setting redirection codes and if you use this feature with server-relative redirections it is not working since the database field "header" holding this redirection code isn't selected from the database

This pull request changes the select with the server-relative URL such that in this case the "header" field is selected too.

How to test:

  • define a server-relative redirection and set the redirection code to 307
  • open the redirected URL either with your browser or with e.g. wget (for wget see below)
  • check for the redirection and the redirection code - the code is 301

Now apply the change and repeat the test, the redirection code is now 307.

Since browsers tend to cache redirections they got from a web server it is not easy to test the redirection plugin. One way is to completely clean the browser cache prior to the next test (or to remove at least all objects cached from the server used for testing).

The other way is to use the tool wget as follows:

wget -O - --max-redirect 0 <URL>

For please substitute the redirected URL. The relevant output of this tool will look like:

HTTP request sent, awaiting response... 307 Temporary Redirect
Location: <new URL>

avatar jo-sf jo-sf - open - 3 May 2016
avatar jo-sf jo-sf - change - 3 May 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 May 2016
Labels Added: ?
avatar andrepereiradasilva andrepereiradasilva - test_item - 3 May 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 3 May 2016

I have tested this item :white_check_mark: successfully on 4ae6da2

I confirm the issue and this PR solves it.

How did i test.

  • Used latest staging
  • Went to Components -> Redirects (enabled the plugin)
  • Setted Advanced mode to Yes in Component Options
  • Created new redirect /en/testredirect1 to /en/testredirect2 with 307 HTTP status code
  • Used a private browser tab and disabled cache in chrome dev tools
  • Opened dev console in browser to check the "Network" tab
  • Introduced http://mydomain.tld/en/testredirect1 in browser address
  • Redirected to http://mydomain.tld/en/testredirect2
  • Checked in dev tools the HTTP status code of the redirect was a 301 (not a 307 as it should)
  • Checked server error log files and the notice described is there
  • Applied patch - tried again all went as it should: 307 redirect and no php notice

Thanks!


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

avatar brianteeman brianteeman - change - 4 May 2016
Category Plugins
avatar zero-24 zero-24 - test_item - 7 May 2016 - Tested successfully
avatar zero-24
zero-24 - comment - 7 May 2016

I have tested this item :white_check_mark: successfully on 4ae6da2

Thanks. RTC


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

avatar zero-24 zero-24 - change - 7 May 2016
Status Pending Ready to Commit
Easy No Yes
avatar zero-24
zero-24 - comment - 7 May 2016

RTC


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

avatar joomla-cms-bot joomla-cms-bot - change - 7 May 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 7 May 2016
Milestone Added:
avatar wilsonge wilsonge - close - 7 May 2016
avatar wilsonge wilsonge - merge - 7 May 2016
avatar joomla-cms-bot joomla-cms-bot - close - 7 May 2016
avatar wilsonge wilsonge - reference | 9e02024 - 7 May 16
avatar wilsonge wilsonge - merge - 7 May 2016
avatar wilsonge wilsonge - close - 7 May 2016
avatar wilsonge wilsonge - close - 7 May 2016
avatar joomla-cms-bot joomla-cms-bot - close - 7 May 2016
avatar wilsonge wilsonge - change - 7 May 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-07 14:11:15
Closed_By wilsonge
avatar joomla-cms-bot joomla-cms-bot - change - 7 May 2016
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 May 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment