mirror of
https://github.com/php/php-src.git
synced 2026-03-27 17:52:16 +01: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"
22 lines
478 B
PHP
22 lines
478 B
PHP
--TEST--
|
|
prev - ensure we cannot pass a temporary
|
|
--FILE--
|
|
<?php
|
|
/* Prototype : mixed prev(array $array_arg)
|
|
* Description: Move array argument's internal pointer to the previous element and return it
|
|
* Source code: ext/standard/array.c
|
|
*/
|
|
|
|
/*
|
|
* Pass temporary variables to prev() to test behaviour
|
|
*/
|
|
|
|
|
|
var_dump(prev(array(1, 2)));
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
|
|
Stack trace:
|
|
#0 {main}
|
|
thrown in %s on line %d
|