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