本文整理汇总了PHP中show_file_block函数的典型用法代码示例。如果您正苦于以下问题:PHP show_file_block函数的具体用法?PHP show_file_block怎么用?PHP show_file_block使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_file_block函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_test
//.........这里部分代码省略.........
$env['QUERY_STRING'] = '';
$env['PATH_TRANSLATED'] = '';
$env['SCRIPT_FILENAME'] = '';
$env['REQUEST_METHOD'] = '';
$env['CONTENT_TYPE'] = '';
$env['CONTENT_LENGTH'] = '';
if (!empty($section_text['ENV'])) {
foreach (explode("\n", trim($section_text['ENV'])) as $e) {
$e = explode('=', trim($e), 2);
if (!empty($e[0]) && isset($e[1])) {
$env[$e[0]] = $e[1];
}
}
}
// Default ini settings
$ini_settings = array();
// additional ini overwrites
//$ini_overwrites[] = 'setting=value';
settings2array($ini_overwrites, $ini_settings);
// Any special ini settings
// these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
show_file_block('skip', $section_text['SKIPIF']);
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
} else {
$env['USE_ZEND_ALLOC'] = '1';
}
$output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$test_skipif}", $env);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
if (!strncasecmp('skip', ltrim($output), 4)) {
if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
}
if (isset($old_php)) {
$php = $old_php;
}
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
return 'SKIPPED';
}
if (!strncasecmp('info', ltrim($output), 4)) {
if (preg_match('/^\\s*info\\s*(.+)\\s*/i', $output, $m)) {
$info = " (info: {$m['1']})";
}
}
if (!strncasecmp('warn', ltrim($output), 4)) {
if (preg_match('/^\\s*warn\\s*(.+)\\s*/i', $output, $m)) {
示例2: run_test
//.........这里部分代码省略.........
$ini_settings = array();
// Additional required extensions
if (array_key_exists('EXTENSIONS', $section_text)) {
$ext_dir = `{$php} -r 'echo ini_get("extension_dir");'`;
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
$loaded = explode(",", `{$php} -n -r 'echo implode(",", get_loaded_extensions());'`);
foreach ($extensions as $req_ext) {
if (!in_array($req_ext, $loaded)) {
if ($req_ext == 'opcache') {
$ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
} else {
$ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
}
}
}
}
// additional ini overwrites
//$ini_overwrites[] = 'setting=value';
settings2array($ini_overwrites, $ini_settings);
// Any special ini settings
// these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
show_file_block('skip', $section_text['SKIPIF']);
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
$env['ZEND_DONT_UNLOAD_MODULES'] = 1;
} else {
$env['USE_ZEND_ALLOC'] = '1';
$env['ZEND_DONT_UNLOAD_MODULES'] = 0;
}
junit_start_timer($shortname);
$output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$no_file_cache} -d display_errors=0 \"{$test_skipif}\"", $env);
junit_finish_timer($shortname);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
if (!strncasecmp('skip', ltrim($output), 4)) {
if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
}
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
$message = !empty($m[1]) ? $m[1] : '';
junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
return 'SKIPPED';
}
if (!strncasecmp('info', ltrim($output), 4)) {
if (preg_match('/^\\s*info\\s*(.+)\\s*/i', $output, $m)) {
$info = " (info: {$m['1']})";
}