1--TEST-- 2Returning an object from stream_read() is invalid, but should not leak 3--FILE-- 4<?php 5class MyStream { 6 function stream_open() { 7 return true; 8 } 9 function stream_stat() { 10 return false; 11 } 12 function stream_read() { 13 return new stdClass; 14 } 15} 16stream_wrapper_register('mystream', MyStream::class); 17try { 18 var_dump(file_get_contents('mystream://')); 19} catch (Error $e) { 20 echo $e->getMessage(), "\n"; 21} 22?> 23--EXPECT-- 24Object of class stdClass could not be converted to string 25