?
avatar andrepereiradasilva
andrepereiradasilva
12 Aug 2016

Steps to reproduce the issue

In GsoC multilingual Project we are trying to check if the item table exist.
So we use $model->getTable() and catch the exception throwed when the table doesn't exist.

That exception in throwed by JModelLegacy here: https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/legacy.php#L472

The problem is: besides this exception (that we can catch with try/catch) we get a warning message that comes from JTable::getInstance (here https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/table/table.php#L294).

So there is something strange here ... one exception + one warning ?

You can see that warning if, for instance you add to isis template index.php

$table = JTable::getInstance('bla', 'Table', array('dbo' => JFactory::getDbo()));

Expected result

Get an exception that we can catch.

Actual result

We get an exception and a warning instead of only an exception.
image

System information (as much as possible)

Latest staging

Additional comments

@mbabker i ask for your help on this. Do you think that warning can be removed or replaced for an exception with B/C?

avatar andrepereiradasilva andrepereiradasilva - open - 12 Aug 2016
avatar mbabker
mbabker - comment - 12 Aug 2016

Some have argued converting an API from returning boolean values to throwing Exceptions is a B/C break. To me that'd be the best option though for this issue. In lieu of that, having it not raise a warning and just return the boolean value would be the next best option with it clearly documented in code that as of 4.0 an Exception will be thrown (type to be determined).

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Aug 2016

ok will do a PR for that

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Aug 2016

thanks

avatar brianteeman brianteeman - change - 12 Aug 2016
Category Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 Aug 2016

closed as we have a PR for test #11573

Add a Comment

Login with GitHub to post a comment