From: gggeek Date: Wed, 18 Jan 2023 17:29:28 +0000 (+0000) Subject: make addScalar friendlier to subclassing X-Git-Tag: 4.10.0~128 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7bacf187347d4a4b6dfaccfb29b9f777b3cccd86;p=plcapi.git make addScalar friendlier to subclassing --- diff --git a/src/Value.php b/src/Value.php index 8aebe354..03a81084 100644 --- a/src/Value.php +++ b/src/Value.php @@ -177,7 +177,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess return 0; case 2: // we're adding a scalar value to an array here - $this->me['array'][] = new Value($val, $type); + $class = get_class($this); + $this->me['array'][] = new $class($val, $type); return 1; default: