? Success

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
7 May 2015

Issue description

While reviewing the PR #6893, I see that JTable publish method has a bug. If you create a JTable object, load a record from using load() method, then call publish() method, you will see some notices and the record won't be published.

To see it, try to run this code somewhere on your Joomla site:

require_once JPATH_ADMINISTRATOR.'/components/com_contact/tables/contact.php';
$row = JTable::getInstance('Contact', 'ContactTable');
$row->load(1);
$row->publish();

After running the code above, we should have contact with ID = 1 published. However, the published status of the record not changed and you will see notices like this:

Notice: Undefined property: stdClass::$id in E:\www\joomla\libraries\joomla\table\table.php on line 446
Notice: Undefined index: id in E:\www\joomla\libraries\joomla\table\table.php on line 1594

It causes by a typo in the code, I think. And this PR fix it.

Testing instruction

  • For none developers: This PR makes change to publish method of JTable class, so you just need to go to backend of your site, try to publish , unpublish records (articles, categories for example) and make sure it is still working as expected.

  • For developers: Try to run the code above (need to change 1 to ID of an unpublished contact, run the code I mentioned some where (even in your own component), see the error. Apply the patch, the error is gone, the contact is published.

avatar joomdonation joomdonation - open - 7 May 2015
avatar brianteeman brianteeman - change - 7 May 2015
Labels Added: ?
avatar brianteeman brianteeman - change - 7 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 7 May 2015
Status New Pending
avatar zero-24 zero-24 - change - 7 May 2015
Easy No Yes
avatar zero-24 zero-24 - change - 7 May 2015
Category Libraries
avatar roland-d
roland-d - comment - 10 May 2015

@test Success, after testing, the undefined notice no longer shows up.

avatar roland-d roland-d - test_item - 10 May 2015 - Tested successfully
avatar zero-24
zero-24 - comment - 10 May 2015

@test together with #6914 RTC :smile:

avatar zero-24 zero-24 - test_item - 10 May 2015 - Tested successfully
avatar zero-24 zero-24 - change - 10 May 2015
Status Pending Ready to Commit
avatar zero-24 zero-24 - change - 10 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 10 May 2015
Labels Added: ?
avatar zero-24 zero-24 - close - 10 May 2015
avatar roland-d roland-d - change - 10 May 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-05-10 09:50:51
Closed_By roland-d
avatar roland-d roland-d - close - 10 May 2015
avatar roland-d roland-d - close - 10 May 2015
avatar zero-24 zero-24 - change - 10 May 2015
Milestone Added:
avatar johanjanssens johanjanssens - reference | e1adeda - 19 Jun 15
avatar stiplady stiplady - reference | - 24 Sep 15
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?
avatar joomdonation joomdonation - head_ref_deleted - 19 Dec 2015

Add a Comment

Login with GitHub to post a comment