Skip to content

Commit

Permalink
Call getQualifiers and getReferences outside of iterator_to_array
Browse files Browse the repository at this point in the history
In the getAllSnaks calls in Claim and Statement, it seems in some
situations that the Traversable objects are being converted to array,
by reference, in the ReferenceList itself and possibly for qualifiers also.

This change may help fix bug 71519.
  • Loading branch information
filbertkm committed Oct 7, 2014
1 parent 5875353 commit 63d006f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Claim/Claim.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ public function getAllSnaks() {
$snaks = array();

$snaks[] = $this->getMainSnak();
$snaks = array_merge( $snaks, iterator_to_array( $this->getQualifiers() ) );
$qualifiers = $this->getQualifiers();
$snaks = array_merge( $snaks, iterator_to_array( $qualifiers ) );

return $snaks;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Statement/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public function getAllSnaks() {

/* @var Reference $reference */
foreach( $this->getReferences() as $reference ) {
$snaks = array_merge( $snaks, iterator_to_array( $reference->getSnaks() ) );
$referenceSnaks = $reference->getSnaks();
$snaks = array_merge( $snaks, iterator_to_array( $referenceSnaks ) );
}

return $snaks;
Expand Down

0 comments on commit 63d006f

Please sign in to comment.