1--TEST-- 2Observer: Retvals by reference are observable that are: IS_VAR, ZEND_RETURNS_FUNCTION 3--SKIPIF-- 4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?> 5--INI-- 6zend_test.observer.enabled=1 7zend_test.observer.observe_all=1 8zend_test.observer.show_return_value=1 9opcache.optimization_level=0 10--FILE-- 11<?php 12function getMessage() { 13 return 'I should be observable'; 14} 15 16function &foo() { 17 return getMessage(); // IS_VAR + ZEND_RETURNS_FUNCTION 18} 19 20$res = foo(); // Retval used 21foo(); // Retval unused 22 23echo 'Done' . PHP_EOL; 24?> 25--EXPECTF-- 26<!-- init '%s%eobserver_retval_by_ref_%d.php' --> 27<file '%s%eobserver_retval_by_ref_%d.php'> 28 <!-- init foo() --> 29 <foo> 30 <!-- init getMessage() --> 31 <getMessage> 32 </getMessage:'I should be observable'> 33 34Notice: Only variable references should be returned by reference in %s on line %d 35 </foo:'I should be observable'> 36 <foo> 37 <getMessage> 38 </getMessage:'I should be observable'> 39 40Notice: Only variable references should be returned by reference in %s on line %d 41 </foo:'I should be observable'> 42Done 43</file '%s%eobserver_retval_by_ref_%d.php'> 44