Browse Source

Make parent re-association on context clone more restrictive

microsub
J. King 5 years ago
parent
commit
70443a5264
  1. 1
      lib/Context/Context.php
  2. 6
      lib/Context/ExclusionContext.php

1
lib/Context/Context.php

@ -9,6 +9,7 @@ namespace JKingWeb\Arsse\Context;
use JKingWeb\Arsse\Misc\Date;
class Context extends ExclusionContext {
/** @var ExclusionContext */
public $not;
public $reverse = false;
public $limit = 0;

6
lib/Context/ExclusionContext.php

@ -32,9 +32,9 @@ class ExclusionContext {
public function __clone() {
if ($this->parent) {
$p = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]['object'] ?? null;
if ($p instanceof self) {
$this->parent = $p;
$t = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1];
if (($t['object'] ?? null) instanceof self && $t['function'] === "__clone") {
$this->parent = $t['object'];
}
}
}

Loading…
Cancel
Save