[php-src] Issue #8351: explicit `__construct` call for \DateTimeImmutable object would break immutable
| From: | TimWolla | Date: | Wed, 13 Apr 2022 09:04:37 +0000 |
| Subject: | [php-src] Issue #8351: explicit `__construct` call for \DateTimeImmutable object would break immutable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240915@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8351
Comment Author: TimWolla
> That would require to actually have these properties,
That does not appear to help with internal classes. The
[SensitiveParameterValue::$value](https://github.com/php/php-src/blob/c345b6ee7232df3ce88bfe3521ce00643ae66c3a/Zend/zend_attributes.stub.php#L36)
property is
readonly, but calling the __construct method allows to change
it:
```
$ sapi/cli/php test2.php
<?php
readfile(__FILE__);
echo "\n\n=================\n\n";
$v = new SensitiveParameterValue('secret');
var_dump($v->getValue());
$v->__construct('changed');
var_dump($v->getValue());
=================
string(6) "secret"
string(7) "changed"
```