fastcommon_file_put_contents bug fixed
parent
751cb2718a
commit
f7cd971224
|
|
@ -1267,7 +1267,7 @@ ZEND_FUNCTION(fastcommon_file_put_contents)
|
||||||
|
|
||||||
args[0] = &zfilename;
|
args[0] = &zfilename;
|
||||||
args[1] = zdata;
|
args[1] = zdata;
|
||||||
args[1] = &zflags;
|
args[2] = &zflags;
|
||||||
args[3] = zcontext;
|
args[3] = zcontext;
|
||||||
result = zend_call_user_function_wrapper(EG(function_table), NULL,
|
result = zend_call_user_function_wrapper(EG(function_table), NULL,
|
||||||
file_put_contents_func, return_value, 4, args TSRMLS_CC);
|
file_put_contents_func, return_value, 4, args TSRMLS_CC);
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define('TEST_FLAGS', FILE_APPEND);
|
||||||
|
define('LOOP_COUNT', 102400);
|
||||||
function test_fastcommon_file_put_contents()
|
function test_fastcommon_file_put_contents()
|
||||||
{
|
{
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
for ($i=0; $i<102400; $i++)
|
for ($i=0; $i<LOOP_COUNT; $i++)
|
||||||
{
|
{
|
||||||
fastcommon_file_put_contents("/tmp/test.log", "this is a test\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test.log", "this is a test\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test1.log", "this is a test11\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test1.log", "this is a test11\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test1.log", "this is a test12\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test1.log", "this is a test12\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test2.log", "this is a test21\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test2.log", "this is a test21\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test2.log", "this is a test22\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test2.log", "this is a test22\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test2.log", "this is a test23\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test2.log", "this is a test23\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test3.log", "this is a test31\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test3.log", "this is a test31\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test3.log", "this is a test32\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test3.log", "this is a test32\n", TEST_FLAGS);
|
||||||
fastcommon_file_put_contents("/tmp/test3.log", "this is a test33\n", FILE_APPEND);
|
fastcommon_file_put_contents("/tmp/test3.log", "this is a test33\n", TEST_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
|
|
@ -24,17 +26,17 @@ function test_fastcommon_file_put_contents()
|
||||||
function test_file_put_contents()
|
function test_file_put_contents()
|
||||||
{
|
{
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
for ($i=0; $i<102400; $i++)
|
for ($i=0; $i<LOOP_COUNT; $i++)
|
||||||
{
|
{
|
||||||
file_put_contents("/tmp/test.log", "this is a test\n", FILE_APPEND);
|
file_put_contents("/tmp/test.log", "this is a test\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test1.log", "this is a test11\n", FILE_APPEND);
|
file_put_contents("/tmp/test1.log", "this is a test11\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test1.log", "this is a test12\n", FILE_APPEND);
|
file_put_contents("/tmp/test1.log", "this is a test12\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test2.log", "this is a test21\n", FILE_APPEND);
|
file_put_contents("/tmp/test2.log", "this is a test21\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test2.log", "this is a test22\n", FILE_APPEND);
|
file_put_contents("/tmp/test2.log", "this is a test22\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test2.log", "this is a test23\n", FILE_APPEND);
|
file_put_contents("/tmp/test2.log", "this is a test23\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test3.log", "this is a test31\n", FILE_APPEND);
|
file_put_contents("/tmp/test3.log", "this is a test31\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test3.log", "this is a test32\n", FILE_APPEND);
|
file_put_contents("/tmp/test3.log", "this is a test32\n", TEST_FLAGS);
|
||||||
file_put_contents("/tmp/test3.log", "this is a test33\n", FILE_APPEND);
|
file_put_contents("/tmp/test3.log", "this is a test33\n", TEST_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue