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 public $position; 9 public $varname; 10 public $context; 11 12 function stream_open($path, $mode, $options, &$opened_path) 13 { 14 return true; 15 } 16 17 function url_stat() { 18 } 19} 20stream_wrapper_register("SPLtest", "VariableStream"); 21$ftruncate_test = ""; 22//end creating stream 23 24//open an SplFileObject using the above test stream 25$obj = New SplFileObject("SPLtest://ftruncate_test"); 26try { 27 $obj->ftruncate(1); 28} catch (LogicException $e) { 29 echo($e->getMessage()); 30} 31?> 32--EXPECTF-- 33Can't truncate file %s 34