Annotation of embedaddon/php/ext/standard/tests/strings/vfprintf_error3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test vfprintf() function : error conditions (wrong argument types)
                      3: --CREDITS--
                      4: Felix De Vliegher <felix.devliegher@gmail.com>
                      5: --INI--
                      6: precision=14
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : int vfprintf(resource stream, string format, array args)
                     10:  * Description: Output a formatted string into a stream 
                     11:  * Source code: ext/standard/formatted_print.c
                     12:  * Alias to functions: 
                     13:  */
                     14: 
                     15: // Open handle
                     16: $file = 'vfprintf_test.txt';
                     17: $fp = fopen( $file, "a+" );
                     18: 
                     19: echo "\n-- Testing vfprintf() function with wrong variable types as argument --\n";
                     20: var_dump( vfprintf( $fp, array( 'foo %d', 'bar %s' ), 3.55552 ) );
                     21: 
                     22: rewind( $fp );
                     23: var_dump( stream_get_contents( $fp ) );
                     24: ftruncate( $fp, 0 );
                     25: rewind( $fp );
                     26: 
                     27: var_dump( vfprintf( $fp, "Foo %y fake", "not available" ) );
                     28: 
                     29: rewind( $fp );
                     30: var_dump( stream_get_contents( $fp ) );
                     31: ftruncate( $fp, 0 );
                     32: rewind( $fp );
                     33: 
                     34: // Close handle
                     35: fclose( $fp );
                     36: 
                     37: ?>
                     38: ===DONE===
                     39: --CLEAN--
                     40: <?php
                     41: 
                     42: $file = 'vfprintf_test.txt';
                     43: unlink( $file );
                     44: 
                     45: ?>
                     46: --EXPECTF--
                     47: -- Testing vfprintf() function with wrong variable types as argument --
                     48: 
                     49: Notice: Array to string conversion in %s on line %d
                     50: int(5)
                     51: string(5) "Array"
                     52: int(9)
                     53: string(9) "Foo  fake"
                     54: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>