Success

User tests: Successful: Unsuccessful:

avatar ghost
ghost
4 Jul 2013

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31339

When saving a items (articles, weblinks, etc), and php error reporting is on max, you'll get an error about Undefined property JTableSomething::$newTags in the php error logs.

This PR fixes the issue.
However, it solves this by initialising the newTags property on the JTable object. I am not sure this is the best way to do this, as this will initialise the property on ALL JTable objects.
Maybe good for someone with a coding-eagle-eye to look into this...

Testing Instructions

Save an item (article, weblink, etc) and see if the error is no longer there.

avatar nonumber nonumber - open - 4 Jul 2013
avatar elinw
elinw - comment - 8 Jul 2013

Actually if we did this and then added

    if (isset($table->newTags))
    {
        $newTags = $table->newTags;
    }

In tags.php at line 774 we could take out the $new->tags from the call and thus not have a change in api. Which would be great.

What I would say is let's add a property that indicates if a table supports tagging (because we don't have a field like asset_id or hits to check for). Then if that is true, set the newTags property.

So
/*

  • @var Boolean indicating if tagging is supported */

$tagsSupport = true;

// If tagging is supported and the newTags property does not exists, set the default.
if ($this->tags && !property_exists($this, 'newTags'))
{
$this->newTags = array();
}

avatar nonumber
nonumber - comment - 9 Jul 2013

I think there is more overhead on checking if the tagging is supported than simply setting the $this->newTags = array();.
Adding an empty array property to the object isn't really that big of a deal.

avatar elinw
elinw - comment - 10 Jul 2013

No it makes more sense because it is more generally useful to have that information all the time (since tags is used for many other things) than it is to always have the information that you only need if you happen to be in a store context and not have any new tags. It's very useful for many many purposes (such as rendering and doing queries) to know if tags is supported especially as we try to make those things more and more generic.

avatar elinw
elinw - comment - 10 Jul 2013

See #1452

Add a Comment

Login with GitHub to post a comment