1--TEST-- 2SplFileObject::ftruncate function - truncating with stream that does not support truncation 3--FILE-- 4<?php 5 6//create a basic stream class 7class VariableStream { 8 var $position; 9 var $varname; 10 11 function stream_open($path, $mode, $options, &$opened_path) 12 { 13 return true; 14 } 15 16 function url_stat() { 17 } 18} 19stream_wrapper_register("SPLtest", "VariableStream"); 20$ftruncate_test = ""; 21//end creating stream 22 23//open an SplFileObject using the above test stream 24$obj = New SplFileObject("SPLtest://ftruncate_test"); 25try { 26 $obj->ftruncate(1); 27} catch (LogicException $e) { 28 echo($e->getMessage()); 29} 30?> 31--EXPECTF-- 32Can't truncate file %s 33