Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for magic property handling. #3

Merged
merged 1 commit into from

2 participants

@julien-f

Magic properties are trickier to handle because they may not be assignable by
reference or they might be write-only or whatever.

This patch tries to address these limits.

@julien-f julien-f Fix for magic property handling.
Magic properties  are trickier to handle  because they may not  be assignable by
reference or they might be write-only or whatever.

This patch tries to address these limits.
85c5503
@marsaud marsaud merged commit e14e993 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2012
  1. @julien-f

    Fix for magic property handling.

    julien-f authored
    Magic properties  are trickier to handle  because they may not  be assignable by
    reference or they might be write-only or whatever.
    
    This patch tries to address these limits.
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 1 deletion.
  1. +16 −1 Transmorph/Writer.php
View
17 Transmorph/Writer.php
@@ -145,7 +145,22 @@ public function feed(&$node, $path, $value)
$key = substr($pathNode, 1);
- $this->feed($node->$key, $remainingPath, $value);
+ // Indirection to avoid problem with magic properties.
+ try
+ {
+ /*
+ * An exception may be raised in some conditions. For
+ * instance, this might be a write-only property or it might
+ * not have a value yet.
+ */
+ $prop = $node->$key;
+ }
+ catch (Exception $e)
+ {
+ $prop = null;
+ }
+ $this->feed($prop, $remainingPath, $value);
+ $node->$key = $prop;
}
}
Something went wrong with that request. Please try again.