mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Remove trailing whitespace in inc files
This commit is contained in:
parent
1422e2ffd1
commit
21e3b0c70c
84 changed files with 504 additions and 504 deletions
|
@ -26,7 +26,7 @@ class Foo
|
|||
{
|
||||
return $param1;
|
||||
}
|
||||
|
||||
|
||||
private static function privateStaticFunction($param1)
|
||||
{
|
||||
return $param1;
|
||||
|
@ -41,18 +41,18 @@ class Foo
|
|||
{
|
||||
return $param1;
|
||||
}
|
||||
|
||||
|
||||
protected function protectedInstanceFunc($param1)
|
||||
{
|
||||
return $param1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function publicInstanceFunc($param1)
|
||||
{
|
||||
return $param1;
|
||||
}
|
||||
|
||||
|
||||
public function closePrivateValid()
|
||||
{
|
||||
return Closure::fromCallable([$this, 'privateInstanceFunc']);
|
||||
|
@ -87,23 +87,23 @@ class Foo
|
|||
|
||||
|
||||
class SubFoo extends Foo {
|
||||
|
||||
|
||||
public function closePrivateStaticInvalid()
|
||||
{
|
||||
return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function closePrivateInvalid()
|
||||
{
|
||||
return Closure::fromCallable([$this, 'privateInstanceFunc']);
|
||||
}
|
||||
|
||||
|
||||
public function closeProtectedStaticMethod()
|
||||
{
|
||||
return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']);
|
||||
}
|
||||
|
||||
|
||||
public function closeProtectedValid()
|
||||
{
|
||||
return Closure::fromCallable([$this, 'protectedInstanceFunc']);
|
||||
|
@ -113,13 +113,13 @@ class SubFoo extends Foo {
|
|||
{
|
||||
return Closure::fromCallable('parent::publicInstanceFunc');
|
||||
}
|
||||
|
||||
|
||||
public function getSelfColonParentPublicInstanceMethod()
|
||||
{
|
||||
return Closure::fromCallable('self::publicInstanceFunc');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getSelfColonParentProtectedInstanceMethod()
|
||||
{
|
||||
return Closure::fromCallable('self::protectedInstanceFunc');
|
||||
|
|
|
@ -47,7 +47,7 @@ class IndexableRetrievable
|
|||
{
|
||||
private $label;
|
||||
private $indexable;
|
||||
|
||||
|
||||
public function __construct(string $label, Indexable $indexable) {
|
||||
$this->label = $label;
|
||||
$this->indexable = $indexable;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
if(!extension_loaded("calendar"))
|
||||
print "skip - CALENDAR extension not available";
|
||||
<?php
|
||||
if(!extension_loaded("calendar"))
|
||||
print "skip - CALENDAR extension not available";
|
||||
?>
|
||||
|
|
|
@ -8,7 +8,7 @@ function curl_cli_server_start() {
|
|||
if(getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
return getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
}
|
||||
|
||||
|
||||
$php_executable = getenv('TEST_PHP_EXECUTABLE');
|
||||
$doc_root = __DIR__;
|
||||
$router = "responder/get.php";
|
||||
|
@ -30,7 +30,7 @@ function curl_cli_server_start() {
|
|||
|
||||
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
|
||||
}
|
||||
|
||||
|
||||
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
|
||||
// it might not be listening yet...need to wait until fsockopen() call returns
|
||||
$error = "Unable to connect to server\n";
|
||||
|
|
|
@ -18,44 +18,44 @@ function get_php_info()
|
|||
function get_freetype_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
|
||||
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libjpeg_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
|
||||
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libpng_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
|
||||
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libxpm_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
|
||||
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ $imap_stream = imap_open($default_mailbox, $username, $password);
|
|||
// delete all msgs in default mailbox, i.e INBOX
|
||||
$check = imap_check($imap_stream);
|
||||
for ($i = 1; $i <= $check->Nmsgs; $i++) {
|
||||
imap_delete($imap_stream, $i);
|
||||
imap_delete($imap_stream, $i);
|
||||
}
|
||||
|
||||
$mailboxes = imap_getmailboxes($imap_stream, $server, '*');
|
||||
|
@ -14,12 +14,12 @@ $mailboxes = imap_getmailboxes($imap_stream, $server, '*');
|
|||
foreach($mailboxes as $value) {
|
||||
// Only delete mailboxes with our prefix
|
||||
if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) {
|
||||
if (strlen($match[1]) >= strlen($mailbox_prefix)
|
||||
if (strlen($match[1]) >= strlen($mailbox_prefix)
|
||||
&& substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) {
|
||||
imap_deletemailbox($imap_stream, $value->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imap_close($imap_stream, CL_EXPUNGE);
|
||||
imap_close($imap_stream, CL_EXPUNGE);
|
||||
?>
|
|
@ -3,7 +3,7 @@
|
|||
$server = '{127.0.0.1/norsh}';
|
||||
$default_mailbox = $server . "INBOX";
|
||||
$domain = "something.com";
|
||||
$admin_user = "webmaster"; // a user with admin access
|
||||
$admin_user = "webmaster"; // a user with admin access
|
||||
$username = "$admin_user@$domain";
|
||||
$password = 'p4ssw0rd';
|
||||
$users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids
|
||||
|
@ -56,39 +56,39 @@ function displayOverviewFields($resp, $fields=null) {
|
|||
|
||||
|
||||
/**
|
||||
* Create a test mailbox and populate with msgs
|
||||
* Create a test mailbox and populate with msgs
|
||||
*
|
||||
* @param string mailbox_suffix Suffix used to uniquely identify mailboxes
|
||||
* @param int message_count number of test msgs to be written to new mailbox
|
||||
*
|
||||
* @param int message_count number of test msgs to be written to new mailbox
|
||||
*
|
||||
* @return IMAP stream to new mailbox on success; FALSE on failure
|
||||
*/
|
||||
function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
|
||||
global $server, $default_mailbox, $username, $password;
|
||||
|
||||
|
||||
// open a stream to default mailbox
|
||||
$imap_stream = imap_open($default_mailbox, $username, $password);
|
||||
|
||||
if ($imap_stream === false) {
|
||||
echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
|
||||
$new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
|
||||
if ($new_mailbox === false) {
|
||||
echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
echo ".. mailbox '$new_mailbox' created\n";
|
||||
|
||||
|
||||
// reopen stream to new mailbox
|
||||
if (imap_reopen($imap_stream, $new_mailbox) === false) {
|
||||
echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $imap_stream;
|
||||
}
|
||||
|
||||
|
@ -101,9 +101,9 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul
|
|||
function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
|
||||
global $default_mailbox, $mailbox_prefix;
|
||||
$mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
|
||||
|
||||
|
||||
$mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
|
||||
|
||||
|
||||
// check mailbox does not already exist
|
||||
if ($mailboxes) {
|
||||
foreach($mailboxes as $value) {
|
||||
|
@ -111,17 +111,17 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type
|
|||
exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imap_createmailbox($imap_stream, $mailbox) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Add number of test msgs requested
|
||||
if ($message_count > 0) {
|
||||
populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $mailbox;
|
||||
}
|
||||
|
||||
|
@ -146,42 +146,42 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
|
|||
$envelope["from"]= "foo@anywhere.com";
|
||||
$envelope["to"] = "$users[0]@$domain";
|
||||
$envelope["subject"] = "Test msg $i";
|
||||
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
|
||||
$part2["type"] = TYPETEXT;
|
||||
$part2["subtype"] = "plain";
|
||||
$part2["description"] = "imap_mail_compose() function";
|
||||
$part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "Example";
|
||||
$part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
|
||||
|
||||
|
||||
$part4["type"] = TYPETEXT;
|
||||
$part4["subtype"] = "plain";
|
||||
$part4["description"] = "Return Values";
|
||||
$part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
|
||||
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
$body[4] = $part4;
|
||||
|
||||
|
||||
$msg = imap_mail_compose($envelope, $body);
|
||||
}
|
||||
|
||||
|
||||
imap_append($imap_stream, $mailbox, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mailbox name from a mailbox decription, i.e strip off server details.
|
||||
* Get the mailbox name from a mailbox decription, i.e strip off server details.
|
||||
*
|
||||
* @param string mailbox complete mailbox name
|
||||
* @return mailbox name
|
||||
* @param string mailbox complete mailbox name
|
||||
* @return mailbox name
|
||||
*/
|
||||
function get_mailbox_name($mailbox){
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
extension_loaded('imap') or die('skip imap extension not available in this build');
|
||||
|
||||
|
||||
// Change these to make tests run successfully
|
||||
$mailbox = '{localhost/norsh}';
|
||||
$username = 'webmaster@something.com';
|
||||
|
|
|
@ -14,7 +14,7 @@ function init_db()
|
|||
{
|
||||
global $test_base, $user, $password;
|
||||
|
||||
$test_db = ibase_query(IBASE_CREATE,
|
||||
$test_db = ibase_query(IBASE_CREATE,
|
||||
sprintf("CREATE SCHEMA '%s' USER '%s' PASSWORD '%s' DEFAULT CHARACTER SET %s",$test_base,
|
||||
$user, $password, ($charset = ini_get('ibase.default_charset')) ? $charset : 'NONE'));
|
||||
$tr = ibase_trans($test_db);
|
||||
|
@ -28,7 +28,7 @@ function init_db()
|
|||
function cleanup_db()
|
||||
{
|
||||
global $test_base;
|
||||
|
||||
|
||||
$r = ibase_connect($test_base);
|
||||
ibase_drop_db($r);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
if (!extension_loaded("interbase")) print "skip interbase extension not available";
|
||||
if (!extension_loaded("interbase")) print "skip interbase extension not available";
|
||||
require("interbase.inc");
|
||||
if(!@ibase_connect($test_base)){
|
||||
die("skip cannot connnect");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Custom Error Hanlder for testing
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
global $debug;
|
||||
|
||||
|
||||
$err_type = array (
|
||||
1 => "Error", // E_ERROR
|
||||
2 => "Warning", // E_WARINING
|
||||
|
@ -23,7 +23,7 @@ function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
|||
4096=> "Recoverable fatal error", // E_RECOVERABLE_ERROR
|
||||
8192=> "Deprecated", // E_DEPRECATED
|
||||
);
|
||||
|
||||
|
||||
if (!empty($debug)) {
|
||||
printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class tc
|
|||
public $s1 = '日本語EUC-JPの文字列';
|
||||
public $s2 = 'English Text';
|
||||
|
||||
function __construct()
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ if ((isset($matches[1]) && $matches[1] >= 11)) {
|
|||
"grant use on edition myedition1 to $testuser",
|
||||
);
|
||||
} else {
|
||||
// Server is Pre 11.2
|
||||
// Server is Pre 11.2
|
||||
$stmtarray = array(
|
||||
"drop user $testuser cascade",
|
||||
"create user $testuser identified by $testpassword",
|
||||
|
@ -34,7 +34,7 @@ foreach ($stmtarray as $stmt) {
|
|||
$m = oci_error($s);
|
||||
if (!in_array($m['code'], array( // ignore expected errors
|
||||
942 // table or view does not exist
|
||||
, 1918 // user does not exist
|
||||
, 1918 // user does not exist
|
||||
, 2289 // sequence does not exist
|
||||
, 4080 // trigger does not exist
|
||||
, 38802 // edition does not exist
|
||||
|
@ -50,8 +50,8 @@ foreach ($stmtarray as $stmt) {
|
|||
|
||||
function get_attr($conn,$attr)
|
||||
{
|
||||
$sel_stmt="select " .$attr. " from v\$session where sid =
|
||||
(select sid from v\$session where audsid =
|
||||
$sel_stmt="select " .$attr. " from v\$session where sid =
|
||||
(select sid from v\$session where audsid =
|
||||
sys_context('userenv','sessionid')) order by 1";
|
||||
$s2 = oci_parse($conn,$sel_stmt);
|
||||
oci_execute($s2,OCI_DEFAULT);
|
||||
|
@ -60,8 +60,8 @@ function get_attr($conn,$attr)
|
|||
}
|
||||
}
|
||||
|
||||
/* Pass $conn_type=1 for a connection with oci_connect()
|
||||
Pass $conn_type=2 for ooci_pconnect
|
||||
/* Pass $conn_type=1 for a connection with oci_connect()
|
||||
Pass $conn_type=2 for ooci_pconnect
|
||||
Default will give a oci_new_connect */
|
||||
|
||||
function get_conn($conn_type)
|
||||
|
@ -87,23 +87,23 @@ function get_conn($conn_type)
|
|||
|
||||
function set_attr($conn,$attr,$sufix)
|
||||
{
|
||||
if (!strcmp($attr,'MODULE'))
|
||||
if (!strcmp($attr,'MODULE'))
|
||||
$r = oci_set_module_name($conn,'PHP TEST'.$sufix);
|
||||
else if (!strcmp($attr,'ACTION'))
|
||||
else if (!strcmp($attr,'ACTION'))
|
||||
$r = oci_set_action($conn,'TASK'.$sufix);
|
||||
else if (!strcmp($attr,'CLIENT_INFO'))
|
||||
else if (!strcmp($attr,'CLIENT_INFO'))
|
||||
$r = oci_set_client_info($conn,'INFO1'.$sufix);
|
||||
else if (!strcmp($attr,'CLIENT_IDENTIFIER'))
|
||||
else if (!strcmp($attr,'CLIENT_IDENTIFIER'))
|
||||
$r = oci_set_client_identifier($conn,'ID00'.$sufix);
|
||||
else
|
||||
echo "Pass one of the above four attributes!!!\n";
|
||||
if ($r) {
|
||||
echo "Value of $attr has been set successfully\n";
|
||||
}
|
||||
|
||||
|
||||
//Do a round-trip here
|
||||
oci_server_version($conn);
|
||||
return $r;
|
||||
return $r;
|
||||
}
|
||||
|
||||
function set_edit_attr($value)
|
||||
|
@ -126,7 +126,7 @@ function get_edit_attr ($conn) {
|
|||
|
||||
function get_sys_attr($conn,$attr)
|
||||
{
|
||||
$sel_stmt="select " .$attr. " from v\$session where sid =
|
||||
$sel_stmt="select " .$attr. " from v\$session where sid =
|
||||
(select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1";
|
||||
$s2 = oci_parse($conn,$sel_stmt);
|
||||
oci_execute($s2,OCI_DEFAULT);
|
||||
|
@ -141,7 +141,7 @@ function clean_up($c) {
|
|||
"drop edition myedition cascade",
|
||||
"drop user " . $GLOBALS['testuser'] . " cascade",
|
||||
);
|
||||
|
||||
|
||||
foreach ($stmtarray as $stmt) {
|
||||
$s = oci_parse($c, $stmt);
|
||||
@oci_execute($s);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
@OCIExecute($statement);
|
||||
|
||||
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)";
|
||||
|
||||
|
||||
$statement = OCIParse($c,$ora_sql);
|
||||
OCIExecute($statement);
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) {
|
|||
$dbase = "localhost/XE";
|
||||
$test_drcp = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Common object names for scripts to use
|
||||
*/
|
||||
|
||||
|
||||
$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
|
||||
$type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
|
||||
$schema = '';
|
||||
|
|
|
@ -7,7 +7,7 @@ function drcp_create_table($conn)
|
|||
$create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))";
|
||||
$statement = oci_parse($conn, $create_sql);
|
||||
oci_execute($statement);
|
||||
|
||||
|
||||
$id_values = array(100,101,102,103,104,105,106,107,108);
|
||||
$name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT",
|
||||
"BILL","LAWSON","MARY");
|
||||
|
@ -17,7 +17,7 @@ function drcp_create_table($conn)
|
|||
$insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
|
||||
$s = oci_parse($conn, $insert);
|
||||
oci_execute($s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function drcp_drop_table($conn)
|
||||
|
@ -74,12 +74,12 @@ function drcp_create_package($c)
|
|||
end;";
|
||||
$s1 = oci_parse($c, $create_package_stmt);
|
||||
oci_execute($s1);
|
||||
|
||||
|
||||
$package_body = "create or replace package body drcp_test_package as
|
||||
procedure p1(var1 int) is
|
||||
begin
|
||||
var :=var1;
|
||||
end;
|
||||
end;
|
||||
function f1 return number is
|
||||
begin
|
||||
return drcp_test_package.var;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
if ($c) {
|
||||
$ora_sql = "DROP TABLE ".$schema.$table_name;
|
||||
$ora_sql = "DROP TABLE ".$schema.$table_name;
|
||||
$statement = oci_parse($c,$ora_sql);
|
||||
oci_execute($statement);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class ServerClientTestCase
|
|||
eval($this->stripPhpTagsFromCode($proc1Code));
|
||||
$this->cleanupWorkerProcess();
|
||||
}
|
||||
|
||||
|
||||
public function wait()
|
||||
{
|
||||
fgets($this->isWorker ? STDIN : $this->workerStdOut);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
if (!function_exists('setlocale')) {
|
||||
die('skip: setlocale() not available');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php /* $Id$ */
|
||||
|
||||
if (!extension_loaded("interbase") || !extension_loaded("pdo_firebird")) print "skip";
|
||||
if (!extension_loaded("interbase") || !extension_loaded("pdo_firebird")) print "skip";
|
||||
|
||||
?>
|
||||
|
|
|
@ -25,7 +25,7 @@ function init_db()
|
|||
function cleanup_db()
|
||||
{
|
||||
global $test_base;
|
||||
|
||||
|
||||
$r = ibase_connect($test_base);
|
||||
ibase_drop_db($r);
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ class MySQLPDOTest extends PDOTest {
|
|||
|
||||
}
|
||||
|
||||
static function detect_transactional_mysql_engine($db) {
|
||||
static function detect_transactional_mysql_engine($db) {
|
||||
foreach ($db->query("show variables like 'have%'") as $row) {
|
||||
if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) {
|
||||
return str_replace("have_", "", $row[0]);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// {{{ class Phar extends PHP_Archive
|
||||
/**
|
||||
* Phar class
|
||||
*
|
||||
*
|
||||
* @ingroup Phar
|
||||
* @brief Phar implementation
|
||||
* @author Marcus Boerger
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
// {{{ class PharCommand extends CLICommand
|
||||
/**
|
||||
* PharCommand class
|
||||
*
|
||||
*
|
||||
* This class handles the handling of the phar
|
||||
* commands. It will be used from command line/console
|
||||
* in order to retrieve and execute phar functions.
|
||||
*
|
||||
*
|
||||
* @ingroup Phar
|
||||
* @brief Phar console command implementation
|
||||
* @author Marcus Boerger
|
||||
|
@ -47,7 +47,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ static function phar_args
|
||||
/**
|
||||
* Phar arguments
|
||||
*
|
||||
*
|
||||
* This function contains all the phar commands
|
||||
*
|
||||
* @param string $which Which argument is chosen.
|
||||
|
@ -185,7 +185,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ static function strEndsWith
|
||||
/**
|
||||
* String Ends With
|
||||
*
|
||||
*
|
||||
* Whether a string ends with another needle.
|
||||
*
|
||||
* @param string $haystack The haystack
|
||||
|
@ -285,7 +285,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ static function cli_arg_typ_pharfile
|
||||
/**
|
||||
* Argument type existing Phar file
|
||||
*
|
||||
*
|
||||
* Return filename of an existing Phar.
|
||||
*
|
||||
* @param string $arg The file in the phar to open.
|
||||
|
@ -312,10 +312,10 @@ class PharCommand extends CLICommand
|
|||
// {{{ static function cli_arg_typ_pharurl
|
||||
/**
|
||||
* Argument type Phar url-like
|
||||
*
|
||||
*
|
||||
* Check the argument as cli_arg_Typ_phar and return its name prefixed
|
||||
* with phar://
|
||||
*
|
||||
*
|
||||
* Ex:
|
||||
* <code>
|
||||
* $arg = 'pharchive.phar/file.php';
|
||||
|
@ -544,9 +544,9 @@ class PharCommand extends CLICommand
|
|||
// {{{ function cli_cmd_run_pack
|
||||
/**
|
||||
* Pack a new Phar
|
||||
*
|
||||
*
|
||||
* This function will try to pack a new Phar archive.
|
||||
*
|
||||
*
|
||||
* @see Exit to make sure that we are done.
|
||||
*/
|
||||
public function cli_cmd_run_pack()
|
||||
|
@ -617,7 +617,7 @@ class PharCommand extends CLICommand
|
|||
*
|
||||
* This function will take a directory and iterate through
|
||||
* it and get the files to insert into the Phar archive.
|
||||
*
|
||||
*
|
||||
* @param Phar $phar The phar object.
|
||||
* @param string $input The input directory
|
||||
* @param string $regex The regex used in RegexIterator.
|
||||
|
@ -712,7 +712,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function phar_dir_operation
|
||||
/**
|
||||
* Directory operations
|
||||
*
|
||||
*
|
||||
* Phar directory operations.
|
||||
*
|
||||
* @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object.
|
||||
|
@ -801,9 +801,9 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function cli_cmd_run_tree
|
||||
/**
|
||||
* Cli Command Run Tree
|
||||
*
|
||||
*
|
||||
* Set the phar_dir_operation with a directorygraphiterator.
|
||||
*
|
||||
*
|
||||
* @see DirectoryGraphIterator
|
||||
* @see $this->phar_dir_operation
|
||||
*
|
||||
|
@ -834,7 +834,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ static function cli_cmd_arg_extract
|
||||
/**
|
||||
* Cli Command Arguments Extract
|
||||
*
|
||||
*
|
||||
* The arguments for the extract function.
|
||||
*
|
||||
* @return array The arguments for the extraction.
|
||||
|
@ -855,7 +855,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function cli_cmd_run_extract
|
||||
/**
|
||||
* Run Extract
|
||||
*
|
||||
*
|
||||
* Run the extraction of a phar Archive.
|
||||
*
|
||||
* @see $this->phar_dir_operation
|
||||
|
@ -889,7 +889,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function phar_dir_extract
|
||||
/**
|
||||
* Extract to a directory
|
||||
*
|
||||
*
|
||||
* This function will extract the content of a Phar
|
||||
* to a directory and create new files and directories
|
||||
* depending on the permissions on that folder.
|
||||
|
@ -1085,7 +1085,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function cli_cmd_run_stub_get
|
||||
/**
|
||||
* Cli Command Run Stub
|
||||
*
|
||||
*
|
||||
* Get arguments and store them into a stub.
|
||||
*
|
||||
* @param arguments $args
|
||||
|
@ -1102,7 +1102,7 @@ class PharCommand extends CLICommand
|
|||
// {{{ public function cli_cmd_inf_compress
|
||||
/**
|
||||
* Cli Command Inf Compress
|
||||
*
|
||||
*
|
||||
* Cli Command compress informations
|
||||
*
|
||||
* @return string A description of the command.
|
||||
|
|
|
@ -32,7 +32,7 @@ class corrupt_tarmaker
|
|||
|
||||
/**
|
||||
* save a file inside this package
|
||||
*
|
||||
*
|
||||
* This code is modified from Vincent Lascaux's File_Archive
|
||||
* package, which is licensed under the LGPL license.
|
||||
* @param string relative path within the package
|
||||
|
@ -152,7 +152,7 @@ class corrupt_tarmaker
|
|||
|
||||
/**
|
||||
* Create an internal directory, creating parent directories as needed
|
||||
*
|
||||
*
|
||||
* @param string $dir
|
||||
*/
|
||||
function mkdir($dir)
|
||||
|
|
|
@ -33,7 +33,7 @@ class danger_tarmaker
|
|||
|
||||
/**
|
||||
* save a file inside this package
|
||||
*
|
||||
*
|
||||
* This code is modified from Vincent Lascaux's File_Archive
|
||||
* package, which is licensed under the LGPL license.
|
||||
* @param string relative path within the package
|
||||
|
@ -145,7 +145,7 @@ class danger_tarmaker
|
|||
|
||||
/**
|
||||
* Create an internal directory, creating parent directories as needed
|
||||
*
|
||||
*
|
||||
* @param string $dir
|
||||
*/
|
||||
function mkdir($dir)
|
||||
|
|
|
@ -32,7 +32,7 @@ class tarmaker
|
|||
|
||||
/**
|
||||
* save a file inside this package
|
||||
*
|
||||
*
|
||||
* This code is modified from Vincent Lascaux's File_Archive
|
||||
* package, which is licensed under the LGPL license.
|
||||
* @param string relative path within the package
|
||||
|
@ -144,7 +144,7 @@ class tarmaker
|
|||
|
||||
/**
|
||||
* Create an internal directory, creating parent directories as needed
|
||||
*
|
||||
*
|
||||
* @param string $dir
|
||||
*/
|
||||
function mkdir($dir)
|
||||
|
|
|
@ -51,7 +51,7 @@ class zipmaker
|
|||
|
||||
/**
|
||||
* Create an internal directory, creating parent directories as needed
|
||||
*
|
||||
*
|
||||
* This is a no-op for the tar creator
|
||||
* @param string $dir
|
||||
*/
|
||||
|
|
|
@ -4,11 +4,11 @@ class ReflectionExceptionEx extends ReflectionException {
|
|||
$this->errno = $_errno;
|
||||
$this->errmsg = $_errmsg;
|
||||
}
|
||||
|
||||
|
||||
function getErrno() {
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
|
||||
function getErrmsg() {
|
||||
return $this->errmsg;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ function gc($maxlifetime) {
|
|||
$directory = opendir($session_save_path."/");
|
||||
$length = strlen(SESSION_FILE_PREFIX);
|
||||
while (($file = readdir($directory)) !== FALSE) {
|
||||
$qualified = ($session_save_path."/".$file);
|
||||
$qualified = ($session_save_path."/".$file);
|
||||
if (is_file($qualified) === TRUE) {
|
||||
if (substr($file, 0, $length) === SESSION_FILE_PREFIX && (filemtime($qualified) + $maxlifetime <= time() )) {
|
||||
unlink($qualified);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
extension_loaded('snmp') or die('skip snmp extension not available in this build');
|
||||
|
||||
|
||||
require_once (dirname(__FILE__).'/snmp_include.inc');
|
||||
|
||||
//test server is available
|
||||
// this require snmpget to work ...
|
||||
//snmpget ( string $hostname , string $community ,
|
||||
//snmpget ( string $hostname , string $community ,
|
||||
//string $object_id [, int $timeout [, int $retries ]] )
|
||||
|
||||
if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
class SOAP_Interop_GroupD {
|
||||
|
||||
function echoString($inputString)
|
||||
{
|
||||
{
|
||||
return array("return"=>$inputString->param0);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class SOAP_Interop_GroupI {
|
|||
return array("return"=>$boolean->inputBoolean);
|
||||
}
|
||||
|
||||
function echoComplexTypeAsSimpleTypes($input)
|
||||
function echoComplexTypeAsSimpleTypes($input)
|
||||
{
|
||||
if (isset($input->inputComplexType)) {
|
||||
$ret = array("outputInteger" => $input->inputComplexType->varInt,
|
||||
|
@ -116,7 +116,7 @@ class SOAP_Interop_GroupI {
|
|||
}
|
||||
}
|
||||
|
||||
function echoSimpleTypesAsComplexType($input)
|
||||
function echoSimpleTypesAsComplexType($input)
|
||||
{
|
||||
$ret = array("varInt" => $input->inputInteger,
|
||||
"varFloat" => $input->inputFloat);
|
||||
|
|
|
@ -44,7 +44,7 @@ $wsdl = <<<EOF
|
|||
</binding>
|
||||
<service name="testService">
|
||||
<port name="testPort" binding="tns:testBinding">
|
||||
<soap:address location="test://" />
|
||||
<soap:address location="test://" />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
|
|
|
@ -23,7 +23,7 @@ function __load_class($classname, $dir)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Class loader for SPL example classes
|
||||
* @author Marcus Boerger
|
||||
* @version 1.0
|
||||
|
|
|
@ -49,12 +49,12 @@ class DbaArray extends DbaReader implements ArrayAccess
|
|||
*/
|
||||
function offsetGet($name)
|
||||
{
|
||||
$data = dba_fetch($name, $this->db);
|
||||
$data = dba_fetch($name, $this->db);
|
||||
if($data) {
|
||||
//return unserialize($data);
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class DbaReader implements Iterator
|
|||
throw new exception('Could not open file ' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close database.
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ class DbaReader implements Iterator
|
|||
|
||||
/**
|
||||
* Fetches the current data if $key is valid
|
||||
*/
|
||||
*/
|
||||
private function fetch_data() {
|
||||
if ($this->key !== false) {
|
||||
$this->val = dba_fetch($this->key, $this->db);
|
||||
|
|
|
@ -28,7 +28,7 @@ class DirectoryFilterDots extends RecursiveFilterIterator
|
|||
}
|
||||
|
||||
/** @return whether the current entry is neither '.' nor '..'
|
||||
*/
|
||||
*/
|
||||
function accept()
|
||||
{
|
||||
return !$this->getInnerIterator()->isDot();
|
||||
|
|
|
@ -23,9 +23,9 @@ class DirectoryGraphIterator extends DirectoryTreeIterator
|
|||
new ParentIterator(
|
||||
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
|
||||
)
|
||||
),
|
||||
),
|
||||
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
|
||||
),
|
||||
),
|
||||
parent::SELF_FIRST
|
||||
);
|
||||
}
|
||||
|
|
|
@ -24,27 +24,27 @@ class DirectoryTreeIterator extends RecursiveIteratorIterator
|
|||
parent::__construct(
|
||||
new RecursiveCachingIterator(
|
||||
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
|
||||
),
|
||||
),
|
||||
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
|
||||
),
|
||||
),
|
||||
parent::SELF_FIRST
|
||||
);
|
||||
}
|
||||
|
||||
/** @return the current element prefixed with ASCII graphics
|
||||
*/
|
||||
*/
|
||||
function current()
|
||||
{
|
||||
$tree = '';
|
||||
for ($l=0; $l < $this->getDepth(); $l++) {
|
||||
$tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
|
||||
}
|
||||
return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
|
||||
return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
|
||||
. $this->getSubIterator($l)->__toString();
|
||||
}
|
||||
|
||||
/** Aggregates the inner iterator
|
||||
*/
|
||||
*/
|
||||
function __call($func, $params)
|
||||
{
|
||||
return call_user_func_array(array($this->getSubIterator(), $func), $params);
|
||||
|
|
|
@ -24,9 +24,9 @@ class DualIterator implements Iterator
|
|||
const KEY_LHS = 0x10;
|
||||
const KEY_RHS = 0x20;
|
||||
const KEY_0 = 0x00;
|
||||
|
||||
|
||||
const DEFAULT_FLAGS = 0x13;
|
||||
|
||||
|
||||
private $lhs;
|
||||
private $rhs;
|
||||
private $flags;
|
||||
|
@ -37,7 +37,7 @@ class DualIterator implements Iterator
|
|||
* @param rhs Right Hand Side Iterator
|
||||
* @param flags iteration flags
|
||||
*/
|
||||
function __construct(Iterator $lhs, Iterator $rhs,
|
||||
function __construct(Iterator $lhs, Iterator $rhs,
|
||||
$flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
|
||||
{
|
||||
$this->lhs = $lhs;
|
||||
|
@ -74,22 +74,22 @@ class DualIterator implements Iterator
|
|||
}
|
||||
|
||||
/** rewind both inner iterators
|
||||
*/
|
||||
*/
|
||||
function rewind()
|
||||
{
|
||||
$this->lhs->rewind();
|
||||
$this->rhs->rewind();
|
||||
$this->rhs->rewind();
|
||||
}
|
||||
|
||||
/** @return whether both inner iterators are valid
|
||||
*/
|
||||
*/
|
||||
function valid()
|
||||
{
|
||||
return $this->lhs->valid() && $this->rhs->valid();
|
||||
return $this->lhs->valid() && $this->rhs->valid();
|
||||
}
|
||||
|
||||
/** @return current value depending on CURRENT_* flags
|
||||
*/
|
||||
*/
|
||||
function current()
|
||||
{
|
||||
switch($this->flags & 0x0F)
|
||||
|
@ -107,7 +107,7 @@ class DualIterator implements Iterator
|
|||
}
|
||||
|
||||
/** @return key value depending on KEY_* flags
|
||||
*/
|
||||
*/
|
||||
function key()
|
||||
{
|
||||
switch($this->flags & 0xF0)
|
||||
|
@ -123,14 +123,14 @@ class DualIterator implements Iterator
|
|||
}
|
||||
|
||||
/** move both inner iterators forward
|
||||
*/
|
||||
*/
|
||||
function next()
|
||||
{
|
||||
$this->lhs->next();
|
||||
$this->rhs->next();
|
||||
}
|
||||
|
||||
/** @return whether both inner iterators are valid and have identical
|
||||
/** @return whether both inner iterators are valid and have identical
|
||||
* current and key values or both are non valid.
|
||||
*/
|
||||
function areIdentical()
|
||||
|
@ -141,7 +141,7 @@ class DualIterator implements Iterator
|
|||
: $this->lhs->valid() == $this->rhs->valid();
|
||||
}
|
||||
|
||||
/** @return whether both inner iterators are valid and have equal current
|
||||
/** @return whether both inner iterators are valid and have equal current
|
||||
* and key values or both are non valid.
|
||||
*/
|
||||
function areEqual()
|
||||
|
@ -162,14 +162,14 @@ class DualIterator implements Iterator
|
|||
* @note If one implements RecursiveIterator the other must do as well.
|
||||
* And if both do then a recursive comparison is being used.
|
||||
*/
|
||||
static function compareIterators(Iterator $lhs, Iterator $rhs,
|
||||
static function compareIterators(Iterator $lhs, Iterator $rhs,
|
||||
$identical = false)
|
||||
{
|
||||
if ($lhs instanceof RecursiveIterator)
|
||||
{
|
||||
if ($rhs instanceof RecursiveIterator)
|
||||
{
|
||||
$it = new RecursiveDualIterator($lhs, $rhs,
|
||||
$it = new RecursiveDualIterator($lhs, $rhs,
|
||||
self::CURRENT_0 | self::KEY_0);
|
||||
$it = new RecursiveCompareDualIterator($it);
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@ if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
|
|||
* @version 1.1
|
||||
*
|
||||
* Using this class you can iterator over all groups of a ini file.
|
||||
*
|
||||
*
|
||||
* This class uses a 'is-a' relation to KeyFilter in contrast to a 'has-a'
|
||||
* relation. Doing so both current() and key() methods must be overwritten.
|
||||
* relation. Doing so both current() and key() methods must be overwritten.
|
||||
* If it would use a 'has-a' relation there would be much more to type...
|
||||
* but for puritists that would allow correctness in so far as then no
|
||||
* but for puritists that would allow correctness in so far as then no
|
||||
* key() would be needed.
|
||||
*/
|
||||
class IniGroups extends KeyFilter
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* Instances of this class act as a filter around iterators whose elements
|
||||
* are strings. In other words you can put an iterator into the constructor
|
||||
* and the instance will only return elements which match the given regular
|
||||
* and the instance will only return elements which match the given regular
|
||||
* expression.
|
||||
*/
|
||||
class KeyFilter extends FilterIterator
|
||||
|
@ -38,13 +38,13 @@ class KeyFilter extends FilterIterator
|
|||
$this->regex = $regex;
|
||||
}
|
||||
|
||||
/** \return whether the current key mathes the regular expression
|
||||
/** \return whether the current key mathes the regular expression
|
||||
*/
|
||||
function accept()
|
||||
{
|
||||
return ereg($this->regex, $this->getInnerIterator()->key());
|
||||
}
|
||||
|
||||
|
||||
/** @return regular expression used as filter
|
||||
*/
|
||||
function getRegex()
|
||||
|
@ -57,7 +57,7 @@ class KeyFilter extends FilterIterator
|
|||
*/
|
||||
protected function __clone()
|
||||
{
|
||||
// disallow clone
|
||||
// disallow clone
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
|
|||
}
|
||||
|
||||
/** Rewind iteration andcomparison process. Starting with $equal = true.
|
||||
*/
|
||||
*/
|
||||
function rewind()
|
||||
{
|
||||
$this->equal = true;
|
||||
|
@ -49,7 +49,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
|
|||
&& !$this->getInnerIterator()->getRHS()->valid();
|
||||
}
|
||||
|
||||
/** @return whether both inner iterators are valid and have identical
|
||||
/** @return whether both inner iterators are valid and have identical
|
||||
* current and key values or both are non valid.
|
||||
*/
|
||||
function areIdentical()
|
||||
|
@ -57,7 +57,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
|
|||
return $this->equal && $this->getInnerIterator()->areIdentical();
|
||||
}
|
||||
|
||||
/** @return whether both inner iterators are valid and have equal current
|
||||
/** @return whether both inner iterators are valid and have equal current
|
||||
* and key values or both are non valid.
|
||||
*/
|
||||
function areEqual()
|
||||
|
|
|
@ -24,7 +24,7 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
|
|||
* @param rhs Right Hand Side Iterator
|
||||
* @param flags iteration flags
|
||||
*/
|
||||
function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs,
|
||||
function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs,
|
||||
$flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
|
||||
{
|
||||
parent::__construct($lhs, $rhs, $flags);
|
||||
|
@ -34,10 +34,10 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
|
|||
*/
|
||||
function hasChildren()
|
||||
{
|
||||
return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren();
|
||||
return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren();
|
||||
}
|
||||
|
||||
/** @return new RecursiveDualIterator (late binding) for the two inner
|
||||
/** @return new RecursiveDualIterator (late binding) for the two inner
|
||||
* iterators current children.
|
||||
*/
|
||||
function getChildren()
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract class SearchIterator extends FilterIterator
|
|||
{
|
||||
return !$this->done && parent::valid();
|
||||
}
|
||||
|
||||
|
||||
/** Do not move forward but instead mark as finished.
|
||||
* @return void
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ abstract class SearchIterator extends FilterIterator
|
|||
}
|
||||
|
||||
/** Aggregates the inner iterator
|
||||
*/
|
||||
*/
|
||||
function __call($func, $params)
|
||||
{
|
||||
return call_user_func_array(array($this->getInnerIterator(), $func), $params);
|
||||
|
|
|
@ -34,7 +34,7 @@ class AppendIterator implements OuterIterator
|
|||
* the AppendIterator itself becomes valid. However there will be no
|
||||
* call to $it->rewind(). Also if the current state is invalid the inner
|
||||
* ArrayIterator will be rewound und forwarded to the appended element.
|
||||
*/
|
||||
*/
|
||||
function append(Iterator $it)
|
||||
{
|
||||
$this->iterators->append($it);
|
||||
|
@ -84,7 +84,7 @@ class AppendIterator implements OuterIterator
|
|||
return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL;
|
||||
}
|
||||
|
||||
/** Move to the next element. If this means to another Iterator that
|
||||
/** Move to the next element. If this means to another Iterator that
|
||||
* rewind that Iterator.
|
||||
* @return void
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ class AppendIterator implements OuterIterator
|
|||
}
|
||||
|
||||
/** Aggregates the inner iterator
|
||||
*/
|
||||
*/
|
||||
function __call($func, $params)
|
||||
{
|
||||
return call_user_func_array(array($this->getInnerIterator(), $func), $params);
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* This iterator wrapper does a one ahead iteration. This way it knows whether
|
||||
* the inner iterator has one more element.
|
||||
*
|
||||
* @note If you want to convert the elements into strings and the inner
|
||||
* Iterator is an internal Iterator then you need to provide the
|
||||
* @note If you want to convert the elements into strings and the inner
|
||||
* Iterator is an internal Iterator then you need to provide the
|
||||
* flag CALL_TOSTRING to do the conversion when the actual element
|
||||
* is being fetched. Otherwise the conversion would happen with the
|
||||
* already changed iterator. If you do not need this then it you should
|
||||
|
@ -41,7 +41,7 @@ class CachingIterator implements OuterIterator
|
|||
/** Construct from another iterator
|
||||
*
|
||||
* @param it Iterator to cache
|
||||
* @param flags Bitmask:
|
||||
* @param flags Bitmask:
|
||||
* - CALL_TOSTRING (whether to call __toString() for every element)
|
||||
*/
|
||||
function __construct(Iterator $it, $flags = self::CALL_TOSTRING)
|
||||
|
@ -63,7 +63,7 @@ class CachingIterator implements OuterIterator
|
|||
$this->it->rewind();
|
||||
$this->next();
|
||||
}
|
||||
|
||||
|
||||
/** Forward to the next element
|
||||
*/
|
||||
function next()
|
||||
|
@ -85,7 +85,7 @@ class CachingIterator implements OuterIterator
|
|||
}
|
||||
$this->it->next();
|
||||
}
|
||||
|
||||
|
||||
/** @return whether the iterator is valid
|
||||
*/
|
||||
function valid()
|
||||
|
@ -99,7 +99,7 @@ class CachingIterator implements OuterIterator
|
|||
{
|
||||
return $this->it->valid();
|
||||
}
|
||||
|
||||
|
||||
/** @return the current element
|
||||
*/
|
||||
function current()
|
||||
|
@ -123,8 +123,8 @@ class CachingIterator implements OuterIterator
|
|||
{
|
||||
return call_user_func_array(array($this->it, $func), $params);
|
||||
}
|
||||
|
||||
/** @return the string represenatation that was generated for the current
|
||||
|
||||
/** @return the string represenatation that was generated for the current
|
||||
* element
|
||||
* @throw exception when CALL_TOSTRING was not specified in constructor
|
||||
*/
|
||||
|
@ -144,10 +144,10 @@ class CachingIterator implements OuterIterator
|
|||
}
|
||||
return $this->strValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The inner iterator
|
||||
*/
|
||||
*/
|
||||
function getInnerIterator()
|
||||
{
|
||||
return $this->it;
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
* @version 1.1
|
||||
* @since PHP 5.0
|
||||
*
|
||||
* Instances of this class act as a filter around iterators. In other words
|
||||
* you can put an iterator into the constructor and the instance will only
|
||||
* Instances of this class act as a filter around iterators. In other words
|
||||
* you can put an iterator into the constructor and the instance will only
|
||||
* return selected (accepted) elements.
|
||||
*
|
||||
* The only thing that needs to be done to make this work is implementing
|
||||
* method accept(). Typically this invloves reading the current element or
|
||||
* The only thing that needs to be done to make this work is implementing
|
||||
* method accept(). Typically this invloves reading the current element or
|
||||
* key of the inner Iterator and checking whether it is acceptable.
|
||||
*/
|
||||
abstract class FilterIterator implements OuterIterator
|
||||
|
@ -39,7 +39,7 @@ abstract class FilterIterator implements OuterIterator
|
|||
/**
|
||||
* Rewind the inner iterator.
|
||||
*/
|
||||
function rewind() {
|
||||
function rewind() {
|
||||
$this->it->rewind();
|
||||
$this->fetch();
|
||||
}
|
||||
|
@ -76,38 +76,38 @@ abstract class FilterIterator implements OuterIterator
|
|||
$this->it->next();
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Whether more elements are available
|
||||
*/
|
||||
function valid() {
|
||||
return $this->it->valid();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The current key
|
||||
*/
|
||||
function key() {
|
||||
return $this->it->key();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The current value
|
||||
*/
|
||||
function current() {
|
||||
return $this->it->current();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hidden __clone
|
||||
*/
|
||||
protected function __clone() {
|
||||
// disallow clone
|
||||
// disallow clone
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The inner iterator
|
||||
*/
|
||||
*/
|
||||
function getInnerIterator()
|
||||
{
|
||||
return $this->it;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* @brief Basic Iterator wrapper
|
||||
* @since PHP 5.1
|
||||
*
|
||||
* This iterator wrapper allows to convert anything that is traversable into
|
||||
* an Iterator. It is very important to understand that most classes that do
|
||||
* This iterator wrapper allows to convert anything that is traversable into
|
||||
* an Iterator. It is very important to understand that most classes that do
|
||||
* not implement Iterator have their reasone to. Most likely they do not allow
|
||||
* the full Iterator feature set. If so you need to provide techniques to
|
||||
* prevent missuse. If you do not you must expect exceptions or fatal errors.
|
||||
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
\endcode
|
||||
*
|
||||
* As you can see in the example this approach requires that the class to
|
||||
* As you can see in the example this approach requires that the class to
|
||||
* downcast to is actually a base class of the specified iterator to wrap.
|
||||
* Omitting the downcast in the above example would result in an endless loop
|
||||
* since IteratorIterator::__construct() would call SomeClass::getIterator().
|
||||
|
|
|
@ -47,7 +47,7 @@ class LimitIterator implements OuterIterator
|
|||
$this->count = $count;
|
||||
$this->pos = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Seek to specified position
|
||||
* @param position offset to seek to (relative to beginning not offset
|
||||
* specified in constructor).
|
||||
|
@ -78,14 +78,14 @@ class LimitIterator implements OuterIterator
|
|||
$this->pos = 0;
|
||||
$this->seek($this->offset);
|
||||
}
|
||||
|
||||
|
||||
/** @return whether iterator is valid
|
||||
*/
|
||||
function valid() {
|
||||
return ($this->count == -1 || $this->pos < $this->offset + $this->count)
|
||||
&& $this->it->valid();
|
||||
}
|
||||
|
||||
|
||||
/** @return current key
|
||||
*/
|
||||
function key() {
|
||||
|
@ -105,7 +105,7 @@ class LimitIterator implements OuterIterator
|
|||
$this->pos++;
|
||||
}
|
||||
|
||||
/** @return current position relative to zero (not to offset specified in
|
||||
/** @return current position relative to zero (not to offset specified in
|
||||
* constructor).
|
||||
*/
|
||||
function getPosition() {
|
||||
|
@ -114,7 +114,7 @@ class LimitIterator implements OuterIterator
|
|||
|
||||
/**
|
||||
* @return The inner iterator
|
||||
*/
|
||||
*/
|
||||
function getInnerIterator()
|
||||
{
|
||||
return $this->it;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* @version 1.2
|
||||
* @since PHP 5.1
|
||||
*
|
||||
* This extended FilterIterator allows a recursive iteration using
|
||||
* RecursiveIteratorIterator that only shows those elements which have
|
||||
* This extended FilterIterator allows a recursive iteration using
|
||||
* RecursiveIteratorIterator that only shows those elements which have
|
||||
* children.
|
||||
*/
|
||||
class ParentIterator extends RecursiveFilterIterator
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
* Passes the RecursiveIterator interface to the inner Iterator and provides
|
||||
* the same functionality as FilterIterator. This allows you to skip parents
|
||||
* and all their childs before loading them all. You need to care about
|
||||
* function getChildren() because it may not always suit your needs. The
|
||||
* function getChildren() because it may not always suit your needs. The
|
||||
* builtin behavior uses reflection to return a new instance of the exact same
|
||||
* class it is called from. That is you extend RecursiveFilterIterator and
|
||||
* getChildren() will create instance of that class. The problem is that doing
|
||||
* this does not transport any state or control information of your accept()
|
||||
* implementation to the new instance. To overcome this problem you might
|
||||
* implementation to the new instance. To overcome this problem you might
|
||||
* need to overwrite getChildren(), call this implementation and pass the
|
||||
* control vaules manually.
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@ class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
|
|||
}
|
||||
return $this->ref->newInstance($this->current());
|
||||
}
|
||||
|
||||
|
||||
private $ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
|
|||
/** Construct from another iterator
|
||||
*
|
||||
* @param it Iterator to cache
|
||||
* @param flags Bitmask:
|
||||
* @param flags Bitmask:
|
||||
* - CALL_TOSTRING (whether to call __toString() for every element)
|
||||
* - CATCH_GET_CHILD (whether to catch exceptions when trying to get childs)
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
|
|||
}
|
||||
|
||||
/** Rewind Iterator
|
||||
*/
|
||||
*/
|
||||
function rewind();
|
||||
{
|
||||
$this->hasChildren = false;
|
||||
|
@ -74,13 +74,13 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
|
|||
}
|
||||
parent::next();
|
||||
}
|
||||
|
||||
|
||||
private $ref;
|
||||
|
||||
/** @return whether the current element has children
|
||||
* @note The check whether the Iterator for the children can be created was
|
||||
* already executed. Hence when flag CATCH_GET_CHILD was given in
|
||||
* constructor this function returns false so that getChildren does
|
||||
* constructor this function returns false so that getChildren does
|
||||
* not try to access those children.
|
||||
*/
|
||||
function hasChildren()
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
* Passes the RecursiveIterator interface to the inner Iterator and provides
|
||||
* the same functionality as FilterIterator. This allows you to skip parents
|
||||
* and all their childs before loading them all. You need to care about
|
||||
* function getChildren() because it may not always suit your needs. The
|
||||
* function getChildren() because it may not always suit your needs. The
|
||||
* builtin behavior uses reflection to return a new instance of the exact same
|
||||
* class it is called from. That is you extend RecursiveFilterIterator and
|
||||
* getChildren() will create instance of that class. The problem is that doing
|
||||
* this does not transport any state or control information of your accept()
|
||||
* implementation to the new instance. To overcome this problem you might
|
||||
* implementation to the new instance. To overcome this problem you might
|
||||
* need to overwrite getChildren(), call this implementation and pass the
|
||||
* control vaules manually.
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ abstract class RecursiveFilterIterator extends FilterIterator implements Recursi
|
|||
{
|
||||
parent::__construct($it);
|
||||
}
|
||||
|
||||
|
||||
/** @return whether the current element has children
|
||||
*/
|
||||
function hasChildren()
|
||||
|
@ -55,7 +55,7 @@ abstract class RecursiveFilterIterator extends FilterIterator implements Recursi
|
|||
}
|
||||
return $this->ref->newInstance($this->getInnerIterator()->getChildren());
|
||||
}
|
||||
|
||||
|
||||
private $ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ interface RecursiveIterator extends Iterator
|
|||
/** @return whether the current element has children
|
||||
*/
|
||||
function hasChildren();
|
||||
|
||||
|
||||
/** @return the sub iterator for the current element
|
||||
* @note The returned object must implement RecursiveIterator.
|
||||
*/
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* @version 1.2
|
||||
* @since PHP 5.0
|
||||
*
|
||||
* The objects of this class are created by instances of RecursiveIterator.
|
||||
* Elements of those iterators may be traversable themselves. If so these
|
||||
* The objects of this class are created by instances of RecursiveIterator.
|
||||
* Elements of those iterators may be traversable themselves. If so these
|
||||
* sub elements are recursed into.
|
||||
*/
|
||||
class RecursiveIteratorIterator implements OuterIterator
|
||||
|
@ -47,7 +47,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
* @param flags Control flags, zero or any combination of the following
|
||||
* (since PHP 5.1).
|
||||
* - CATCH_GET_CHILD which catches exceptions during
|
||||
* getChildren() calls and simply jumps to the next
|
||||
* getChildren() calls and simply jumps to the next
|
||||
* element.
|
||||
*/
|
||||
function __construct(RecursiveIterator $it, $mode = self::LEAVES_ONLY, $flags = 0)
|
||||
|
@ -69,7 +69,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
$this->ait[0]->recursed = false;
|
||||
callNextElement(true);
|
||||
}
|
||||
|
||||
|
||||
/** @return whether iterator is valid
|
||||
*/
|
||||
function valid()
|
||||
|
@ -85,7 +85,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** @return current key
|
||||
*/
|
||||
function key()
|
||||
|
@ -93,7 +93,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
$it = $this->ait[$this->count];
|
||||
return $it->key();
|
||||
}
|
||||
|
||||
|
||||
/** @return current element
|
||||
*/
|
||||
function current()
|
||||
|
@ -101,7 +101,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
$it = $this->ait[$this->count];
|
||||
return $it->current();
|
||||
}
|
||||
|
||||
|
||||
/** Forward to next element
|
||||
*/
|
||||
function next()
|
||||
|
@ -153,7 +153,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
callNextElement(true);
|
||||
}
|
||||
|
||||
/** @return Sub Iterator at given level or if unspecified the current sub
|
||||
/** @return Sub Iterator at given level or if unspecified the current sub
|
||||
* Iterator
|
||||
*/
|
||||
function getSubIterator($level = NULL)
|
||||
|
@ -166,7 +166,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
|
||||
/**
|
||||
* @return The inner iterator
|
||||
*/
|
||||
*/
|
||||
function getInnerIterator()
|
||||
{
|
||||
return $this->it;
|
||||
|
@ -201,7 +201,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
function beginChildren()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** Called after current child iterator is invalid and right before it
|
||||
* gets destructed.
|
||||
* @since PHP 5.1
|
||||
|
@ -226,7 +226,7 @@ class RecursiveIteratorIterator implements OuterIterator
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Called when the next element is available
|
||||
*/
|
||||
function nextElement()
|
||||
|
|
|
@ -15,20 +15,20 @@
|
|||
* @version 1.0
|
||||
* @since PHP 5.1
|
||||
*
|
||||
* This filter iterator assumes that the inner iterator
|
||||
* This filter iterator assumes that the inner iterator
|
||||
*/
|
||||
class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
|
||||
{
|
||||
/**
|
||||
* Constructs a regular expression filter around an iterator whose
|
||||
* Constructs a regular expression filter around an iterator whose
|
||||
* elemnts or keys are strings.
|
||||
*
|
||||
* @param it inner iterator
|
||||
* @param regex the regular expression to match
|
||||
* @param mode operation mode (one of self::MATCH, self::GET_MATCH,
|
||||
* @param mode operation mode (one of self::MATCH, self::GET_MATCH,
|
||||
* self::ALL_MATCHES, self::SPLIT)
|
||||
* @param flags special flags (self::USE_KEY)
|
||||
* @param preg_flags global PREG_* flags, see preg_match(),
|
||||
* @param preg_flags global PREG_* flags, see preg_match(),
|
||||
* preg_match_all(), preg_split()
|
||||
*/
|
||||
function __construct(RecursiveIterator $it, $regex, $mode = 0, $flags = 0, $preg_flags = 0) {
|
||||
|
@ -54,7 +54,7 @@ class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
|
|||
}
|
||||
return $this->ref->newInstance($this->getInnerIterator()->getChildren());
|
||||
}
|
||||
|
||||
|
||||
private $ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
* @version 1.0
|
||||
* @since PHP 5.1
|
||||
*
|
||||
* This filter iterator assumes that the inner iterator
|
||||
* This filter iterator assumes that the inner iterator
|
||||
*/
|
||||
class RegexIterator extends FilterIterator
|
||||
{
|
||||
const USE_KEY = 0x00000001; /**< If present in $flags the key is
|
||||
const USE_KEY = 0x00000001; /**< If present in $flags the key is
|
||||
used rather then the current value. */
|
||||
|
||||
const MATCH = 0; /**< Mode: Executed a plain match only */
|
||||
|
@ -27,26 +27,26 @@ class RegexIterator extends FilterIterator
|
|||
const ALL_MATCHES = 2; /**< Mode: Return all matches (if any) */
|
||||
const SPLIT = 3; /**< Mode: Return the split values (if any) */
|
||||
const REPLACE = 4; /**< Mode: Replace the input key or current */
|
||||
|
||||
|
||||
private $regex; /**< the regular expression to match against */
|
||||
private $mode; /**< operation mode (one of self::MATCH,
|
||||
private $mode; /**< operation mode (one of self::MATCH,
|
||||
self::GET_MATCH, self::ALL_MATCHES, self::SPLIT) */
|
||||
private $flags; /**< special flags (self::USE_KEY) */
|
||||
private $preg_flags;/**< PREG_* flags, see preg_match(), preg_match_all(),
|
||||
preg_split() */
|
||||
private $preg_flags;/**< PREG_* flags, see preg_match(), preg_match_all(),
|
||||
preg_split() */
|
||||
private $key; /**< the value used for key() */
|
||||
private $current; /**< the value used for current() */
|
||||
|
||||
/**
|
||||
* Constructs a regular expression filter around an iterator whose
|
||||
* Constructs a regular expression filter around an iterator whose
|
||||
* elemnts or keys are strings.
|
||||
*
|
||||
* @param it inner iterator
|
||||
* @param regex the regular expression to match
|
||||
* @param mode operation mode (one of self::MATCH, self::GET_MATCH,
|
||||
* @param mode operation mode (one of self::MATCH, self::GET_MATCH,
|
||||
* self::ALL_MATCHES, self::SPLIT)
|
||||
* @param flags special flags (self::USE_KEY)
|
||||
* @param preg_flags global PREG_* flags, see preg_match(),
|
||||
* @param preg_flags global PREG_* flags, see preg_match(),
|
||||
* preg_match_all(), preg_split()
|
||||
*/
|
||||
function __construct(Iterator $it, $regex, $mode = 0, $flags = 0, $preg_flags = 0) {
|
||||
|
|
|
@ -25,8 +25,8 @@ interface SeekableIterator extends Iterator
|
|||
* \param $index position to seek to
|
||||
* \return void
|
||||
*
|
||||
* The method should throw an exception if it is not possible to seek to
|
||||
* the given position. Typically this exception should be of type
|
||||
* The method should throw an exception if it is not possible to seek to
|
||||
* the given position. Typically this exception should be of type
|
||||
* OutOfBoundsException.
|
||||
\code
|
||||
function seek($index);
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* The SplDoublyLinkedList class provides the main functionalities of a
|
||||
* doubly linked list (DLL).
|
||||
* @note The following userland implementation of Iterator is a bit different
|
||||
* from the internal one. Internally, iterators generated by nested
|
||||
* foreachs are independent, while they share the same traverse pointer
|
||||
* from the internal one. Internally, iterators generated by nested
|
||||
* foreachs are independent, while they share the same traverse pointer
|
||||
* in userland.
|
||||
*/
|
||||
class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
|
||||
|
@ -113,7 +113,7 @@ class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
|
|||
return ($this->count() == 0);
|
||||
}
|
||||
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
* can be set:
|
||||
* - The direction of the iteration (either one or the other)
|
||||
* - SplDoublyLnkedList::IT_MODE_LIFO (Stack style)
|
||||
|
|
|
@ -28,15 +28,15 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
private $flags = 0;
|
||||
private $delimiter= ',';
|
||||
private $enclosure= '"';
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new file object
|
||||
*
|
||||
*
|
||||
* @param $file_name The name of the stream to open
|
||||
* @param $open_mode The file open mode
|
||||
* @param $use_include_path Whether to search in include paths
|
||||
* @param $context A stream context
|
||||
* @throw RuntimeException If file cannot be opened (e.g. insufficient
|
||||
* @throw RuntimeException If file cannot be opened (e.g. insufficient
|
||||
* access rights).
|
||||
*/
|
||||
function __construct($file_name, $open_mode = 'r', $use_include_path = false, $context = NULL)
|
||||
|
@ -48,7 +48,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
}
|
||||
$this->fname = $file_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return whether the end of the stream is reached
|
||||
*/
|
||||
|
@ -65,13 +65,13 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
$this->freeLine();
|
||||
$this->lnum++;
|
||||
$buf = fgets($this->fp, $this->max_len);
|
||||
|
||||
|
||||
return $buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param delimiter character used as field separator
|
||||
* @param enclosure end of
|
||||
* @param enclosure end of
|
||||
* @return array containing read data
|
||||
*/
|
||||
function fgetcsv($delimiter = NULL, $enclosure = NULL)
|
||||
|
@ -88,7 +88,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
case 2:
|
||||
break;
|
||||
}
|
||||
return fgetcsv($this->fp, $this->max_len, $delimiter, $enclosure);
|
||||
return fgetcsv($this->fp, $this->max_len, $delimiter, $enclosure);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
/**
|
||||
* @param pos new file position
|
||||
* @param whence seek method (SEEK_SET, SEEK_CUR, SEEK_END)
|
||||
* @return Upon success, returns 0; otherwise, returns -1. Note that
|
||||
* @return Upon success, returns 0; otherwise, returns -1. Note that
|
||||
* seeking past EOF is not considered an error.
|
||||
*/
|
||||
function fseek($pos, $whence = SEEK_SET)
|
||||
|
@ -179,7 +179,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
|
||||
/** Scan the next line
|
||||
* @param $format string specifying format to parse
|
||||
*/
|
||||
*/
|
||||
function fscanf($format /* , ... */)
|
||||
{
|
||||
$this->freeLine();
|
||||
|
@ -276,11 +276,11 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
{
|
||||
return !$this->eof();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @note Fill current line buffer if not done yet.
|
||||
* @return line buffer
|
||||
*/
|
||||
* @return line buffer
|
||||
*/
|
||||
function current()
|
||||
{
|
||||
if (is_null($this->line))
|
||||
|
@ -291,20 +291,20 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
}
|
||||
|
||||
/**
|
||||
* @return line number
|
||||
* @return line number
|
||||
* @note fgetc() will increase the line number when reaing a new line char.
|
||||
* This has the effect key() called on a read a new line will already
|
||||
* return the increased line number.
|
||||
* @note Line counting works as long as you only read the file and do not
|
||||
* use fseek().
|
||||
*/
|
||||
*/
|
||||
function key()
|
||||
{
|
||||
return $this->lnum;
|
||||
}
|
||||
|
||||
/** Invalidate current line buffer.
|
||||
*/
|
||||
*/
|
||||
function next()
|
||||
{
|
||||
$this->freeLine();
|
||||
|
@ -342,7 +342,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
* @note If you DO overload this function key() and current() will increment
|
||||
* $this->lnum automatically. If not then function reaLine() will do
|
||||
* that for you.
|
||||
*/
|
||||
*/
|
||||
function getCurrentLine()
|
||||
{
|
||||
$this->freeLine();
|
||||
|
@ -363,7 +363,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
|
|||
|
||||
/**
|
||||
* @param $line_pos Seek to this line
|
||||
*/
|
||||
*/
|
||||
function seek($line_pos)
|
||||
{
|
||||
$this->rewind();
|
||||
|
|
|
@ -31,21 +31,21 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
|
|||
{
|
||||
rewind($this->storage);
|
||||
}
|
||||
|
||||
|
||||
/** @return whether iterator is valid
|
||||
*/
|
||||
function valid()
|
||||
{
|
||||
return key($this->storage) !== false;
|
||||
}
|
||||
|
||||
|
||||
/** @return current key
|
||||
*/
|
||||
function key()
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
|
||||
/** @return current object
|
||||
*/
|
||||
function current()
|
||||
|
@ -53,7 +53,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
|
|||
$element = current($this->storage);
|
||||
return $element ? $element[0] : NULL
|
||||
}
|
||||
|
||||
|
||||
/** @return get current object's associated information
|
||||
* @since 5.3.0
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
|
|||
$element = current($this->storage);
|
||||
return $element ? $element[1] : NULL
|
||||
}
|
||||
|
||||
|
||||
/** @return set current object's associated information
|
||||
* @since 5.3.0
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
|
|||
$this->storage[$this->index][1] = $inf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Forward to next element
|
||||
*/
|
||||
function next()
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
/** @ingroup SPL
|
||||
* @brief Implementation of a Queue through a DoublyLinkedList. As SplQueue
|
||||
* extends SplDoublyLinkedList, unshift() and pop() are still available
|
||||
* extends SplDoublyLinkedList, unshift() and pop() are still available
|
||||
* even though they don't make much sense for a queue. For convenience,
|
||||
* two aliases are available:
|
||||
* - enqueue() is an alias of push()
|
||||
|
@ -26,7 +26,7 @@ class SplQueue extends SplDoublyLinkedList
|
|||
{
|
||||
protected $_it_mode = parent::IT_MODE_FIFO;
|
||||
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
* can be set:
|
||||
*
|
||||
* - The behavior of the iterator (either one or the other)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
/** @ingroup SPL
|
||||
* @brief Implementation of a stack through a DoublyLinkedList. As SplStack
|
||||
* @brief Implementation of a stack through a DoublyLinkedList. As SplStack
|
||||
* extends SplDoublyLinkedList, shift() and unshift() are still available even
|
||||
* though they don't make much sense for a stack.
|
||||
* @since PHP 5.3
|
||||
|
@ -22,7 +22,7 @@ class SplStack extends SplDoublyLinkedList
|
|||
{
|
||||
protected $_it_mode = parent::IT_MODE_LIFO;
|
||||
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
/** Changes the iteration mode. There are two orthogonal sets of modes that
|
||||
* can be set:
|
||||
*
|
||||
* - The behavior of the iterator (either one or the other)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
$tmp = pow(2,24);
|
||||
$data = array(
|
||||
$data = array(
|
||||
'PHP',
|
||||
17=>'PHP: Hypertext Preprocessor',
|
||||
5=>'Test',
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
class autoTest {
|
||||
public static $bob = "bob";
|
||||
|
||||
|
||||
public function __get($name) {
|
||||
echo "attempt to access $name\n";
|
||||
return "foo";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,29 +1,29 @@
|
|||
<?php
|
||||
/* Header file for common file test functions
|
||||
/* Header file for common file test functions
|
||||
Following functions are provided :
|
||||
create_files() : create files with specified contents
|
||||
create_files() : create files with specified contents
|
||||
delete_files() : delete files
|
||||
create_links() : crate links of different types
|
||||
delete_links() : delete links
|
||||
fill_files() : fill file with specified contents
|
||||
change_file_perms() : Change permission of files
|
||||
delete_links() : delete links
|
||||
fill_files() : fill file with specified contents
|
||||
change_file_perms() : Change permission of files
|
||||
fill_buffer() : fills buffer with specified contents
|
||||
compare_self_stat() : compares the first 13 elements of the
|
||||
compare_self_stat() : compares the first 13 elements of the
|
||||
stat with the corresponding named key values of
|
||||
the same stat.
|
||||
compare_stats() : Compares two stat values
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
define('file_not_found', 2, 1);
|
||||
|
||||
/*
|
||||
/*
|
||||
Function: bool create_file(string $filename, string $mode = "w");
|
||||
Description: creates a new file using fopen() call
|
||||
$filename = Name of the file
|
||||
Description: creates a new file using fopen() call
|
||||
$filename = Name of the file
|
||||
$mode = Mode as specified in fopen call, read documentation of fopen() call for more info
|
||||
|
||||
Returns:
|
||||
Returns:
|
||||
true on success, false otherwise
|
||||
*/
|
||||
function create_file($filename, $mode = "w") {
|
||||
|
@ -83,23 +83,23 @@ function fill_buffer(&$buffer, $fill_type, $fill_size) {
|
|||
Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size);
|
||||
Description: Fills the file with data as specified with requested size.
|
||||
$file_handle = file handle, opened with write options,
|
||||
$fill_type:
|
||||
$fill_type:
|
||||
"text" = fills with string of size $file_size
|
||||
"numeric" = fills with numeric value of size $file_size
|
||||
"empty" = no fill operation performed, returns true
|
||||
"text_with_new_line" = similar to "text" fill type but writes with new line
|
||||
"alphanumeric" = fills with alphnumeric values
|
||||
"alphanumeric" = fills with alphnumeric values
|
||||
Returns: true on success, false on failure & invalid fill type
|
||||
*/
|
||||
|
||||
function fill_file($file_handle, $fill_type, $file_size) {
|
||||
|
||||
|
||||
if ( $fill_type == "empty" ) {
|
||||
// no fill required, return true
|
||||
return true;
|
||||
} if ( $fill_type == "text" ) {
|
||||
$data = "text ";
|
||||
$size_divider = strlen($data);
|
||||
$size_divider = strlen($data);
|
||||
$add_value = strlen($data);
|
||||
} else if ( $fill_type == "text_with_new_line" ) {
|
||||
$data = "line\nline of text\n";
|
||||
|
@ -113,7 +113,7 @@ function fill_file($file_handle, $fill_type, $file_size) {
|
|||
$data = 2;
|
||||
$size_divider = 1;
|
||||
$add_value = 0;
|
||||
} else {
|
||||
} else {
|
||||
// invalid fill type;
|
||||
return false;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ function fill_file($file_handle, $fill_type, $file_size) {
|
|||
if ( $size > $chunk_size ) {
|
||||
$loop_count = 1;
|
||||
do {
|
||||
$loop_count ++;
|
||||
$loop_count ++;
|
||||
if ( $size <= $chunk_size ) {
|
||||
$chunk_size = $size;
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ function fill_file($file_handle, $fill_type, $file_size) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// successful, return true
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755,
|
||||
string $name_prefix = "file",
|
||||
Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755,
|
||||
string $name_prefix = "file",
|
||||
string $name_suffix = 1, $file_extension = ".tmp");
|
||||
Description: changes file permission for given file(s).
|
||||
$file_path = dir path where file exists
|
||||
|
@ -157,21 +157,21 @@ function fill_file($file_handle, $fill_type, $file_size) {
|
|||
$perms = new permission of the file, similar to $mode args of chmod() call
|
||||
$name_prefix = common name prefix, default is "file"
|
||||
$name_suffix = suffix to end the common name given in name_prefix to create
|
||||
a unique name. default is 1.
|
||||
a unique name. default is 1.
|
||||
$file_extension = default is .tmp
|
||||
Returns:
|
||||
Integer, Count of total files permission changed.
|
||||
*/
|
||||
function change_file_perms($file_path,
|
||||
$count = 1,
|
||||
$perms = 0755,
|
||||
$name_prefix = "file",
|
||||
$name_suffix = 1,
|
||||
$file_extension = ".tmp" )
|
||||
$count = 1,
|
||||
$perms = 0755,
|
||||
$name_prefix = "file",
|
||||
$name_suffix = 1,
|
||||
$file_extension = ".tmp" )
|
||||
{
|
||||
$changed = 0;
|
||||
|
||||
if( $count <= 0 )
|
||||
if( $count <= 0 )
|
||||
return $changed;
|
||||
|
||||
if ( $name_suffix <= 0)
|
||||
|
@ -182,34 +182,34 @@ function change_file_perms($file_path,
|
|||
if( chmod($filename, $perms) )
|
||||
$changed++;
|
||||
$name_suffix++;
|
||||
}
|
||||
}
|
||||
return $changed;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Function: array create_files( string $file_path,
|
||||
int $count = 1,
|
||||
string $content_type = "numeric",
|
||||
int $permission = 0755,
|
||||
string $content_type = "numeric",
|
||||
int $permission = 0755,
|
||||
int $size = 1,
|
||||
string $mode = "w",
|
||||
string $name_prefix = "file",
|
||||
string $mode = "w",
|
||||
string $name_prefix = "file",
|
||||
int $name_suffix = 1,
|
||||
string $flag = "kilobytes"
|
||||
string $file_extension = ".tmp"
|
||||
);
|
||||
Description: Creates given number of files with specified mode and
|
||||
Description: Creates given number of files with specified mode and
|
||||
permissions. File is filled with content of size specified.
|
||||
$file_path = dir where files will be created
|
||||
$name_prefix = prefix to be used for names, name is suffix with a
|
||||
$name_prefix = prefix to be used for names, name is suffix with a
|
||||
unqiue numeric value to make the file name unique, default = file
|
||||
$name_suffix = suffix to be used for the name, default = 1
|
||||
$count = total no. of files to be created, default = 1
|
||||
$mode = file open mode as specified in fopen() call. Do not use
|
||||
$mode = file open mode as specified in fopen() call. Do not use
|
||||
modes used for only reading the file. Default = "w"
|
||||
$permission = An octal number, This should be similar to $mode
|
||||
specified in chmod() call.
|
||||
$content_type = Specify type of the content to fill in the file.
|
||||
$permission = An octal number, This should be similar to $mode
|
||||
specified in chmod() call.
|
||||
$content_type = Specify type of the content to fill in the file.
|
||||
"numeric" = fill file with numeric values
|
||||
"text" = fill file with regular text
|
||||
"empty" = empty file
|
||||
|
@ -218,16 +218,16 @@ function change_file_perms($file_path,
|
|||
If imporper $content type is specified, file is created as empty
|
||||
$size = size of the fill in terms of kilobyte, i.e size of the file.
|
||||
if $flag is specified as "byte", then then given size is taken in bytes
|
||||
$flag = specifiy if size has to be treated as no of total bytes or
|
||||
$flag = specifiy if size has to be treated as no of total bytes or
|
||||
multiple of KB.
|
||||
"kilobytes" = take size in terms of multiple of KB
|
||||
"byte" = take size in terms of bytes
|
||||
"byte" = take size in terms of bytes
|
||||
$file_extension = default is .tmp
|
||||
|
||||
Returns:
|
||||
An array with following key value pair:
|
||||
created => total file created
|
||||
filled => total files filled
|
||||
filled => total files filled
|
||||
perms_changed => total files permission changed
|
||||
*/
|
||||
function create_files( $file_path,
|
||||
|
@ -253,7 +253,7 @@ function create_files( $file_path,
|
|||
if ( $size == 0 )
|
||||
return $return_value;
|
||||
|
||||
// prepare the size based on flag
|
||||
// prepare the size based on flag
|
||||
$file_size = $size;
|
||||
if ( $flag == "kilobytes" ) {
|
||||
$file_size = $file_size * 1024;
|
||||
|
@ -288,11 +288,11 @@ function create_files( $file_path,
|
|||
fclose($file_handle);
|
||||
return $return_value;
|
||||
} // end of if
|
||||
|
||||
// call fill_file() to fill the file
|
||||
|
||||
// call fill_file() to fill the file
|
||||
if( fill_file($file_handle, $content_type, $file_size) )
|
||||
$return_value['filled']++;
|
||||
|
||||
|
||||
fclose($file_handle);
|
||||
|
||||
$tmp_name_suffix++;
|
||||
|
@ -300,9 +300,9 @@ function create_files( $file_path,
|
|||
}
|
||||
|
||||
// change all file's permissions
|
||||
$return_value['perms_changed'] = change_file_perms($file_path, $count, $permission, $name_prefix,
|
||||
$return_value['perms_changed'] = change_file_perms($file_path, $count, $permission, $name_prefix,
|
||||
$name_suffix, $file_extension);
|
||||
|
||||
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
|
@ -336,8 +336,8 @@ function create_files( $file_path,
|
|||
alphanumeric = fill with alphanumeric text
|
||||
If imporper $content type is specified, file is created as empty
|
||||
$size = size of the fill in terms of kilobyte, i.e size of the file.
|
||||
$link_type = type of the link to be created
|
||||
"soft" = soft link
|
||||
$link_type = type of the link to be created
|
||||
"soft" = soft link
|
||||
"hard" = hard link
|
||||
$filename = file used to create a link on
|
||||
|
||||
|
@ -392,12 +392,12 @@ function create_links($file_path,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( $link_file_content == "empty" ) {
|
||||
$return_value['filled'] = 1;
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
|
||||
// fill the file with specific type of data and size
|
||||
$tmp_name_suffix = $link_name_suffix;
|
||||
$linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
|
||||
|
@ -405,8 +405,8 @@ function create_links($file_path,
|
|||
if($file_handle == false) {
|
||||
return $return_value;
|
||||
} // end of if
|
||||
|
||||
// call fill_file() to fill the file
|
||||
|
||||
// call fill_file() to fill the file
|
||||
if( fill_file($file_handle, $link_file_content, $link_size) )
|
||||
$return_value['filled']++;
|
||||
|
||||
|
@ -415,11 +415,11 @@ function create_links($file_path,
|
|||
|
||||
// change the permission of the link file, only if hard link.
|
||||
// this is not applicable to soft links
|
||||
if( $link_type == "hard" ) {
|
||||
$return_value['perms_changed'] = change_file_perms($file_path,
|
||||
$link_count,
|
||||
$link_perms,
|
||||
$link_name_prefix,
|
||||
if( $link_type == "hard" ) {
|
||||
$return_value['perms_changed'] = change_file_perms($file_path,
|
||||
$link_count,
|
||||
$link_perms,
|
||||
$link_name_prefix,
|
||||
$link_name_suffix,
|
||||
$link_file_extension );
|
||||
}
|
||||
|
@ -427,10 +427,10 @@ function create_links($file_path,
|
|||
return $return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Function: bool delete_file(string $filename);
|
||||
Description: delete a given file if exists
|
||||
Returns: true on success
|
||||
Description: delete a given file if exists
|
||||
Returns: true on success
|
||||
false on failure
|
||||
file_not_found if file doesn't exist
|
||||
*/
|
||||
|
@ -446,7 +446,7 @@ function delete_file($filename) {
|
|||
}
|
||||
|
||||
/*
|
||||
Function: array delete_files(string $file_path, int $count = 1, string $name_prefix = "file",
|
||||
Function: array delete_files(string $file_path, int $count = 1, string $name_prefix = "file",
|
||||
int name_suffix = 1, $file_extension = ".tmp" );
|
||||
Description: Deletes given number of files if exists.
|
||||
$file_path = location of the files
|
||||
|
@ -460,15 +460,15 @@ function delete_file($filename) {
|
|||
failed = Count of failed to delete
|
||||
*/
|
||||
function delete_files($file_path,
|
||||
$count = 1,
|
||||
$name_prefix = "file",
|
||||
$name_suffix = 1,
|
||||
$file_extension = ".tmp")
|
||||
$count = 1,
|
||||
$name_prefix = "file",
|
||||
$name_suffix = 1,
|
||||
$file_extension = ".tmp")
|
||||
{
|
||||
$return_value = array ('deleted' => 0, 'notfound' => 0, 'failed' => 0);
|
||||
|
||||
if ( $name_suffix < 1 )
|
||||
$name_suffix = 1;
|
||||
$name_suffix = 1;
|
||||
for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
|
||||
$filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
|
||||
$name_suffix++;
|
||||
|
@ -480,20 +480,20 @@ function delete_files($file_path,
|
|||
} else {
|
||||
$return_value['failed']++;
|
||||
}
|
||||
|
||||
|
||||
} // end of for
|
||||
return $return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: array delete_links( $file_path,
|
||||
$link_file_count,
|
||||
$link_name_prefix,
|
||||
$link_name_suffix,
|
||||
Function: array delete_links( $file_path,
|
||||
$link_file_count,
|
||||
$link_name_prefix,
|
||||
$link_name_suffix,
|
||||
$link_file_extension );
|
||||
Description: Deletes given number of links if exists. Uses delete_files() function
|
||||
$file_path = location of link files
|
||||
$link_file_count = Number of link files
|
||||
$file_path = location of link files
|
||||
$link_file_count = Number of link files
|
||||
$link_name_prefix = prefix for the linkname, rest of the name is incremental(increment by 1 only)
|
||||
numeric starting from $link_name_suffix up to count
|
||||
$link_name_suffix = first numeric suffix in the name
|
||||
|
@ -504,16 +504,16 @@ function delete_files($file_path,
|
|||
failed = Count of failed to delete
|
||||
*/
|
||||
function delete_links($file_path,
|
||||
$link_file_count = 1,
|
||||
$link_name_prefix = "link",
|
||||
$link_name_suffix = 1,
|
||||
$link_file_extension = ".tmp")
|
||||
$link_file_count = 1,
|
||||
$link_name_prefix = "link",
|
||||
$link_name_suffix = 1,
|
||||
$link_file_extension = ".tmp")
|
||||
{
|
||||
// call the delete files to delete links
|
||||
$return_value = delete_files( $file_path,
|
||||
$link_file_count,
|
||||
$link_name_prefix,
|
||||
$link_name_suffix,
|
||||
// call the delete files to delete links
|
||||
$return_value = delete_files( $file_path,
|
||||
$link_file_count,
|
||||
$link_name_prefix,
|
||||
$link_name_suffix,
|
||||
$link_file_extension );
|
||||
return $return_value;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ function delete_links($file_path,
|
|||
Prototype:
|
||||
function compare_self_stat( array $stat );
|
||||
Description:
|
||||
Compares the each of the first 13 values of the stat array with the
|
||||
Compares the each of the first 13 values of the stat array with the
|
||||
corresponding next 13 values of the same stat for equality
|
||||
$stat = stat array
|
||||
|
||||
|
@ -536,7 +536,7 @@ function compare_self_stat( array $stat )
|
|||
$return_value = true;
|
||||
|
||||
// named keys present in a stat
|
||||
$string_keys = array("dev", "ino", "mode", "nlink", "uid", "gid",
|
||||
$string_keys = array("dev", "ino", "mode", "nlink", "uid", "gid",
|
||||
"rdev", "size", "atime", "mtime", "ctime",
|
||||
"blksize", "blocks");
|
||||
|
||||
|
@ -557,7 +557,7 @@ function compare_self_stat( array $stat )
|
|||
}
|
||||
} // end of foreach
|
||||
|
||||
// if the $return_value is false, i.e all the element do not match then
|
||||
// if the $return_value is false, i.e all the element do not match then
|
||||
// dump the stat array so that its easy to figure out the error
|
||||
if ($return_value == false ) {
|
||||
echo "\n Dumping stat array ...\n";
|
||||
|
@ -569,7 +569,7 @@ function compare_self_stat( array $stat )
|
|||
|
||||
/*
|
||||
Prototype:
|
||||
function compare_stats( array $stat1, array $stat2, array $fields,
|
||||
function compare_stats( array $stat1, array $stat2, array $fields,
|
||||
[string $op = "==", [ bool $flag = false] ]);
|
||||
Description:
|
||||
Compares two stat values, stat value should be obtained by stat/lstat
|
||||
|
@ -580,12 +580,12 @@ Description:
|
|||
"==" compare for equality
|
||||
">" if each element of stat1 is > than stat2
|
||||
"<" if each element of stat1 is < than stat2
|
||||
$fields = contains the key of the elements that needs to be compared.
|
||||
$fields = contains the key of the elements that needs to be compared.
|
||||
type of the comparison is based on $op argument value
|
||||
$flag = specify true to dump the stat1 and stat2
|
||||
$flag = specify true to dump the stat1 and stat2
|
||||
*/
|
||||
|
||||
$all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
$all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
"dev", "ino", "mode", "nlink", "uid", "gid",
|
||||
"rdev", "size", "atime", "mtime", "ctime",
|
||||
"blksize", "blocks");
|
||||
|
@ -599,8 +599,8 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
|
|||
|
||||
$result = true;
|
||||
|
||||
// compare values of given key from each stat array
|
||||
for($index = 0; $index < count($fields); $index++)
|
||||
// compare values of given key from each stat array
|
||||
for($index = 0; $index < count($fields); $index++)
|
||||
{
|
||||
switch( $op )
|
||||
{
|
||||
|
@ -635,7 +635,7 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// if the result is false(i.e values are not as expected),
|
||||
// if the result is false(i.e values are not as expected),
|
||||
// dump the stat array so that easy to figure out the error
|
||||
if ( $result == false ) {
|
||||
echo "\n Dumping stat array 1...\n";
|
||||
|
|
|
@ -9,7 +9,7 @@ function get_junction(){
|
|||
// junction.exe isn't included with Windows
|
||||
// its a sysinternals tool for working with filesystem links
|
||||
// see: http://technet.microsoft.com/en-us/sysinternals/bb896768
|
||||
|
||||
|
||||
// install somewhere that is on %path% or added to %path%
|
||||
return "junction.exe";
|
||||
}
|
||||
|
|
|
@ -109,21 +109,21 @@ function remove_data($id, $dir = NULL)
|
|||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir")
|
||||
remove_data($id, $dir . DIRECTORY_SEPARATOR . $object);
|
||||
else
|
||||
if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir")
|
||||
remove_data($id, $dir . DIRECTORY_SEPARATOR . $object);
|
||||
else
|
||||
unlink($dir . DIRECTORY_SEPARATOR . $object);
|
||||
}
|
||||
}
|
||||
reset($objects);
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function create_data($id, $item = "", $cp = 65001, $utf8 = true)
|
||||
{
|
||||
if ($utf8) {
|
||||
/* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */
|
||||
/* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */
|
||||
include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc";
|
||||
return create_data_from_utf8($id, $item, $cp);
|
||||
} else {
|
||||
|
|
|
@ -3,46 +3,46 @@
|
|||
$server = '{localhost}';
|
||||
$default_mailbox = $server . "INBOX";
|
||||
$domain = "example.com";
|
||||
$admin_user = "webmaster"; // a user with admin access
|
||||
$admin_user = "webmaster"; // a user with admin access
|
||||
$username = "$admin_user@$domain";
|
||||
$password = 'p4ssw0rd';
|
||||
$users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids
|
||||
$mailbox_prefix = "phpttest"; // name used for test mailbox
|
||||
|
||||
/**
|
||||
* Create a test mailbox and populate with msgs
|
||||
* Create a test mailbox and populate with msgs
|
||||
*
|
||||
* @para, string mailbox_suffix Suffix used to uniquely identify mailboxes
|
||||
* @param int message_count number of test msgs to be written to new mailbox
|
||||
*
|
||||
* @param int message_count number of test msgs to be written to new mailbox
|
||||
*
|
||||
* @return IMAP stream to new mailbox on success; FALSE on failure
|
||||
*/
|
||||
function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
|
||||
global $server, $default_mailbox, $username, $password;
|
||||
|
||||
|
||||
// open a stream to default mailbox
|
||||
$imap_stream = imap_open($default_mailbox, $username, $password);
|
||||
|
||||
if ($imap_stream === false) {
|
||||
echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
|
||||
$new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
|
||||
if ($new_mailbox === false) {
|
||||
echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
echo ".. mailbox '$new_mailbox' created\n";
|
||||
|
||||
|
||||
// reopen stream to new mailbox
|
||||
if (imap_reopen($imap_stream, $new_mailbox) === false) {
|
||||
echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $imap_stream;
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul
|
|||
function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
|
||||
global $default_mailbox, $mailbox_prefix;
|
||||
$mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
|
||||
|
||||
|
||||
$mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
|
||||
|
||||
|
||||
// check mailbox does not already exist
|
||||
if ($mailboxes) {
|
||||
foreach($mailboxes as $value) {
|
||||
|
@ -65,17 +65,17 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type
|
|||
exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imap_createmailbox($imap_stream, $mailbox) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Add number of test msgs requested
|
||||
if ($message_count > 0) {
|
||||
populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $mailbox;
|
||||
}
|
||||
|
||||
|
@ -100,42 +100,42 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
|
|||
$envelope["from"]= "foo@anywhere.com";
|
||||
$envelope["to"] = "$users[0]@$domain";
|
||||
$envelope["subject"] = "Test msg $i";
|
||||
|
||||
|
||||
$part1["type"] = TYPEMULTIPART;
|
||||
$part1["subtype"] = "mixed";
|
||||
|
||||
|
||||
$part2["type"] = TYPETEXT;
|
||||
$part2["subtype"] = "plain";
|
||||
$part2["description"] = "imap_mail_compose() function";
|
||||
$part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
|
||||
|
||||
$part3["type"] = TYPETEXT;
|
||||
$part3["subtype"] = "plain";
|
||||
$part3["description"] = "Example";
|
||||
$part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
|
||||
|
||||
|
||||
$part4["type"] = TYPETEXT;
|
||||
$part4["subtype"] = "plain";
|
||||
$part4["description"] = "Return Values";
|
||||
$part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
|
||||
|
||||
|
||||
$body[1] = $part1;
|
||||
$body[2] = $part2;
|
||||
$body[3] = $part3;
|
||||
$body[4] = $part4;
|
||||
|
||||
|
||||
$msg = imap_mail_compose($envelope, $body);
|
||||
}
|
||||
|
||||
|
||||
imap_append($imap_stream, $mailbox, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mailbox name from a mailbox decription, i.e strip off server details.
|
||||
* Get the mailbox name from a mailbox decription, i.e strip off server details.
|
||||
*
|
||||
* @param string mailbox complete mailbox name
|
||||
* @return mailbox name
|
||||
* @param string mailbox complete mailbox name
|
||||
* @return mailbox name
|
||||
*/
|
||||
function get_mailbox_name($mailbox){
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
|
|||
// imap uses tcp port 143
|
||||
socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
|
||||
}
|
||||
|
||||
|
||||
// Change these to make tests run successfully
|
||||
$mailbox = '{localhost}';
|
||||
$username = 'webmaster@example.com';
|
||||
|
|
|
@ -38,7 +38,7 @@ function get_cgi_path() /* {{{ */
|
|||
}
|
||||
}
|
||||
|
||||
if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) {
|
||||
if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) {
|
||||
/* gotcha */
|
||||
return $php_path."/cgi/php-cgi";
|
||||
}
|
||||
|
|
|
@ -437,12 +437,12 @@ class Client
|
|||
|
||||
/**
|
||||
* Execute a request to the FastCGI application asyncronously
|
||||
*
|
||||
*
|
||||
* This sends request to application and returns the assigned ID for that request.
|
||||
*
|
||||
* You should keep this id for later use with wait_for_response(). Ids are chosen randomly
|
||||
* rather than seqentially to guard against false-positives when using persistent sockets.
|
||||
* In that case it is possible that a delayed response to a request made by a previous script
|
||||
* In that case it is possible that a delayed response to a request made by a previous script
|
||||
* invocation comes back on this socket and is mistaken for response to request made with same ID
|
||||
* during this request.
|
||||
*
|
||||
|
@ -502,7 +502,7 @@ class Client
|
|||
|
||||
/**
|
||||
* Blocking call that waits for response to specific request
|
||||
*
|
||||
*
|
||||
* @param Integer $requestId
|
||||
* @param Integer $timeoutMs [optional] the number of milliseconds to wait. Defaults to the ReadWriteTimeout value set.
|
||||
* @return string response body
|
||||
|
@ -542,7 +542,7 @@ class Client
|
|||
}
|
||||
if ($resp['type'] == self::END_REQUEST) {
|
||||
$this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_OK;
|
||||
if ($resp['requestId'] == $requestId) {
|
||||
if ($resp['requestId'] == $requestId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ function run_fpm($config, &$out = false, $extra_args = '') /* {{{ */
|
|||
function test_fpm_conf($config, &$msg = NULL) { /* {{{ */
|
||||
$cfg = dirname(__FILE__).'/test-fpm-config.tmp';
|
||||
file_put_contents($cfg, $config);
|
||||
exec(get_fpm_path() . ' -t -y ' . $cfg . ' 2>&1', $output, $code);
|
||||
exec(get_fpm_path() . ' -t -y ' . $cfg . ' 2>&1', $output, $code);
|
||||
if ($code) {
|
||||
$msg = preg_replace("/\[.+?\]/", "", $output[0]);
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
class A {
|
||||
const MY_CONST = "hello from A";
|
||||
const MY_CONST = "hello from A";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
interface I {
|
||||
function f($a = null);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
<?php
|
||||
echo "Hello";
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
function MyFunc ($a) {
|
||||
echo $a;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
?>
|
||||
|
||||
*** Testing assignments and variable aliasing: ***<br>
|
||||
<?php
|
||||
<?php
|
||||
/* This test tests assignments to variables using other variables as variable-names */
|
||||
$a = "b";
|
||||
$$a = "test";
|
||||
$$$a = "blah";
|
||||
$a = "b";
|
||||
$$a = "test";
|
||||
$$$a = "blah";
|
||||
${$$$a}["associative arrays work too"] = "this is nifty";
|
||||
?>
|
||||
This should read "blah": <?php echo "$test<br>\n"; ?>
|
||||
|
@ -22,7 +22,7 @@ This should read "this is nifty": <?php echo $blah[$test="associative arrays wor
|
|||
*************************************************<br>
|
||||
|
||||
*** Testing integer operators ***<br>
|
||||
<?php
|
||||
<?php
|
||||
/* test just about any operator possible on $i and $j (ints) */
|
||||
$i = 5;
|
||||
$j = 3;
|
||||
|
@ -38,7 +38,7 @@ Correct result - 3: <?php echo $j%$i; ?><br>
|
|||
*********************************<br>
|
||||
|
||||
*** Testing real operators ***<br>
|
||||
<?php
|
||||
<?php
|
||||
/* test just about any operator possible on $i and $j (floats) */
|
||||
$i = 5.0;
|
||||
$j = 3.0;
|
||||
|
@ -55,7 +55,7 @@ Correct result - 3: <?php echo $j%$i; ?><br>
|
|||
|
||||
*** Testing if/elseif/else control ***<br>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
/* sick if/elseif/else test by Andi :) */
|
||||
$a = 5;
|
||||
if ($a == "4") {
|
||||
|
@ -90,7 +90,7 @@ if ($a == "4") {
|
|||
|
||||
*** Seriously nested if's test ***<br>
|
||||
** spelling correction by kluzz **
|
||||
<?php
|
||||
<?php
|
||||
/* yet another sick if/elseif/else test by Zeev */
|
||||
$i=$j=0;
|
||||
echo "Only two lines of text should follow:<br>\n";
|
||||
|
@ -98,7 +98,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
echo "hmm, this shouldn't be displayed #1<br>\n";
|
||||
$j++;
|
||||
if (1) {
|
||||
$i
|
||||
$i
|
||||
+=
|
||||
$j;
|
||||
if (0) {
|
||||
|
@ -128,7 +128,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
|
||||
$i = ++$j;
|
||||
echo "hmm, this shouldn't be displayed #2<br>\n";
|
||||
if (1) {
|
||||
if (1) {
|
||||
$j = ++$i;
|
||||
if (0) {
|
||||
$j = $i*2+$j*($i++);
|
||||
|
@ -182,7 +182,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
?>
|
||||
|
||||
*** C-style else-if's ***<br>
|
||||
<?php
|
||||
<?php
|
||||
/* looks like without we even tried, C-style else-if structure works fine! */
|
||||
if ($a=0) {
|
||||
echo "This shouldn't be displayed<br>\n";
|
||||
|
@ -199,7 +199,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
*************************<br>
|
||||
|
||||
*** WHILE tests ***<br>
|
||||
<?php
|
||||
<?php
|
||||
$i=0;
|
||||
$j=20;
|
||||
while ($i<(2*$j)) {
|
||||
|
@ -217,7 +217,7 @@ while ($i<(2*$j)) {
|
|||
|
||||
|
||||
*** Nested WHILEs ***<br>
|
||||
<?php
|
||||
<?php
|
||||
$arr_len=3;
|
||||
|
||||
$i=0;
|
||||
|
@ -253,7 +253,7 @@ while ($i<$arr_len) {
|
|||
*********************<br>
|
||||
|
||||
*** hash test... ***<br>
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
$i=0;
|
||||
|
||||
|
@ -273,7 +273,7 @@ echo "commented out...";
|
|||
**************************<br>
|
||||
|
||||
*** Hash resizing test ***<br>
|
||||
<?php
|
||||
<?php
|
||||
$i = 10;
|
||||
$a = 'b';
|
||||
while ($i > 0) {
|
||||
|
@ -295,7 +295,7 @@ while ($i > 0) {
|
|||
|
||||
|
||||
*** break/continue test ***<br>
|
||||
<?php
|
||||
<?php
|
||||
$i=0;
|
||||
|
||||
echo "\$i should go from 0 to 2<br>\n";
|
||||
|
@ -349,7 +349,7 @@ while ($i<5) {
|
|||
<?php include("023-2.inc"); ?>
|
||||
********************************<br>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
{
|
||||
echo "Tests completed.<br>\n"; # testing some PHP style comment...
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
<?php echo "and this is PHP code, 2+2=".(2+2).""; ?>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ date.timezone=UTC
|
|||
--FILE--
|
||||
PHP Regression Test
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
include("023-1.inc");
|
||||
|
||||
|
@ -246,7 +246,7 @@ $i=2<br>
|
|||
|
||||
*** Nested file include test ***<br>
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--TEST--
|
||||
Looped regression test (may take a while)
|
||||
--FILE--
|
||||
<?php
|
||||
<?php
|
||||
for ($jdk=0; $jdk<50; $jdk++) {
|
||||
?><html>
|
||||
<head>
|
||||
|
@ -11,11 +11,11 @@ for ($jdk=0; $jdk<50; $jdk++) {
|
|||
*/
|
||||
?>
|
||||
*** Testing assignments and variable aliasing: ***
|
||||
<?php
|
||||
<?php
|
||||
/* This test tests assignments to variables using other variables as variable-names */
|
||||
$a = "b";
|
||||
$$a = "test";
|
||||
$$$a = "blah";
|
||||
$a = "b";
|
||||
$$a = "test";
|
||||
$$$a = "blah";
|
||||
${$$$a}["associative arrays work too"] = "this is nifty";
|
||||
?>
|
||||
This should read "blah": <?php echo "$test\n"; ?>
|
||||
|
@ -23,7 +23,7 @@ This should read "this is nifty": <?php echo $blah[$test="associative arrays wor
|
|||
*************************************************
|
||||
|
||||
*** Testing integer operators ***
|
||||
<?php
|
||||
<?php
|
||||
/* test just about any operator possible on $i and $j (ints) */
|
||||
$i = 5;
|
||||
$j = 3;
|
||||
|
@ -47,7 +47,7 @@ Correct result - 3: <?php echo $j%$i; ?>
|
|||
*********************************
|
||||
|
||||
*** Testing real operators ***
|
||||
<?php
|
||||
<?php
|
||||
/* test just about any operator possible on $i and $j (floats) */
|
||||
$i = 5.0;
|
||||
$j = 3.0;
|
||||
|
@ -72,7 +72,7 @@ Correct result - 3: <?php echo $j%$i; ?>
|
|||
|
||||
*** Testing if/elseif/else control ***
|
||||
|
||||
<?php
|
||||
<?php
|
||||
/* sick if/elseif/else test by Andi :) */
|
||||
$a = 5;
|
||||
if ($a == "4") {
|
||||
|
@ -107,7 +107,7 @@ if ($a == "4") {
|
|||
|
||||
*** Seriously nested if's test ***
|
||||
** spelling correction by kluzz **
|
||||
<?php
|
||||
<?php
|
||||
/* yet another sick if/elseif/else test by Zeev */
|
||||
$i=$j=0;
|
||||
echo "Only two lines of text should follow:\n";
|
||||
|
@ -143,7 +143,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
|
||||
$i = ++$j;
|
||||
echo "hmm, this shouldn't be displayed #2\n";
|
||||
if (1) {
|
||||
if (1) {
|
||||
$j = ++$i;
|
||||
if (0) {
|
||||
$j = $i*2+$j*($i++);
|
||||
|
@ -197,7 +197,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
?>
|
||||
|
||||
*** C-style else-if's ***
|
||||
<?php
|
||||
<?php
|
||||
/* looks like without we even tried, C-style else-if structure works fine! */
|
||||
if ($a=0) {
|
||||
echo "This shouldn't be displayed\n";
|
||||
|
@ -214,7 +214,7 @@ if (0) { /* this code is not supposed to be executed */
|
|||
*************************
|
||||
|
||||
*** WHILE tests ***
|
||||
<?php
|
||||
<?php
|
||||
$i=0;
|
||||
$j=20;
|
||||
while ($i<(2*$j)) {
|
||||
|
@ -232,7 +232,7 @@ while ($i<(2*$j)) {
|
|||
|
||||
|
||||
*** Nested WHILEs ***
|
||||
<?php
|
||||
<?php
|
||||
$arr_len=3;
|
||||
|
||||
$i=0;
|
||||
|
@ -268,7 +268,7 @@ while ($i<$arr_len) {
|
|||
*********************
|
||||
|
||||
*** hash test... ***
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
$i=0;
|
||||
|
||||
|
@ -288,7 +288,7 @@ echo "commented out...";
|
|||
**************************
|
||||
|
||||
*** Hash resizing test ***
|
||||
<?php
|
||||
<?php
|
||||
$i = 10;
|
||||
$a = "b";
|
||||
while ($i > 0) {
|
||||
|
@ -310,7 +310,7 @@ while ($i > 0) {
|
|||
|
||||
|
||||
*** break/continue test ***
|
||||
<?php
|
||||
<?php
|
||||
$i=0;
|
||||
|
||||
echo "\$i should go from 0 to 2\n";
|
||||
|
@ -364,7 +364,7 @@ while ($i<5) {
|
|||
<?php include("023-2.inc"); ?>
|
||||
********************************
|
||||
|
||||
<?php
|
||||
<?php
|
||||
{
|
||||
echo "Tests completed.\n"; # testing some PHP style comment...
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -814,7 +814,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -1039,7 +1039,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -1264,7 +1264,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -1489,7 +1489,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -1714,7 +1714,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -1939,7 +1939,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -2164,7 +2164,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -2389,7 +2389,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -2614,7 +2614,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -2839,7 +2839,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -3064,7 +3064,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -3289,7 +3289,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -3514,7 +3514,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -3739,7 +3739,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -3964,7 +3964,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -4189,7 +4189,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -4414,7 +4414,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -4639,7 +4639,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -4864,7 +4864,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -5089,7 +5089,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -5314,7 +5314,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -5539,7 +5539,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -5764,7 +5764,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -5989,7 +5989,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -6214,7 +6214,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -6439,7 +6439,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -6664,7 +6664,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -6889,7 +6889,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -7114,7 +7114,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -7339,7 +7339,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -7564,7 +7564,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -7789,7 +7789,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -8014,7 +8014,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -8239,7 +8239,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -8464,7 +8464,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -8689,7 +8689,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -8914,7 +8914,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -9139,7 +9139,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -9364,7 +9364,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -9589,7 +9589,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -9814,7 +9814,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -10039,7 +10039,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -10264,7 +10264,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -10489,7 +10489,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -10714,7 +10714,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -10939,7 +10939,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -11164,7 +11164,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -11389,7 +11389,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
@ -11614,7 +11614,7 @@ $i=2
|
|||
|
||||
*** Nested file include test ***
|
||||
<html>
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
This is Finish.phtml. This file is supposed to be included
|
||||
from regression_test.phtml. This is normal HTML.
|
||||
and this is PHP code, 2+2=4
|
||||
</html>
|
||||
|
|
|
@ -15,7 +15,7 @@ TESTS;
|
|||
Remember to NOT put a trailing ; after a line!
|
||||
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL);
|
||||
$tests = explode("\n",$tests);
|
||||
$success = TRUE;
|
||||
foreach ($tests as $n=>$test)
|
||||
|
@ -72,4 +72,4 @@ foreach ($tests as $n=>$test)
|
|||
}
|
||||
}
|
||||
if ($success) echo "OK";
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// This file contains helper functions for testing open_basedir configuration
|
||||
// Care must be taken with where the directories are created because different
|
||||
// SAPIs set the working directory differently. So simply creating a directory
|
||||
// relative to the current working directory like this: mkdir("blah") might
|
||||
// relative to the current working directory like this: mkdir("blah") might
|
||||
// actually create it in several different places depending on the SAPI..!
|
||||
//
|
||||
// Note also depending on the version of php being tested, so the open_basedir
|
||||
|
@ -26,7 +26,7 @@ function recursive_delete_directory($directory) {
|
|||
// Make sure the directory is valid
|
||||
if (is_dir($directory) == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check we can access the directory
|
||||
if (is_readable($directory) == FALSE) {
|
||||
|
@ -110,7 +110,7 @@ function test_open_basedir_array($function) {
|
|||
global $savedDirectory;
|
||||
|
||||
test_open_basedir_before($function);
|
||||
test_open_basedir_error($function);
|
||||
test_open_basedir_error($function);
|
||||
var_dump(is_array($function("./../.")));
|
||||
var_dump(is_array($function("../ok")));
|
||||
var_dump(is_array($function("ok.txt")));
|
||||
|
@ -124,7 +124,7 @@ function test_open_basedir_array($function) {
|
|||
function test_open_basedir($function) {
|
||||
global $savedDirectory;
|
||||
test_open_basedir_before($function);
|
||||
test_open_basedir_error($function);
|
||||
test_open_basedir_error($function);
|
||||
var_dump($function("./../."));
|
||||
var_dump($function("../ok"));
|
||||
var_dump($function("ok.txt"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue