Classes like the following block the attempts by Krumo to stain an object and can cause infinite recursion.

class UnstainableReadOnlyExample {

  function __construct() {
    // fetch values externally
  }

  function __set($name, $value) {
    // Read-only object
    return;
  }
}

class UnstainableReadFilteredExample {
  static $valid_props = array('foo', 'bar', 'baz');

  function __get($name) {
    if (in_array($name, $this->valid_props)) {
      return $this->$name;
    }
    return NULL;
  }
}
CommentFileSizeAuthor
#2 devel-setters_getters.patch3.4 KBjohn franklin

Comments

John Franklin created an issue. See original summary.

john franklin’s picture

Status: Active » Needs review
StatusFileSize
new3.4 KB

Attached patch looks for objects with getters or setters and stains a stunt object instead.