????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.119.110.206 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/spl/tests/ |
Upload File : |
--TEST-- SplFileObject::fputcsv(): Usage variations -- with line without any CSV fields --FILE-- <?php /* Testing fputcsv() to write to a file when the field has no CSV format */ echo "*** Testing fputcsv() : with no CSV format in the field ***\n"; /* the array is with three elements in it. Each element should be read as 1st element is delimiter, 2nd element is enclosure and 3rd element is csv fields */ $fields = array( array('water_fruit\n'), array("water_fruit\n"), array("") ); $file_path = dirname(__FILE__); $file = "$file_path/fputcsv_variation10.tmp"; $file_modes = array ("r+", "r+b", "r+t", "a+", "a+b", "a+t", "w+", "w+b", "w+t", "x+", "x+b", "x+t"); $loop_counter = 1; foreach ($fields as $field) { for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { echo "\n-- file opened in $file_modes[$mode_counter] --\n"; // create the file and add the content with has csv fields if ( strstr($file_modes[$mode_counter], "r") ) { $fo = new SplFileObject($file, 'w'); } else { $fo = new SplFileObject($file, $file_modes[$mode_counter]); } $csv_field = $field; // write to a file in csv format var_dump( $fo->fputcsv($csv_field) ); // check the file pointer position and eof var_dump( $fo->ftell() ); var_dump( $fo->eof() ); //close the file unset($fo); // print the file contents var_dump( file_get_contents($file) ); //delete file unlink($file); } //end of mode loop } // end of foreach echo "Done\n"; ?> --EXPECTF-- *** Testing fputcsv() : with no CSV format in the field *** -- file opened in r+ -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in r+b -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in r+t -- int(16) int(16) bool(false) string(%d) ""water_fruit\n" " -- file opened in a+ -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in a+b -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in a+t -- int(16) int(16) bool(false) string(%d) ""water_fruit\n" " -- file opened in w+ -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in w+b -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in w+t -- int(16) int(16) bool(false) string(%d) ""water_fruit\n" " -- file opened in x+ -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in x+b -- int(16) int(16) bool(false) string(16) ""water_fruit\n" " -- file opened in x+t -- int(16) int(16) bool(false) string(%d) ""water_fruit\n" " -- file opened in r+ -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in r+b -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in r+t -- int(15) int(15) bool(false) string(%d) ""water_fruit " " -- file opened in a+ -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in a+b -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in a+t -- int(15) int(15) bool(false) string(%d) ""water_fruit " " -- file opened in w+ -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in w+b -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in w+t -- int(15) int(15) bool(false) string(%d) ""water_fruit " " -- file opened in x+ -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in x+b -- int(15) int(15) bool(false) string(15) ""water_fruit " " -- file opened in x+t -- int(15) int(15) bool(false) string(%d) ""water_fruit " " -- file opened in r+ -- int(1) int(1) bool(false) string(1) " " -- file opened in r+b -- int(1) int(1) bool(false) string(1) " " -- file opened in r+t -- int(1) int(1) bool(false) string(%d) " " -- file opened in a+ -- int(1) int(1) bool(false) string(1) " " -- file opened in a+b -- int(1) int(1) bool(false) string(1) " " -- file opened in a+t -- int(1) int(1) bool(false) string(%d) " " -- file opened in w+ -- int(1) int(1) bool(false) string(1) " " -- file opened in w+b -- int(1) int(1) bool(false) string(1) " " -- file opened in w+t -- int(1) int(1) bool(false) string(%d) " " -- file opened in x+ -- int(1) int(1) bool(false) string(1) " " -- file opened in x+b -- int(1) int(1) bool(false) string(1) " " -- file opened in x+t -- int(1) int(1) bool(false) string(%d) " " Done