Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JTable publish method error #6900

Closed
wants to merge 1 commit into from
Closed

Fix JTable publish method error #6900

wants to merge 1 commit into from

Conversation

joomdonation
Copy link
Contributor

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.

@roland-d
Copy link
Contributor

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

@zero-24
Copy link
Contributor

zero-24 commented May 10, 2015

@test together with #6914 RTC 😄

@zero-24 zero-24 added the RTC This Pull Request is Ready To Commit label May 10, 2015
@roland-d roland-d closed this in c0d955a May 10, 2015
@zero-24 zero-24 added this to the Joomla! 3.4.2 milestone May 10, 2015
johanjanssens pushed a commit to joomlatools/joomla-fork that referenced this pull request Jun 19, 2015
@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
@joomdonation joomdonation deleted the patch-14 branch December 19, 2015 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants