Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
updated fix of potential alteration of Doctrine record when accessing…
Browse files Browse the repository at this point in the history
… some virtual property dynamically (ya, that was a tough one to spot)
  • Loading branch information
n1k0 committed Nov 11, 2010
1 parent 6ea5844 commit e6ae507
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/resolver/akDoctrineCacheUriResolver.class.php
Expand Up @@ -130,10 +130,14 @@ public function fetchRelatedValues(Doctrine_Record $record, $property)
{
try
{
if ($value = (string) $record->copy(true)->$property)
// circumvents a silly Doctrine behavior which may alter the record instance reference
// when trying to access some of its properties, so we copy it instead to be safe
$copy = clone $record->copy(true);
if ($value = (string) $copy->$property)
{
$values[] = $value;
}
unset($copy);
}
catch (Exception $e)
{
Expand Down

0 comments on commit e6ae507

Please sign in to comment.