mirror of
https://github.com/php/php-src.git
synced 2026-04-03 06:02:23 +02:00
This helps to avoid unnecessary IS_REFERENCE checks. This changes some notices "Only variables should be passed by reference" to exception "Cannot pass parameter %d by reference". Also, for consistency, compile-time fatal error "Only variables can be passed by reference" was converted to exception "Cannot pass parameter %d by reference"
23 lines
390 B
PHP
23 lines
390 B
PHP
--TEST--
|
|
Basic class support - attempting to pass a class constant by reference.
|
|
--FILE--
|
|
<?php
|
|
class aclass
|
|
{
|
|
const myConst = "hello";
|
|
}
|
|
|
|
function f(&$a)
|
|
{
|
|
$a = "changed";
|
|
}
|
|
|
|
f(aclass::myConst);
|
|
var_dump(aclass::myConst);
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|