1 tblue Jun 28, 2008 22:58
3 tblue Jul 04, 2008 14:59
I don't know if it's true in <= 2.4.1, but I'll look at it.
Edit: True at least in 2.4.1 and 2.4.0-rc2.
OK, I'll try to make a "before"/"after" version, but first let me look at 2.4.1 and earlier. ;)
Edit #2:
File: inc/_core/model/dataobjects/_dataobjectlist2.class.php
Search for:
function & get_by_idx( $idx )
{
return $this->Cache->instantiate( $this->rows[$idx] );
}
Replace with:
function & get_by_idx( $idx )
{
if( !isset( $this->rows[$idx] ) || is_null( $this->rows[$idx] ) )
{
$obj = NULL;
return $obj;
}
return $this->Cache->instantiate( $this->rows[$idx] );
}
OK, not really "before"/"after" but "search and replace"...
BTW, there's another possibility to fix this bug.
File: inc/_core/model/dataobjects/_dataobjectcache.class.php
Search:
function & instantiate( & $db_row )
{
// Get ID of the object we'ere preparing to instantiate...
$obj_ID = $db_row->{$this->dbIDname};
Replace with:
function & instantiate( & $db_row )
{
if ($db_row === NULL)
{
$Obj = NULL;
return $Obj;
}
// Get ID of the object we'ere preparing to instantiate...
$obj_ID = $db_row->{$this->dbIDname};
The first patch fixes this specific bug, the second one prohibits the instantiation of a NULL "object" in the cache in general. Which solution is the better one? Both work without problems.
4 edb Jul 05, 2008 00:02
Cool - thanks!
I dunno which is "better" because I pretty much don't know much about nothin' at all. It'll be up to the dev team to decide which is better I guess, but for my money I'll go with the second version because it seems more 'global'.
My question on the versions is because, to my way of thinking, anything good should be done for 242 due to it is the "officially stable" release. All others in the 2.* generation are some sort of non-stable alpha beta type of thing ... and some might even be obsoleted already.
I'll mark this as a favorite because it comes back from time to time and now solutions are available. Hooray for solutions!
Is this true in 2.4.2 or <= 2.4.1? I know it used to be true because I reported it, but I don't know off the top of my head if I reported it against 2.4.2 or not?
Also if this is 2.4.2 could you PLEASE post a "before" and "after" code version instead of a diff file type of thing? Diff files suck cuz (as far as I know) there is nothing out there that will effectively and actually turn it into a useful patch. Before and After works because all we have to do is copy/paste :)