joomla/joomla-cms — pull request #4392 by joomdonation (2014-09-29 15:36:21+00:00)
Title: Fix Fatal error when create external url menu item has &table= in the url

This pull request fixes the Fatal error issue which is reported at https://groups.google.com/forum/#!topic/joomla-dev-general/vNaXN3RGmb8

The reason of the error is because the link has table variable in query string and after the command in line 652 parse_str(parse_url($table->link, PHP_URL_QUERY)); , the table object (which is a local variable in the method) is replaced by the value of table variable in the link (which is an integer value in the sample link) and causes the fatal error when the method $table->getProperties(1); is called (because $table is not an object anymore).

How to test :

1. Create an menu item, type external url, type the sample link http://sbkost.sm-u.de/index.php?seite=spielplan&table=993 (or any url which has table variable in query string)

2. Save it and you will see the fatal error

3. Apply this patch

4. Check it again and make sure the URL is saved.

I also made some small changes the code of getItem method:

1. Remove the line of code parse_str(parse_url($table->link, PHP_URL_QUERY), $args); because it is written in switch block already.

2. Remove the command $app = JFactory::getApplication(); because the $app variable is not used in that method at all.