mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

RFC: https://wiki.php.net/rfc/property-hooks Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
26 lines
450 B
PHP
26 lines
450 B
PHP
--TEST--
|
|
Hook parameters accept parameter-targeted attributes
|
|
--FILE--
|
|
<?php
|
|
|
|
class C {
|
|
public $prop {
|
|
set(#[SensitiveParameter] $value) {
|
|
throw new Exception('Exception from $prop');
|
|
}
|
|
}
|
|
}
|
|
|
|
$c = new C();
|
|
try {
|
|
$c->prop = 'secret';
|
|
} catch (Exception $e) {
|
|
echo $e;
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Exception: Exception from $prop in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): C->$prop::set(Object(SensitiveParameterValue))
|
|
#1 {main}
|