From: Date: September 13 2007 1:29pm Subject: PHP mysqlnd svn commit: r1031 - trunk/tests/ext/mysqli List-Archive: http://lists.mysql.com/commits/34166 Message-Id: <200709131129.l8DBTqWQ017713@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: uwendel Date: 2007-09-13 13:29:52 +0200 (Thu, 13 Sep 2007) New Revision: 1031 Added: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_openbasedir.phpt Log: Test itself is a mess, I hate run-tests.php. However, restriction should be tested. Added: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_openbasedir.phpt =================================================================== --- trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_openbasedir.phpt 2007-09-13 11:26:50 UTC (rev 1030) +++ trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_openbasedir.phpt 2007-09-13 11:29:52 UTC (rev 1031) @@ -0,0 +1,93 @@ +--TEST-- +mysqli_set_local_infile_handler() - open basedir restrictions +--SKIPIF-- + +--INI-- +open_basedir="." +--FILE-- + 0) { + printf("[014] Test is too simple to handle a buffer of size %d that cannot hold all lines\n", $buflen); + $error = 'Parser too simple'; + } + + $buffer = ''; + foreach ($lines as $k => $line) { + if ('' === trim($line)) + continue; + + $columns = explode(';', $line); + if (empty($columns)) { + printf("[015] Cannot parse columns\n"); + $error = 'Cannot parse columns'; + } + + // increase id column value + $columns[0] += 1; + $buffer .= implode(';', $columns); + $buffer .= "\n"; + } + + return strlen($buffer); + } + + $file = create_standard_csv(5); + $expected = array( + array('id' => 98, 'label' => 'x'), + array('id' => 99, 'label' => 'y'), + array('id' => 100, 'label' => 'z'), + ); + try_handler(10, $link, $file, 'callback_simple', $expected); + mysqli_close($link); + print "done!"; +?> +--EXPECTF-- +Warning: tempnam(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d +[005 + 1] Cannot create CVS file '' +Callback set to 'callback_simple' +[012] LOAD DATA failed, [%d] %s +[014/0] [0] '' +done! \ No newline at end of file