Remove trailing whitespace in inc files

This commit is contained in:
Gabriel Caruso 2018-02-09 22:49:21 -02:00 committed by Nikita Popov
parent 1422e2ffd1
commit 21e3b0c70c
84 changed files with 504 additions and 504 deletions

View file

@ -26,7 +26,7 @@ class Foo
{ {
return $param1; return $param1;
} }
private static function privateStaticFunction($param1) private static function privateStaticFunction($param1)
{ {
return $param1; return $param1;
@ -41,18 +41,18 @@ class Foo
{ {
return $param1; return $param1;
} }
protected function protectedInstanceFunc($param1) protected function protectedInstanceFunc($param1)
{ {
return $param1; return $param1;
} }
public function publicInstanceFunc($param1) public function publicInstanceFunc($param1)
{ {
return $param1; return $param1;
} }
public function closePrivateValid() public function closePrivateValid()
{ {
return Closure::fromCallable([$this, 'privateInstanceFunc']); return Closure::fromCallable([$this, 'privateInstanceFunc']);
@ -87,23 +87,23 @@ class Foo
class SubFoo extends Foo { class SubFoo extends Foo {
public function closePrivateStaticInvalid() public function closePrivateStaticInvalid()
{ {
return Closure::fromCallable([__CLASS__, 'privateStaticFunction']); return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
} }
public function closePrivateInvalid() public function closePrivateInvalid()
{ {
return Closure::fromCallable([$this, 'privateInstanceFunc']); return Closure::fromCallable([$this, 'privateInstanceFunc']);
} }
public function closeProtectedStaticMethod() public function closeProtectedStaticMethod()
{ {
return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']); return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']);
} }
public function closeProtectedValid() public function closeProtectedValid()
{ {
return Closure::fromCallable([$this, 'protectedInstanceFunc']); return Closure::fromCallable([$this, 'protectedInstanceFunc']);
@ -113,13 +113,13 @@ class SubFoo extends Foo {
{ {
return Closure::fromCallable('parent::publicInstanceFunc'); return Closure::fromCallable('parent::publicInstanceFunc');
} }
public function getSelfColonParentPublicInstanceMethod() public function getSelfColonParentPublicInstanceMethod()
{ {
return Closure::fromCallable('self::publicInstanceFunc'); return Closure::fromCallable('self::publicInstanceFunc');
} }
public function getSelfColonParentProtectedInstanceMethod() public function getSelfColonParentProtectedInstanceMethod()
{ {
return Closure::fromCallable('self::protectedInstanceFunc'); return Closure::fromCallable('self::protectedInstanceFunc');

View file

@ -47,7 +47,7 @@ class IndexableRetrievable
{ {
private $label; private $label;
private $indexable; private $indexable;
public function __construct(string $label, Indexable $indexable) { public function __construct(string $label, Indexable $indexable) {
$this->label = $label; $this->label = $label;
$this->indexable = $indexable; $this->indexable = $indexable;

View file

@ -1,4 +1,4 @@
<?php <?php
if(!extension_loaded("calendar")) if(!extension_loaded("calendar"))
print "skip - CALENDAR extension not available"; print "skip - CALENDAR extension not available";
?> ?>

View file

@ -8,7 +8,7 @@ function curl_cli_server_start() {
if(getenv('PHP_CURL_HTTP_REMOTE_SERVER')) { if(getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
return getenv('PHP_CURL_HTTP_REMOTE_SERVER'); return getenv('PHP_CURL_HTTP_REMOTE_SERVER');
} }
$php_executable = getenv('TEST_PHP_EXECUTABLE'); $php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__; $doc_root = __DIR__;
$router = "responder/get.php"; $router = "responder/get.php";
@ -30,7 +30,7 @@ function curl_cli_server_start() {
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root); $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
} }
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' // 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 // it might not be listening yet...need to wait until fsockopen() call returns
$error = "Unable to connect to server\n"; $error = "Unable to connect to server\n";

View file

@ -18,44 +18,44 @@ function get_php_info()
function get_freetype_version() function get_freetype_version()
{ {
$version = 0; $version = 0;
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libjpeg_version() function get_libjpeg_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) { if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libpng_version() function get_libpng_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libxpm_version() function get_libxpm_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) { if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }

View file

@ -6,7 +6,7 @@ $imap_stream = imap_open($default_mailbox, $username, $password);
// delete all msgs in default mailbox, i.e INBOX // delete all msgs in default mailbox, i.e INBOX
$check = imap_check($imap_stream); $check = imap_check($imap_stream);
for ($i = 1; $i <= $check->Nmsgs; $i++) { for ($i = 1; $i <= $check->Nmsgs; $i++) {
imap_delete($imap_stream, $i); imap_delete($imap_stream, $i);
} }
$mailboxes = imap_getmailboxes($imap_stream, $server, '*'); $mailboxes = imap_getmailboxes($imap_stream, $server, '*');
@ -14,12 +14,12 @@ $mailboxes = imap_getmailboxes($imap_stream, $server, '*');
foreach($mailboxes as $value) { foreach($mailboxes as $value) {
// Only delete mailboxes with our prefix // Only delete mailboxes with our prefix
if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) { 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) { && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) {
imap_deletemailbox($imap_stream, $value->name); imap_deletemailbox($imap_stream, $value->name);
} }
} }
} }
imap_close($imap_stream, CL_EXPUNGE); imap_close($imap_stream, CL_EXPUNGE);
?> ?>

View file

@ -3,7 +3,7 @@
$server = '{127.0.0.1/norsh}'; $server = '{127.0.0.1/norsh}';
$default_mailbox = $server . "INBOX"; $default_mailbox = $server . "INBOX";
$domain = "something.com"; $domain = "something.com";
$admin_user = "webmaster"; // a user with admin access $admin_user = "webmaster"; // a user with admin access
$username = "$admin_user@$domain"; $username = "$admin_user@$domain";
$password = 'p4ssw0rd'; $password = 'p4ssw0rd';
$users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids $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 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 * @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"){ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
global $server, $default_mailbox, $username, $password; global $server, $default_mailbox, $username, $password;
// open a stream to default mailbox // open a stream to default mailbox
$imap_stream = imap_open($default_mailbox, $username, $password); $imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) { if ($imap_stream === false) {
echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
return false; return false;
} }
echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
$new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
if ($new_mailbox === false) { if ($new_mailbox === false) {
echo "Cant create a temporary mailbox: " . imap_last_error(). "\n"; echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
return false; return false;
} }
echo ".. mailbox '$new_mailbox' created\n"; echo ".. mailbox '$new_mailbox' created\n";
// reopen stream to new mailbox // reopen stream to new mailbox
if (imap_reopen($imap_stream, $new_mailbox) === false) { if (imap_reopen($imap_stream, $new_mailbox) === false) {
echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
return false; return false;
} }
return $imap_stream; 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"){ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
global $default_mailbox, $mailbox_prefix; global $default_mailbox, $mailbox_prefix;
$mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
$mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
// check mailbox does not already exist // check mailbox does not already exist
if ($mailboxes) { if ($mailboxes) {
foreach($mailboxes as $value) { 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"); exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
} }
} }
} }
if (imap_createmailbox($imap_stream, $mailbox) === false) { if (imap_createmailbox($imap_stream, $mailbox) === false) {
return false; return false;
} }
// Add number of test msgs requested // Add number of test msgs requested
if ($message_count > 0) { if ($message_count > 0) {
populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
} }
return $mailbox; return $mailbox;
} }
@ -146,42 +146,42 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
$envelope["from"]= "foo@anywhere.com"; $envelope["from"]= "foo@anywhere.com";
$envelope["to"] = "$users[0]@$domain"; $envelope["to"] = "$users[0]@$domain";
$envelope["subject"] = "Test msg $i"; $envelope["subject"] = "Test msg $i";
$part1["type"] = TYPEMULTIPART; $part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed"; $part1["subtype"] = "mixed";
$part2["type"] = TYPETEXT; $part2["type"] = TYPETEXT;
$part2["subtype"] = "plain"; $part2["subtype"] = "plain";
$part2["description"] = "imap_mail_compose() function"; $part2["description"] = "imap_mail_compose() function";
$part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
$part3["type"] = TYPETEXT; $part3["type"] = TYPETEXT;
$part3["subtype"] = "plain"; $part3["subtype"] = "plain";
$part3["description"] = "Example"; $part3["description"] = "Example";
$part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
$part4["type"] = TYPETEXT; $part4["type"] = TYPETEXT;
$part4["subtype"] = "plain"; $part4["subtype"] = "plain";
$part4["description"] = "Return Values"; $part4["description"] = "Return Values";
$part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
$body[1] = $part1; $body[1] = $part1;
$body[2] = $part2; $body[2] = $part2;
$body[3] = $part3; $body[3] = $part3;
$body[4] = $part4; $body[4] = $part4;
$msg = imap_mail_compose($envelope, $body); $msg = imap_mail_compose($envelope, $body);
} }
imap_append($imap_stream, $mailbox, $msg); 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 * @param string mailbox complete mailbox name
* @return mailbox name * @return mailbox name
*/ */
function get_mailbox_name($mailbox){ function get_mailbox_name($mailbox){

View file

@ -1,6 +1,6 @@
<?php <?php
extension_loaded('imap') or die('skip imap extension not available in this build'); extension_loaded('imap') or die('skip imap extension not available in this build');
// Change these to make tests run successfully // Change these to make tests run successfully
$mailbox = '{localhost/norsh}'; $mailbox = '{localhost/norsh}';
$username = 'webmaster@something.com'; $username = 'webmaster@something.com';

View file

@ -14,7 +14,7 @@ function init_db()
{ {
global $test_base, $user, $password; 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, sprintf("CREATE SCHEMA '%s' USER '%s' PASSWORD '%s' DEFAULT CHARACTER SET %s",$test_base,
$user, $password, ($charset = ini_get('ibase.default_charset')) ? $charset : 'NONE')); $user, $password, ($charset = ini_get('ibase.default_charset')) ? $charset : 'NONE'));
$tr = ibase_trans($test_db); $tr = ibase_trans($test_db);
@ -28,7 +28,7 @@ function init_db()
function cleanup_db() function cleanup_db()
{ {
global $test_base; global $test_base;
$r = ibase_connect($test_base); $r = ibase_connect($test_base);
ibase_drop_db($r); ibase_drop_db($r);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
if (!extension_loaded("interbase")) print "skip interbase extension not available"; if (!extension_loaded("interbase")) print "skip interbase extension not available";
require("interbase.inc"); require("interbase.inc");
if(!@ibase_connect($test_base)){ if(!@ibase_connect($test_base)){
die("skip cannot connnect"); die("skip cannot connnect");

View file

@ -6,7 +6,7 @@
// Custom Error Hanlder for testing // Custom Error Hanlder for testing
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
global $debug; global $debug;
$err_type = array ( $err_type = array (
1 => "Error", // E_ERROR 1 => "Error", // E_ERROR
2 => "Warning", // E_WARINING 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 4096=> "Recoverable fatal error", // E_RECOVERABLE_ERROR
8192=> "Deprecated", // E_DEPRECATED 8192=> "Deprecated", // E_DEPRECATED
); );
if (!empty($debug)) { if (!empty($debug)) {
printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum); printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum);
} }
@ -46,7 +46,7 @@ class tc
public $s1 = '日本語EUC-JPの文字列'; public $s1 = '日本語EUC-JPの文字列';
public $s2 = 'English Text'; public $s2 = 'English Text';
function __construct() function __construct()
{ {
} }
} }

View file

@ -19,7 +19,7 @@ if ((isset($matches[1]) && $matches[1] >= 11)) {
"grant use on edition myedition1 to $testuser", "grant use on edition myedition1 to $testuser",
); );
} else { } else {
// Server is Pre 11.2 // Server is Pre 11.2
$stmtarray = array( $stmtarray = array(
"drop user $testuser cascade", "drop user $testuser cascade",
"create user $testuser identified by $testpassword", "create user $testuser identified by $testpassword",
@ -34,7 +34,7 @@ foreach ($stmtarray as $stmt) {
$m = oci_error($s); $m = oci_error($s);
if (!in_array($m['code'], array( // ignore expected errors if (!in_array($m['code'], array( // ignore expected errors
942 // table or view does not exist 942 // table or view does not exist
, 1918 // user does not exist , 1918 // user does not exist
, 2289 // sequence does not exist , 2289 // sequence does not exist
, 4080 // trigger does not exist , 4080 // trigger does not exist
, 38802 // edition does not exist , 38802 // edition does not exist
@ -50,8 +50,8 @@ foreach ($stmtarray as $stmt) {
function get_attr($conn,$attr) function get_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 = (select sid from v\$session where audsid =
sys_context('userenv','sessionid')) order by 1"; sys_context('userenv','sessionid')) order by 1";
$s2 = oci_parse($conn,$sel_stmt); $s2 = oci_parse($conn,$sel_stmt);
oci_execute($s2,OCI_DEFAULT); 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=1 for a connection with oci_connect()
Pass $conn_type=2 for ooci_pconnect Pass $conn_type=2 for ooci_pconnect
Default will give a oci_new_connect */ Default will give a oci_new_connect */
function get_conn($conn_type) function get_conn($conn_type)
@ -87,23 +87,23 @@ function get_conn($conn_type)
function set_attr($conn,$attr,$sufix) function set_attr($conn,$attr,$sufix)
{ {
if (!strcmp($attr,'MODULE')) if (!strcmp($attr,'MODULE'))
$r = oci_set_module_name($conn,'PHP TEST'.$sufix); $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); $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); $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); $r = oci_set_client_identifier($conn,'ID00'.$sufix);
else else
echo "Pass one of the above four attributes!!!\n"; echo "Pass one of the above four attributes!!!\n";
if ($r) { if ($r) {
echo "Value of $attr has been set successfully\n"; echo "Value of $attr has been set successfully\n";
} }
//Do a round-trip here //Do a round-trip here
oci_server_version($conn); oci_server_version($conn);
return $r; return $r;
} }
function set_edit_attr($value) function set_edit_attr($value)
@ -126,7 +126,7 @@ function get_edit_attr ($conn) {
function get_sys_attr($conn,$attr) 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"; (select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1";
$s2 = oci_parse($conn,$sel_stmt); $s2 = oci_parse($conn,$sel_stmt);
oci_execute($s2,OCI_DEFAULT); oci_execute($s2,OCI_DEFAULT);
@ -141,7 +141,7 @@ function clean_up($c) {
"drop edition myedition cascade", "drop edition myedition cascade",
"drop user " . $GLOBALS['testuser'] . " cascade", "drop user " . $GLOBALS['testuser'] . " cascade",
); );
foreach ($stmtarray as $stmt) { foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt); $s = oci_parse($c, $stmt);
@oci_execute($s); @oci_execute($s);

View file

@ -9,7 +9,7 @@
@OCIExecute($statement); @OCIExecute($statement);
$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)"; $ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)";
$statement = OCIParse($c,$ora_sql); $statement = OCIParse($c,$ora_sql);
OCIExecute($statement); OCIExecute($statement);
} }

View file

@ -30,11 +30,11 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) {
$dbase = "localhost/XE"; $dbase = "localhost/XE";
$test_drcp = FALSE; $test_drcp = FALSE;
} }
/* /*
* Common object names for scripts to use * Common object names for scripts to use
*/ */
$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5); $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)); $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
$schema = ''; $schema = '';

View file

@ -7,7 +7,7 @@ function drcp_create_table($conn)
$create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))"; $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))";
$statement = oci_parse($conn, $create_sql); $statement = oci_parse($conn, $create_sql);
oci_execute($statement); oci_execute($statement);
$id_values = array(100,101,102,103,104,105,106,107,108); $id_values = array(100,101,102,103,104,105,106,107,108);
$name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT", $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT",
"BILL","LAWSON","MARY"); "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]."')"; $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
$s = oci_parse($conn, $insert); $s = oci_parse($conn, $insert);
oci_execute($s); oci_execute($s);
} }
} }
function drcp_drop_table($conn) function drcp_drop_table($conn)
@ -74,12 +74,12 @@ function drcp_create_package($c)
end;"; end;";
$s1 = oci_parse($c, $create_package_stmt); $s1 = oci_parse($c, $create_package_stmt);
oci_execute($s1); oci_execute($s1);
$package_body = "create or replace package body drcp_test_package as $package_body = "create or replace package body drcp_test_package as
procedure p1(var1 int) is procedure p1(var1 int) is
begin begin
var :=var1; var :=var1;
end; end;
function f1 return number is function f1 return number is
begin begin
return drcp_test_package.var; return drcp_test_package.var;

View file

@ -1,6 +1,6 @@
<?php <?php
if ($c) { if ($c) {
$ora_sql = "DROP TABLE ".$schema.$table_name; $ora_sql = "DROP TABLE ".$schema.$table_name;
$statement = oci_parse($c,$ora_sql); $statement = oci_parse($c,$ora_sql);
oci_execute($statement); oci_execute($statement);
} }

View file

@ -96,7 +96,7 @@ class ServerClientTestCase
eval($this->stripPhpTagsFromCode($proc1Code)); eval($this->stripPhpTagsFromCode($proc1Code));
$this->cleanupWorkerProcess(); $this->cleanupWorkerProcess();
} }
public function wait() public function wait()
{ {
fgets($this->isWorker ? STDIN : $this->workerStdOut); fgets($this->isWorker ? STDIN : $this->workerStdOut);

View file

@ -1,4 +1,4 @@
<?php <?php
if (!function_exists('setlocale')) { if (!function_exists('setlocale')) {
die('skip: setlocale() not available'); die('skip: setlocale() not available');

View file

@ -1,5 +1,5 @@
<?php /* $Id$ */ <?php /* $Id$ */
if (!extension_loaded("interbase") || !extension_loaded("pdo_firebird")) print "skip"; if (!extension_loaded("interbase") || !extension_loaded("pdo_firebird")) print "skip";
?> ?>

View file

@ -25,7 +25,7 @@ function init_db()
function cleanup_db() function cleanup_db()
{ {
global $test_base; global $test_base;
$r = ibase_connect($test_base); $r = ibase_connect($test_base);
ibase_drop_db($r); ibase_drop_db($r);
} }

View file

@ -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) { foreach ($db->query("show variables like 'have%'") as $row) {
if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) { if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) {
return str_replace("have_", "", $row[0]); return str_replace("have_", "", $row[0]);

View file

@ -12,7 +12,7 @@
// {{{ class Phar extends PHP_Archive // {{{ class Phar extends PHP_Archive
/** /**
* Phar class * Phar class
* *
* @ingroup Phar * @ingroup Phar
* @brief Phar implementation * @brief Phar implementation
* @author Marcus Boerger * @author Marcus Boerger

View file

@ -12,11 +12,11 @@
// {{{ class PharCommand extends CLICommand // {{{ class PharCommand extends CLICommand
/** /**
* PharCommand class * PharCommand class
* *
* This class handles the handling of the phar * This class handles the handling of the phar
* commands. It will be used from command line/console * commands. It will be used from command line/console
* in order to retrieve and execute phar functions. * in order to retrieve and execute phar functions.
* *
* @ingroup Phar * @ingroup Phar
* @brief Phar console command implementation * @brief Phar console command implementation
* @author Marcus Boerger * @author Marcus Boerger
@ -47,7 +47,7 @@ class PharCommand extends CLICommand
// {{{ static function phar_args // {{{ static function phar_args
/** /**
* Phar arguments * Phar arguments
* *
* This function contains all the phar commands * This function contains all the phar commands
* *
* @param string $which Which argument is chosen. * @param string $which Which argument is chosen.
@ -185,7 +185,7 @@ class PharCommand extends CLICommand
// {{{ static function strEndsWith // {{{ static function strEndsWith
/** /**
* String Ends With * String Ends With
* *
* Whether a string ends with another needle. * Whether a string ends with another needle.
* *
* @param string $haystack The haystack * @param string $haystack The haystack
@ -285,7 +285,7 @@ class PharCommand extends CLICommand
// {{{ static function cli_arg_typ_pharfile // {{{ static function cli_arg_typ_pharfile
/** /**
* Argument type existing Phar file * Argument type existing Phar file
* *
* Return filename of an existing Phar. * Return filename of an existing Phar.
* *
* @param string $arg The file in the phar to open. * @param string $arg The file in the phar to open.
@ -312,10 +312,10 @@ class PharCommand extends CLICommand
// {{{ static function cli_arg_typ_pharurl // {{{ static function cli_arg_typ_pharurl
/** /**
* Argument type Phar url-like * Argument type Phar url-like
* *
* Check the argument as cli_arg_Typ_phar and return its name prefixed * Check the argument as cli_arg_Typ_phar and return its name prefixed
* with phar:// * with phar://
* *
* Ex: * Ex:
* <code> * <code>
* $arg = 'pharchive.phar/file.php'; * $arg = 'pharchive.phar/file.php';
@ -544,9 +544,9 @@ class PharCommand extends CLICommand
// {{{ function cli_cmd_run_pack // {{{ function cli_cmd_run_pack
/** /**
* Pack a new Phar * Pack a new Phar
* *
* This function will try to pack a new Phar archive. * This function will try to pack a new Phar archive.
* *
* @see Exit to make sure that we are done. * @see Exit to make sure that we are done.
*/ */
public function cli_cmd_run_pack() public function cli_cmd_run_pack()
@ -617,7 +617,7 @@ class PharCommand extends CLICommand
* *
* This function will take a directory and iterate through * This function will take a directory and iterate through
* it and get the files to insert into the Phar archive. * it and get the files to insert into the Phar archive.
* *
* @param Phar $phar The phar object. * @param Phar $phar The phar object.
* @param string $input The input directory * @param string $input The input directory
* @param string $regex The regex used in RegexIterator. * @param string $regex The regex used in RegexIterator.
@ -712,7 +712,7 @@ class PharCommand extends CLICommand
// {{{ public function phar_dir_operation // {{{ public function phar_dir_operation
/** /**
* Directory operations * Directory operations
* *
* Phar directory operations. * Phar directory operations.
* *
* @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object. * @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object.
@ -801,9 +801,9 @@ class PharCommand extends CLICommand
// {{{ public function cli_cmd_run_tree // {{{ public function cli_cmd_run_tree
/** /**
* Cli Command Run Tree * Cli Command Run Tree
* *
* Set the phar_dir_operation with a directorygraphiterator. * Set the phar_dir_operation with a directorygraphiterator.
* *
* @see DirectoryGraphIterator * @see DirectoryGraphIterator
* @see $this->phar_dir_operation * @see $this->phar_dir_operation
* *
@ -834,7 +834,7 @@ class PharCommand extends CLICommand
// {{{ static function cli_cmd_arg_extract // {{{ static function cli_cmd_arg_extract
/** /**
* Cli Command Arguments Extract * Cli Command Arguments Extract
* *
* The arguments for the extract function. * The arguments for the extract function.
* *
* @return array The arguments for the extraction. * @return array The arguments for the extraction.
@ -855,7 +855,7 @@ class PharCommand extends CLICommand
// {{{ public function cli_cmd_run_extract // {{{ public function cli_cmd_run_extract
/** /**
* Run Extract * Run Extract
* *
* Run the extraction of a phar Archive. * Run the extraction of a phar Archive.
* *
* @see $this->phar_dir_operation * @see $this->phar_dir_operation
@ -889,7 +889,7 @@ class PharCommand extends CLICommand
// {{{ public function phar_dir_extract // {{{ public function phar_dir_extract
/** /**
* Extract to a directory * Extract to a directory
* *
* This function will extract the content of a Phar * This function will extract the content of a Phar
* to a directory and create new files and directories * to a directory and create new files and directories
* depending on the permissions on that folder. * depending on the permissions on that folder.
@ -1085,7 +1085,7 @@ class PharCommand extends CLICommand
// {{{ public function cli_cmd_run_stub_get // {{{ public function cli_cmd_run_stub_get
/** /**
* Cli Command Run Stub * Cli Command Run Stub
* *
* Get arguments and store them into a stub. * Get arguments and store them into a stub.
* *
* @param arguments $args * @param arguments $args
@ -1102,7 +1102,7 @@ class PharCommand extends CLICommand
// {{{ public function cli_cmd_inf_compress // {{{ public function cli_cmd_inf_compress
/** /**
* Cli Command Inf Compress * Cli Command Inf Compress
* *
* Cli Command compress informations * Cli Command compress informations
* *
* @return string A description of the command. * @return string A description of the command.

View file

@ -32,7 +32,7 @@ class corrupt_tarmaker
/** /**
* save a file inside this package * save a file inside this package
* *
* This code is modified from Vincent Lascaux's File_Archive * This code is modified from Vincent Lascaux's File_Archive
* package, which is licensed under the LGPL license. * package, which is licensed under the LGPL license.
* @param string relative path within the package * @param string relative path within the package
@ -152,7 +152,7 @@ class corrupt_tarmaker
/** /**
* Create an internal directory, creating parent directories as needed * Create an internal directory, creating parent directories as needed
* *
* @param string $dir * @param string $dir
*/ */
function mkdir($dir) function mkdir($dir)

View file

@ -33,7 +33,7 @@ class danger_tarmaker
/** /**
* save a file inside this package * save a file inside this package
* *
* This code is modified from Vincent Lascaux's File_Archive * This code is modified from Vincent Lascaux's File_Archive
* package, which is licensed under the LGPL license. * package, which is licensed under the LGPL license.
* @param string relative path within the package * @param string relative path within the package
@ -145,7 +145,7 @@ class danger_tarmaker
/** /**
* Create an internal directory, creating parent directories as needed * Create an internal directory, creating parent directories as needed
* *
* @param string $dir * @param string $dir
*/ */
function mkdir($dir) function mkdir($dir)

View file

@ -32,7 +32,7 @@ class tarmaker
/** /**
* save a file inside this package * save a file inside this package
* *
* This code is modified from Vincent Lascaux's File_Archive * This code is modified from Vincent Lascaux's File_Archive
* package, which is licensed under the LGPL license. * package, which is licensed under the LGPL license.
* @param string relative path within the package * @param string relative path within the package
@ -144,7 +144,7 @@ class tarmaker
/** /**
* Create an internal directory, creating parent directories as needed * Create an internal directory, creating parent directories as needed
* *
* @param string $dir * @param string $dir
*/ */
function mkdir($dir) function mkdir($dir)

View file

@ -51,7 +51,7 @@ class zipmaker
/** /**
* Create an internal directory, creating parent directories as needed * Create an internal directory, creating parent directories as needed
* *
* This is a no-op for the tar creator * This is a no-op for the tar creator
* @param string $dir * @param string $dir
*/ */

View file

@ -4,11 +4,11 @@ class ReflectionExceptionEx extends ReflectionException {
$this->errno = $_errno; $this->errno = $_errno;
$this->errmsg = $_errmsg; $this->errmsg = $_errmsg;
} }
function getErrno() { function getErrno() {
return $this->errno; return $this->errno;
} }
function getErrmsg() { function getErrmsg() {
return $this->errmsg; return $this->errmsg;
} }

View file

@ -110,7 +110,7 @@ function gc($maxlifetime) {
$directory = opendir($session_save_path."/"); $directory = opendir($session_save_path."/");
$length = strlen(SESSION_FILE_PREFIX); $length = strlen(SESSION_FILE_PREFIX);
while (($file = readdir($directory)) !== FALSE) { while (($file = readdir($directory)) !== FALSE) {
$qualified = ($session_save_path."/".$file); $qualified = ($session_save_path."/".$file);
if (is_file($qualified) === TRUE) { if (is_file($qualified) === TRUE) {
if (substr($file, 0, $length) === SESSION_FILE_PREFIX && (filemtime($qualified) + $maxlifetime <= time() )) { if (substr($file, 0, $length) === SESSION_FILE_PREFIX && (filemtime($qualified) + $maxlifetime <= time() )) {
unlink($qualified); unlink($qualified);

View file

@ -1,11 +1,11 @@
<?php <?php
extension_loaded('snmp') or die('skip snmp extension not available in this build'); extension_loaded('snmp') or die('skip snmp extension not available in this build');
require_once (dirname(__FILE__).'/snmp_include.inc'); require_once (dirname(__FILE__).'/snmp_include.inc');
//test server is available //test server is available
// this require snmpget to work ... // this require snmpget to work ...
//snmpget ( string $hostname , string $community , //snmpget ( string $hostname , string $community ,
//string $object_id [, int $timeout [, int $retries ]] ) //string $object_id [, int $timeout [, int $retries ]] )
if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false) if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)

View file

@ -2,7 +2,7 @@
class SOAP_Interop_GroupD { class SOAP_Interop_GroupD {
function echoString($inputString) function echoString($inputString)
{ {
return array("return"=>$inputString->param0); return array("return"=>$inputString->param0);
} }

View file

@ -102,7 +102,7 @@ class SOAP_Interop_GroupI {
return array("return"=>$boolean->inputBoolean); return array("return"=>$boolean->inputBoolean);
} }
function echoComplexTypeAsSimpleTypes($input) function echoComplexTypeAsSimpleTypes($input)
{ {
if (isset($input->inputComplexType)) { if (isset($input->inputComplexType)) {
$ret = array("outputInteger" => $input->inputComplexType->varInt, $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, $ret = array("varInt" => $input->inputInteger,
"varFloat" => $input->inputFloat); "varFloat" => $input->inputFloat);

View file

@ -44,7 +44,7 @@ $wsdl = <<<EOF
</binding> </binding>
<service name="testService"> <service name="testService">
<port name="testPort" binding="tns:testBinding"> <port name="testPort" binding="tns:testBinding">
<soap:address location="test://" /> <soap:address location="test://" />
</port> </port>
</service> </service>
</definitions> </definitions>

View file

@ -23,7 +23,7 @@ function __load_class($classname, $dir)
return false; return false;
} }
/** /**
* @brief Class loader for SPL example classes * @brief Class loader for SPL example classes
* @author Marcus Boerger * @author Marcus Boerger
* @version 1.0 * @version 1.0

View file

@ -49,12 +49,12 @@ class DbaArray extends DbaReader implements ArrayAccess
*/ */
function offsetGet($name) function offsetGet($name)
{ {
$data = dba_fetch($name, $this->db); $data = dba_fetch($name, $this->db);
if($data) { if($data) {
//return unserialize($data); //return unserialize($data);
return $data; return $data;
} }
else else
{ {
return NULL; return NULL;
} }

View file

@ -32,7 +32,7 @@ class DbaReader implements Iterator
throw new exception('Could not open file ' . $file); throw new exception('Could not open file ' . $file);
} }
} }
/** /**
* Close database. * Close database.
*/ */
@ -60,7 +60,7 @@ class DbaReader implements Iterator
/** /**
* Fetches the current data if $key is valid * Fetches the current data if $key is valid
*/ */
private function fetch_data() { private function fetch_data() {
if ($this->key !== false) { if ($this->key !== false) {
$this->val = dba_fetch($this->key, $this->db); $this->val = dba_fetch($this->key, $this->db);

View file

@ -28,7 +28,7 @@ class DirectoryFilterDots extends RecursiveFilterIterator
} }
/** @return whether the current entry is neither '.' nor '..' /** @return whether the current entry is neither '.' nor '..'
*/ */
function accept() function accept()
{ {
return !$this->getInnerIterator()->isDot(); return !$this->getInnerIterator()->isDot();

View file

@ -23,9 +23,9 @@ class DirectoryGraphIterator extends DirectoryTreeIterator
new ParentIterator( new ParentIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
) )
), ),
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
), ),
parent::SELF_FIRST parent::SELF_FIRST
); );
} }

View file

@ -24,27 +24,27 @@ class DirectoryTreeIterator extends RecursiveIteratorIterator
parent::__construct( parent::__construct(
new RecursiveCachingIterator( new RecursiveCachingIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
), ),
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
), ),
parent::SELF_FIRST parent::SELF_FIRST
); );
} }
/** @return the current element prefixed with ASCII graphics /** @return the current element prefixed with ASCII graphics
*/ */
function current() function current()
{ {
$tree = ''; $tree = '';
for ($l=0; $l < $this->getDepth(); $l++) { for ($l=0; $l < $this->getDepth(); $l++) {
$tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' '; $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
} }
return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-') return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
. $this->getSubIterator($l)->__toString(); . $this->getSubIterator($l)->__toString();
} }
/** Aggregates the inner iterator /** Aggregates the inner iterator
*/ */
function __call($func, $params) function __call($func, $params)
{ {
return call_user_func_array(array($this->getSubIterator(), $func), $params); return call_user_func_array(array($this->getSubIterator(), $func), $params);

View file

@ -24,9 +24,9 @@ class DualIterator implements Iterator
const KEY_LHS = 0x10; const KEY_LHS = 0x10;
const KEY_RHS = 0x20; const KEY_RHS = 0x20;
const KEY_0 = 0x00; const KEY_0 = 0x00;
const DEFAULT_FLAGS = 0x13; const DEFAULT_FLAGS = 0x13;
private $lhs; private $lhs;
private $rhs; private $rhs;
private $flags; private $flags;
@ -37,7 +37,7 @@ class DualIterator implements Iterator
* @param rhs Right Hand Side Iterator * @param rhs Right Hand Side Iterator
* @param flags iteration flags * @param flags iteration flags
*/ */
function __construct(Iterator $lhs, Iterator $rhs, function __construct(Iterator $lhs, Iterator $rhs,
$flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/) $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
{ {
$this->lhs = $lhs; $this->lhs = $lhs;
@ -74,22 +74,22 @@ class DualIterator implements Iterator
} }
/** rewind both inner iterators /** rewind both inner iterators
*/ */
function rewind() function rewind()
{ {
$this->lhs->rewind(); $this->lhs->rewind();
$this->rhs->rewind(); $this->rhs->rewind();
} }
/** @return whether both inner iterators are valid /** @return whether both inner iterators are valid
*/ */
function valid() function valid()
{ {
return $this->lhs->valid() && $this->rhs->valid(); return $this->lhs->valid() && $this->rhs->valid();
} }
/** @return current value depending on CURRENT_* flags /** @return current value depending on CURRENT_* flags
*/ */
function current() function current()
{ {
switch($this->flags & 0x0F) switch($this->flags & 0x0F)
@ -107,7 +107,7 @@ class DualIterator implements Iterator
} }
/** @return key value depending on KEY_* flags /** @return key value depending on KEY_* flags
*/ */
function key() function key()
{ {
switch($this->flags & 0xF0) switch($this->flags & 0xF0)
@ -123,14 +123,14 @@ class DualIterator implements Iterator
} }
/** move both inner iterators forward /** move both inner iterators forward
*/ */
function next() function next()
{ {
$this->lhs->next(); $this->lhs->next();
$this->rhs->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. * current and key values or both are non valid.
*/ */
function areIdentical() function areIdentical()
@ -141,7 +141,7 @@ class DualIterator implements Iterator
: $this->lhs->valid() == $this->rhs->valid(); : $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. * and key values or both are non valid.
*/ */
function areEqual() function areEqual()
@ -162,14 +162,14 @@ class DualIterator implements Iterator
* @note If one implements RecursiveIterator the other must do as well. * @note If one implements RecursiveIterator the other must do as well.
* And if both do then a recursive comparison is being used. * 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) $identical = false)
{ {
if ($lhs instanceof RecursiveIterator) if ($lhs instanceof RecursiveIterator)
{ {
if ($rhs instanceof RecursiveIterator) if ($rhs instanceof RecursiveIterator)
{ {
$it = new RecursiveDualIterator($lhs, $rhs, $it = new RecursiveDualIterator($lhs, $rhs,
self::CURRENT_0 | self::KEY_0); self::CURRENT_0 | self::KEY_0);
$it = new RecursiveCompareDualIterator($it); $it = new RecursiveCompareDualIterator($it);
} }

View file

@ -18,11 +18,11 @@ if (!class_exists("DbaReader", false)) require_once("dbareader.inc");
* @version 1.1 * @version 1.1
* *
* Using this class you can iterator over all groups of a ini file. * 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' * 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... * 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. * key() would be needed.
*/ */
class IniGroups extends KeyFilter class IniGroups extends KeyFilter

View file

@ -16,7 +16,7 @@
* *
* Instances of this class act as a filter around iterators whose elements * 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 * 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. * expression.
*/ */
class KeyFilter extends FilterIterator class KeyFilter extends FilterIterator
@ -38,13 +38,13 @@ class KeyFilter extends FilterIterator
$this->regex = $regex; $this->regex = $regex;
} }
/** \return whether the current key mathes the regular expression /** \return whether the current key mathes the regular expression
*/ */
function accept() function accept()
{ {
return ereg($this->regex, $this->getInnerIterator()->key()); return ereg($this->regex, $this->getInnerIterator()->key());
} }
/** @return regular expression used as filter /** @return regular expression used as filter
*/ */
function getRegex() function getRegex()
@ -57,7 +57,7 @@ class KeyFilter extends FilterIterator
*/ */
protected function __clone() protected function __clone()
{ {
// disallow clone // disallow clone
} }
} }

View file

@ -33,7 +33,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
} }
/** Rewind iteration andcomparison process. Starting with $equal = true. /** Rewind iteration andcomparison process. Starting with $equal = true.
*/ */
function rewind() function rewind()
{ {
$this->equal = true; $this->equal = true;
@ -49,7 +49,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
&& !$this->getInnerIterator()->getRHS()->valid(); && !$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. * current and key values or both are non valid.
*/ */
function areIdentical() function areIdentical()
@ -57,7 +57,7 @@ class RecursiveCompareDualIterator extends RecursiveIteratorIterator
return $this->equal && $this->getInnerIterator()->areIdentical(); 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. * and key values or both are non valid.
*/ */
function areEqual() function areEqual()

View file

@ -24,7 +24,7 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
* @param rhs Right Hand Side Iterator * @param rhs Right Hand Side Iterator
* @param flags iteration flags * @param flags iteration flags
*/ */
function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs, function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs,
$flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/) $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
{ {
parent::__construct($lhs, $rhs, $flags); parent::__construct($lhs, $rhs, $flags);
@ -34,10 +34,10 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
*/ */
function hasChildren() 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. * iterators current children.
*/ */
function getChildren() function getChildren()

View file

@ -38,7 +38,7 @@ abstract class SearchIterator extends FilterIterator
{ {
return !$this->done && parent::valid(); return !$this->done && parent::valid();
} }
/** Do not move forward but instead mark as finished. /** Do not move forward but instead mark as finished.
* @return void * @return void
*/ */
@ -48,7 +48,7 @@ abstract class SearchIterator extends FilterIterator
} }
/** Aggregates the inner iterator /** Aggregates the inner iterator
*/ */
function __call($func, $params) function __call($func, $params)
{ {
return call_user_func_array(array($this->getInnerIterator(), $func), $params); return call_user_func_array(array($this->getInnerIterator(), $func), $params);

View file

@ -34,7 +34,7 @@ class AppendIterator implements OuterIterator
* the AppendIterator itself becomes valid. However there will be no * the AppendIterator itself becomes valid. However there will be no
* call to $it->rewind(). Also if the current state is invalid the inner * call to $it->rewind(). Also if the current state is invalid the inner
* ArrayIterator will be rewound und forwarded to the appended element. * ArrayIterator will be rewound und forwarded to the appended element.
*/ */
function append(Iterator $it) function append(Iterator $it)
{ {
$this->iterators->append($it); $this->iterators->append($it);
@ -84,7 +84,7 @@ class AppendIterator implements OuterIterator
return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL; 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. * rewind that Iterator.
* @return void * @return void
*/ */
@ -112,7 +112,7 @@ class AppendIterator implements OuterIterator
} }
/** Aggregates the inner iterator /** Aggregates the inner iterator
*/ */
function __call($func, $params) function __call($func, $params)
{ {
return call_user_func_array(array($this->getInnerIterator(), $func), $params); return call_user_func_array(array($this->getInnerIterator(), $func), $params);

View file

@ -18,8 +18,8 @@
* This iterator wrapper does a one ahead iteration. This way it knows whether * This iterator wrapper does a one ahead iteration. This way it knows whether
* the inner iterator has one more element. * the inner iterator has one more element.
* *
* @note If you want to convert the elements into strings and the inner * @note If you want to convert the elements into strings and the inner
* Iterator is an internal Iterator then you need to provide the * Iterator is an internal Iterator then you need to provide the
* flag CALL_TOSTRING to do the conversion when the actual element * flag CALL_TOSTRING to do the conversion when the actual element
* is being fetched. Otherwise the conversion would happen with the * is being fetched. Otherwise the conversion would happen with the
* already changed iterator. If you do not need this then it you should * 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 /** Construct from another iterator
* *
* @param it Iterator to cache * @param it Iterator to cache
* @param flags Bitmask: * @param flags Bitmask:
* - CALL_TOSTRING (whether to call __toString() for every element) * - CALL_TOSTRING (whether to call __toString() for every element)
*/ */
function __construct(Iterator $it, $flags = self::CALL_TOSTRING) function __construct(Iterator $it, $flags = self::CALL_TOSTRING)
@ -63,7 +63,7 @@ class CachingIterator implements OuterIterator
$this->it->rewind(); $this->it->rewind();
$this->next(); $this->next();
} }
/** Forward to the next element /** Forward to the next element
*/ */
function next() function next()
@ -85,7 +85,7 @@ class CachingIterator implements OuterIterator
} }
$this->it->next(); $this->it->next();
} }
/** @return whether the iterator is valid /** @return whether the iterator is valid
*/ */
function valid() function valid()
@ -99,7 +99,7 @@ class CachingIterator implements OuterIterator
{ {
return $this->it->valid(); return $this->it->valid();
} }
/** @return the current element /** @return the current element
*/ */
function current() function current()
@ -123,8 +123,8 @@ class CachingIterator implements OuterIterator
{ {
return call_user_func_array(array($this->it, $func), $params); 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 * element
* @throw exception when CALL_TOSTRING was not specified in constructor * @throw exception when CALL_TOSTRING was not specified in constructor
*/ */
@ -144,10 +144,10 @@ class CachingIterator implements OuterIterator
} }
return $this->strValue; return $this->strValue;
} }
/** /**
* @return The inner iterator * @return The inner iterator
*/ */
function getInnerIterator() function getInnerIterator()
{ {
return $this->it; return $this->it;

View file

@ -15,12 +15,12 @@
* @version 1.1 * @version 1.1
* @since PHP 5.0 * @since PHP 5.0
* *
* Instances of this class act as a filter around iterators. In other words * 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 * you can put an iterator into the constructor and the instance will only
* return selected (accepted) elements. * return selected (accepted) elements.
* *
* The only thing that needs to be done to make this work is implementing * The only thing that needs to be done to make this work is implementing
* method accept(). Typically this invloves reading the current element or * method accept(). Typically this invloves reading the current element or
* key of the inner Iterator and checking whether it is acceptable. * key of the inner Iterator and checking whether it is acceptable.
*/ */
abstract class FilterIterator implements OuterIterator abstract class FilterIterator implements OuterIterator
@ -39,7 +39,7 @@ abstract class FilterIterator implements OuterIterator
/** /**
* Rewind the inner iterator. * Rewind the inner iterator.
*/ */
function rewind() { function rewind() {
$this->it->rewind(); $this->it->rewind();
$this->fetch(); $this->fetch();
} }
@ -76,38 +76,38 @@ abstract class FilterIterator implements OuterIterator
$this->it->next(); $this->it->next();
$this->fetch(); $this->fetch();
} }
/** /**
* @return Whether more elements are available * @return Whether more elements are available
*/ */
function valid() { function valid() {
return $this->it->valid(); return $this->it->valid();
} }
/** /**
* @return The current key * @return The current key
*/ */
function key() { function key() {
return $this->it->key(); return $this->it->key();
} }
/** /**
* @return The current value * @return The current value
*/ */
function current() { function current() {
return $this->it->current(); return $this->it->current();
} }
/** /**
* hidden __clone * hidden __clone
*/ */
protected function __clone() { protected function __clone() {
// disallow clone // disallow clone
} }
/** /**
* @return The inner iterator * @return The inner iterator
*/ */
function getInnerIterator() function getInnerIterator()
{ {
return $this->it; return $this->it;

View file

@ -13,8 +13,8 @@
* @brief Basic Iterator wrapper * @brief Basic Iterator wrapper
* @since PHP 5.1 * @since PHP 5.1
* *
* This iterator wrapper allows to convert anything that is traversable into * This iterator wrapper allows to convert anything that is traversable into
* an Iterator. It is very important to understand that most classes that do * 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 * 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 * 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. * prevent missuse. If you do not you must expect exceptions or fatal errors.
@ -32,7 +32,7 @@
} }
\endcode \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. * 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 * Omitting the downcast in the above example would result in an endless loop
* since IteratorIterator::__construct() would call SomeClass::getIterator(). * since IteratorIterator::__construct() would call SomeClass::getIterator().

View file

@ -47,7 +47,7 @@ class LimitIterator implements OuterIterator
$this->count = $count; $this->count = $count;
$this->pos = 0; $this->pos = 0;
} }
/** Seek to specified position /** Seek to specified position
* @param position offset to seek to (relative to beginning not offset * @param position offset to seek to (relative to beginning not offset
* specified in constructor). * specified in constructor).
@ -78,14 +78,14 @@ class LimitIterator implements OuterIterator
$this->pos = 0; $this->pos = 0;
$this->seek($this->offset); $this->seek($this->offset);
} }
/** @return whether iterator is valid /** @return whether iterator is valid
*/ */
function valid() { function valid() {
return ($this->count == -1 || $this->pos < $this->offset + $this->count) return ($this->count == -1 || $this->pos < $this->offset + $this->count)
&& $this->it->valid(); && $this->it->valid();
} }
/** @return current key /** @return current key
*/ */
function key() { function key() {
@ -105,7 +105,7 @@ class LimitIterator implements OuterIterator
$this->pos++; $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). * constructor).
*/ */
function getPosition() { function getPosition() {
@ -114,7 +114,7 @@ class LimitIterator implements OuterIterator
/** /**
* @return The inner iterator * @return The inner iterator
*/ */
function getInnerIterator() function getInnerIterator()
{ {
return $this->it; return $this->it;

View file

@ -15,8 +15,8 @@
* @version 1.2 * @version 1.2
* @since PHP 5.1 * @since PHP 5.1
* *
* This extended FilterIterator allows a recursive iteration using * This extended FilterIterator allows a recursive iteration using
* RecursiveIteratorIterator that only shows those elements which have * RecursiveIteratorIterator that only shows those elements which have
* children. * children.
*/ */
class ParentIterator extends RecursiveFilterIterator class ParentIterator extends RecursiveFilterIterator

View file

@ -18,12 +18,12 @@
* Passes the RecursiveIterator interface to the inner Iterator and provides * Passes the RecursiveIterator interface to the inner Iterator and provides
* the same functionality as FilterIterator. This allows you to skip parents * the same functionality as FilterIterator. This allows you to skip parents
* and all their childs before loading them all. You need to care about * 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 * builtin behavior uses reflection to return a new instance of the exact same
* class it is called from. That is you extend RecursiveFilterIterator and * class it is called from. That is you extend RecursiveFilterIterator and
* getChildren() will create instance of that class. The problem is that doing * getChildren() will create instance of that class. The problem is that doing
* this does not transport any state or control information of your accept() * 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 * need to overwrite getChildren(), call this implementation and pass the
* control vaules manually. * control vaules manually.
*/ */
@ -52,7 +52,7 @@ class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
} }
return $this->ref->newInstance($this->current()); return $this->ref->newInstance($this->current());
} }
private $ref; private $ref;
} }

View file

@ -25,7 +25,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
/** Construct from another iterator /** Construct from another iterator
* *
* @param it Iterator to cache * @param it Iterator to cache
* @param flags Bitmask: * @param flags Bitmask:
* - CALL_TOSTRING (whether to call __toString() for every element) * - CALL_TOSTRING (whether to call __toString() for every element)
* - CATCH_GET_CHILD (whether to catch exceptions when trying to get childs) * - CATCH_GET_CHILD (whether to catch exceptions when trying to get childs)
*/ */
@ -35,7 +35,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
} }
/** Rewind Iterator /** Rewind Iterator
*/ */
function rewind(); function rewind();
{ {
$this->hasChildren = false; $this->hasChildren = false;
@ -74,13 +74,13 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
} }
parent::next(); parent::next();
} }
private $ref; private $ref;
/** @return whether the current element has children /** @return whether the current element has children
* @note The check whether the Iterator for the children can be created was * @note The check whether the Iterator for the children can be created was
* already executed. Hence when flag CATCH_GET_CHILD was given in * 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. * not try to access those children.
*/ */
function hasChildren() function hasChildren()

View file

@ -18,12 +18,12 @@
* Passes the RecursiveIterator interface to the inner Iterator and provides * Passes the RecursiveIterator interface to the inner Iterator and provides
* the same functionality as FilterIterator. This allows you to skip parents * the same functionality as FilterIterator. This allows you to skip parents
* and all their childs before loading them all. You need to care about * 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 * builtin behavior uses reflection to return a new instance of the exact same
* class it is called from. That is you extend RecursiveFilterIterator and * class it is called from. That is you extend RecursiveFilterIterator and
* getChildren() will create instance of that class. The problem is that doing * getChildren() will create instance of that class. The problem is that doing
* this does not transport any state or control information of your accept() * 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 * need to overwrite getChildren(), call this implementation and pass the
* control vaules manually. * control vaules manually.
*/ */
@ -35,7 +35,7 @@ abstract class RecursiveFilterIterator extends FilterIterator implements Recursi
{ {
parent::__construct($it); parent::__construct($it);
} }
/** @return whether the current element has children /** @return whether the current element has children
*/ */
function hasChildren() function hasChildren()
@ -55,7 +55,7 @@ abstract class RecursiveFilterIterator extends FilterIterator implements Recursi
} }
return $this->ref->newInstance($this->getInnerIterator()->getChildren()); return $this->ref->newInstance($this->getInnerIterator()->getChildren());
} }
private $ref; private $ref;
} }

View file

@ -20,7 +20,7 @@ interface RecursiveIterator extends Iterator
/** @return whether the current element has children /** @return whether the current element has children
*/ */
function hasChildren(); function hasChildren();
/** @return the sub iterator for the current element /** @return the sub iterator for the current element
* @note The returned object must implement RecursiveIterator. * @note The returned object must implement RecursiveIterator.
*/ */

View file

@ -15,8 +15,8 @@
* @version 1.2 * @version 1.2
* @since PHP 5.0 * @since PHP 5.0
* *
* The objects of this class are created by instances of RecursiveIterator. * The objects of this class are created by instances of RecursiveIterator.
* Elements of those iterators may be traversable themselves. If so these * Elements of those iterators may be traversable themselves. If so these
* sub elements are recursed into. * sub elements are recursed into.
*/ */
class RecursiveIteratorIterator implements OuterIterator class RecursiveIteratorIterator implements OuterIterator
@ -47,7 +47,7 @@ class RecursiveIteratorIterator implements OuterIterator
* @param flags Control flags, zero or any combination of the following * @param flags Control flags, zero or any combination of the following
* (since PHP 5.1). * (since PHP 5.1).
* - CATCH_GET_CHILD which catches exceptions during * - CATCH_GET_CHILD which catches exceptions during
* getChildren() calls and simply jumps to the next * getChildren() calls and simply jumps to the next
* element. * element.
*/ */
function __construct(RecursiveIterator $it, $mode = self::LEAVES_ONLY, $flags = 0) function __construct(RecursiveIterator $it, $mode = self::LEAVES_ONLY, $flags = 0)
@ -69,7 +69,7 @@ class RecursiveIteratorIterator implements OuterIterator
$this->ait[0]->recursed = false; $this->ait[0]->recursed = false;
callNextElement(true); callNextElement(true);
} }
/** @return whether iterator is valid /** @return whether iterator is valid
*/ */
function valid() function valid()
@ -85,7 +85,7 @@ class RecursiveIteratorIterator implements OuterIterator
} }
return false; return false;
} }
/** @return current key /** @return current key
*/ */
function key() function key()
@ -93,7 +93,7 @@ class RecursiveIteratorIterator implements OuterIterator
$it = $this->ait[$this->count]; $it = $this->ait[$this->count];
return $it->key(); return $it->key();
} }
/** @return current element /** @return current element
*/ */
function current() function current()
@ -101,7 +101,7 @@ class RecursiveIteratorIterator implements OuterIterator
$it = $this->ait[$this->count]; $it = $this->ait[$this->count];
return $it->current(); return $it->current();
} }
/** Forward to next element /** Forward to next element
*/ */
function next() function next()
@ -153,7 +153,7 @@ class RecursiveIteratorIterator implements OuterIterator
callNextElement(true); 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 * Iterator
*/ */
function getSubIterator($level = NULL) function getSubIterator($level = NULL)
@ -166,7 +166,7 @@ class RecursiveIteratorIterator implements OuterIterator
/** /**
* @return The inner iterator * @return The inner iterator
*/ */
function getInnerIterator() function getInnerIterator()
{ {
return $this->it; return $this->it;
@ -201,7 +201,7 @@ class RecursiveIteratorIterator implements OuterIterator
function beginChildren() function beginChildren()
{ {
} }
/** Called after current child iterator is invalid and right before it /** Called after current child iterator is invalid and right before it
* gets destructed. * gets destructed.
* @since PHP 5.1 * @since PHP 5.1
@ -226,7 +226,7 @@ class RecursiveIteratorIterator implements OuterIterator
} }
} }
} }
/** Called when the next element is available /** Called when the next element is available
*/ */
function nextElement() function nextElement()

View file

@ -15,20 +15,20 @@
* @version 1.0 * @version 1.0
* @since PHP 5.1 * @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 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. * elemnts or keys are strings.
* *
* @param it inner iterator * @param it inner iterator
* @param regex the regular expression to match * @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) * self::ALL_MATCHES, self::SPLIT)
* @param flags special flags (self::USE_KEY) * @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() * preg_match_all(), preg_split()
*/ */
function __construct(RecursiveIterator $it, $regex, $mode = 0, $flags = 0, $preg_flags = 0) { 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()); return $this->ref->newInstance($this->getInnerIterator()->getChildren());
} }
private $ref; private $ref;
} }

View file

@ -15,11 +15,11 @@
* @version 1.0 * @version 1.0
* @since PHP 5.1 * @since PHP 5.1
* *
* This filter iterator assumes that the inner iterator * This filter iterator assumes that the inner iterator
*/ */
class RegexIterator extends FilterIterator 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. */ used rather then the current value. */
const MATCH = 0; /**< Mode: Executed a plain match only */ 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 ALL_MATCHES = 2; /**< Mode: Return all matches (if any) */
const SPLIT = 3; /**< Mode: Return the split values (if any) */ const SPLIT = 3; /**< Mode: Return the split values (if any) */
const REPLACE = 4; /**< Mode: Replace the input key or current */ const REPLACE = 4; /**< Mode: Replace the input key or current */
private $regex; /**< the regular expression to match against */ 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) */ self::GET_MATCH, self::ALL_MATCHES, self::SPLIT) */
private $flags; /**< special flags (self::USE_KEY) */ private $flags; /**< special flags (self::USE_KEY) */
private $preg_flags;/**< PREG_* flags, see preg_match(), preg_match_all(), private $preg_flags;/**< PREG_* flags, see preg_match(), preg_match_all(),
preg_split() */ preg_split() */
private $key; /**< the value used for key() */ private $key; /**< the value used for key() */
private $current; /**< the value used for current() */ 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. * elemnts or keys are strings.
* *
* @param it inner iterator * @param it inner iterator
* @param regex the regular expression to match * @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) * self::ALL_MATCHES, self::SPLIT)
* @param flags special flags (self::USE_KEY) * @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() * preg_match_all(), preg_split()
*/ */
function __construct(Iterator $it, $regex, $mode = 0, $flags = 0, $preg_flags = 0) { function __construct(Iterator $it, $regex, $mode = 0, $flags = 0, $preg_flags = 0) {

View file

@ -25,8 +25,8 @@ interface SeekableIterator extends Iterator
* \param $index position to seek to * \param $index position to seek to
* \return void * \return void
* *
* The method should throw an exception if it is not possible to seek to * 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 given position. Typically this exception should be of type
* OutOfBoundsException. * OutOfBoundsException.
\code \code
function seek($index); function seek($index);

View file

@ -15,8 +15,8 @@
* The SplDoublyLinkedList class provides the main functionalities of a * The SplDoublyLinkedList class provides the main functionalities of a
* doubly linked list (DLL). * doubly linked list (DLL).
* @note The following userland implementation of Iterator is a bit different * @note The following userland implementation of Iterator is a bit different
* from the internal one. Internally, iterators generated by nested * from the internal one. Internally, iterators generated by nested
* foreachs are independent, while they share the same traverse pointer * foreachs are independent, while they share the same traverse pointer
* in userland. * in userland.
*/ */
class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
@ -113,7 +113,7 @@ class SplDoublyLinkedList implements Iterator, ArrayAccess, Countable
return ($this->count() == 0); 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: * can be set:
* - The direction of the iteration (either one or the other) * - The direction of the iteration (either one or the other)
* - SplDoublyLnkedList::IT_MODE_LIFO (Stack style) * - SplDoublyLnkedList::IT_MODE_LIFO (Stack style)

View file

@ -28,15 +28,15 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
private $flags = 0; private $flags = 0;
private $delimiter= ','; private $delimiter= ',';
private $enclosure= '"'; private $enclosure= '"';
/** /**
* Constructs a new file object * Constructs a new file object
* *
* @param $file_name The name of the stream to open * @param $file_name The name of the stream to open
* @param $open_mode The file open mode * @param $open_mode The file open mode
* @param $use_include_path Whether to search in include paths * @param $use_include_path Whether to search in include paths
* @param $context A stream context * @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). * access rights).
*/ */
function __construct($file_name, $open_mode = 'r', $use_include_path = false, $context = NULL) 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; $this->fname = $file_name;
} }
/** /**
* @return whether the end of the stream is reached * @return whether the end of the stream is reached
*/ */
@ -65,13 +65,13 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
$this->freeLine(); $this->freeLine();
$this->lnum++; $this->lnum++;
$buf = fgets($this->fp, $this->max_len); $buf = fgets($this->fp, $this->max_len);
return $buf; return $buf;
} }
/** /**
* @param delimiter character used as field separator * @param delimiter character used as field separator
* @param enclosure end of * @param enclosure end of
* @return array containing read data * @return array containing read data
*/ */
function fgetcsv($delimiter = NULL, $enclosure = NULL) function fgetcsv($delimiter = NULL, $enclosure = NULL)
@ -88,7 +88,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
case 2: case 2:
break; 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 pos new file position
* @param whence seek method (SEEK_SET, SEEK_CUR, SEEK_END) * @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. * seeking past EOF is not considered an error.
*/ */
function fseek($pos, $whence = SEEK_SET) function fseek($pos, $whence = SEEK_SET)
@ -179,7 +179,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** Scan the next line /** Scan the next line
* @param $format string specifying format to parse * @param $format string specifying format to parse
*/ */
function fscanf($format /* , ... */) function fscanf($format /* , ... */)
{ {
$this->freeLine(); $this->freeLine();
@ -276,11 +276,11 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
{ {
return !$this->eof(); return !$this->eof();
} }
/** /**
* @note Fill current line buffer if not done yet. * @note Fill current line buffer if not done yet.
* @return line buffer * @return line buffer
*/ */
function current() function current()
{ {
if (is_null($this->line)) 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. * @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 * This has the effect key() called on a read a new line will already
* return the increased line number. * return the increased line number.
* @note Line counting works as long as you only read the file and do not * @note Line counting works as long as you only read the file and do not
* use fseek(). * use fseek().
*/ */
function key() function key()
{ {
return $this->lnum; return $this->lnum;
} }
/** Invalidate current line buffer. /** Invalidate current line buffer.
*/ */
function next() function next()
{ {
$this->freeLine(); $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 * @note If you DO overload this function key() and current() will increment
* $this->lnum automatically. If not then function reaLine() will do * $this->lnum automatically. If not then function reaLine() will do
* that for you. * that for you.
*/ */
function getCurrentLine() function getCurrentLine()
{ {
$this->freeLine(); $this->freeLine();
@ -363,7 +363,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** /**
* @param $line_pos Seek to this line * @param $line_pos Seek to this line
*/ */
function seek($line_pos) function seek($line_pos)
{ {
$this->rewind(); $this->rewind();

View file

@ -31,21 +31,21 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
{ {
rewind($this->storage); rewind($this->storage);
} }
/** @return whether iterator is valid /** @return whether iterator is valid
*/ */
function valid() function valid()
{ {
return key($this->storage) !== false; return key($this->storage) !== false;
} }
/** @return current key /** @return current key
*/ */
function key() function key()
{ {
return $this->index; return $this->index;
} }
/** @return current object /** @return current object
*/ */
function current() function current()
@ -53,7 +53,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
$element = current($this->storage); $element = current($this->storage);
return $element ? $element[0] : NULL return $element ? $element[0] : NULL
} }
/** @return get current object's associated information /** @return get current object's associated information
* @since 5.3.0 * @since 5.3.0
*/ */
@ -62,7 +62,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
$element = current($this->storage); $element = current($this->storage);
return $element ? $element[1] : NULL return $element ? $element[1] : NULL
} }
/** @return set current object's associated information /** @return set current object's associated information
* @since 5.3.0 * @since 5.3.0
*/ */
@ -72,7 +72,7 @@ class SplObjectStorage implements Iterator, Countable, ArrayAccess
$this->storage[$this->index][1] = $inf; $this->storage[$this->index][1] = $inf;
} }
} }
/** Forward to next element /** Forward to next element
*/ */
function next() function next()

View file

@ -11,7 +11,7 @@
/** @ingroup SPL /** @ingroup SPL
* @brief Implementation of a Queue through a DoublyLinkedList. As SplQueue * @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, * even though they don't make much sense for a queue. For convenience,
* two aliases are available: * two aliases are available:
* - enqueue() is an alias of push() * - enqueue() is an alias of push()
@ -26,7 +26,7 @@ class SplQueue extends SplDoublyLinkedList
{ {
protected $_it_mode = parent::IT_MODE_FIFO; 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: * can be set:
* *
* - The behavior of the iterator (either one or the other) * - The behavior of the iterator (either one or the other)

View file

@ -10,7 +10,7 @@
*/ */
/** @ingroup SPL /** @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 * extends SplDoublyLinkedList, shift() and unshift() are still available even
* though they don't make much sense for a stack. * though they don't make much sense for a stack.
* @since PHP 5.3 * @since PHP 5.3
@ -22,7 +22,7 @@ class SplStack extends SplDoublyLinkedList
{ {
protected $_it_mode = parent::IT_MODE_LIFO; 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: * can be set:
* *
* - The behavior of the iterator (either one or the other) * - The behavior of the iterator (either one or the other)

View file

@ -1,6 +1,6 @@
<?php <?php
$tmp = pow(2,24); $tmp = pow(2,24);
$data = array( $data = array(
'PHP', 'PHP',
17=>'PHP: Hypertext Preprocessor', 17=>'PHP: Hypertext Preprocessor',
5=>'Test', 5=>'Test',

View file

@ -2,12 +2,12 @@
class autoTest { class autoTest {
public static $bob = "bob"; public static $bob = "bob";
public function __get($name) { public function __get($name) {
echo "attempt to access $name\n"; echo "attempt to access $name\n";
return "foo"; return "foo";
} }
} }
?> ?>

View file

@ -1,29 +1,29 @@
<?php <?php
/* Header file for common file test functions /* Header file for common file test functions
Following functions are provided : Following functions are provided :
create_files() : create files with specified contents create_files() : create files with specified contents
delete_files() : delete files delete_files() : delete files
create_links() : crate links of different types create_links() : crate links of different types
delete_links() : delete links delete_links() : delete links
fill_files() : fill file with specified contents fill_files() : fill file with specified contents
change_file_perms() : Change permission of files change_file_perms() : Change permission of files
fill_buffer() : fills buffer with specified contents 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 stat with the corresponding named key values of
the same stat. the same stat.
compare_stats() : Compares two stat values compare_stats() : Compares two stat values
*/ */
define('file_not_found', 2, 1); define('file_not_found', 2, 1);
/* /*
Function: bool create_file(string $filename, string $mode = "w"); Function: bool create_file(string $filename, string $mode = "w");
Description: creates a new file using fopen() call Description: creates a new file using fopen() call
$filename = Name of the file $filename = Name of the file
$mode = Mode as specified in fopen call, read documentation of fopen() call for more info $mode = Mode as specified in fopen call, read documentation of fopen() call for more info
Returns: Returns:
true on success, false otherwise true on success, false otherwise
*/ */
function create_file($filename, $mode = "w") { 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); Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size);
Description: Fills the file with data as specified with requested size. Description: Fills the file with data as specified with requested size.
$file_handle = file handle, opened with write options, $file_handle = file handle, opened with write options,
$fill_type: $fill_type:
"text" = fills with string of size $file_size "text" = fills with string of size $file_size
"numeric" = fills with numeric value of size $file_size "numeric" = fills with numeric value of size $file_size
"empty" = no fill operation performed, returns true "empty" = no fill operation performed, returns true
"text_with_new_line" = similar to "text" fill type but writes with new line "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 Returns: true on success, false on failure & invalid fill type
*/ */
function fill_file($file_handle, $fill_type, $file_size) { function fill_file($file_handle, $fill_type, $file_size) {
if ( $fill_type == "empty" ) { if ( $fill_type == "empty" ) {
// no fill required, return true // no fill required, return true
return true; return true;
} if ( $fill_type == "text" ) { } if ( $fill_type == "text" ) {
$data = "text "; $data = "text ";
$size_divider = strlen($data); $size_divider = strlen($data);
$add_value = strlen($data); $add_value = strlen($data);
} else if ( $fill_type == "text_with_new_line" ) { } else if ( $fill_type == "text_with_new_line" ) {
$data = "line\nline of text\n"; $data = "line\nline of text\n";
@ -113,7 +113,7 @@ function fill_file($file_handle, $fill_type, $file_size) {
$data = 2; $data = 2;
$size_divider = 1; $size_divider = 1;
$add_value = 0; $add_value = 0;
} else { } else {
// invalid fill type; // invalid fill type;
return false; return false;
} }
@ -124,7 +124,7 @@ function fill_file($file_handle, $fill_type, $file_size) {
if ( $size > $chunk_size ) { if ( $size > $chunk_size ) {
$loop_count = 1; $loop_count = 1;
do { do {
$loop_count ++; $loop_count ++;
if ( $size <= $chunk_size ) { if ( $size <= $chunk_size ) {
$chunk_size = $size; $chunk_size = $size;
} }
@ -142,14 +142,14 @@ function fill_file($file_handle, $fill_type, $file_size) {
return false; return false;
} }
} }
// successful, return true // successful, return true
return true; return true;
} }
/* /*
Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755, Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755,
string $name_prefix = "file", string $name_prefix = "file",
string $name_suffix = 1, $file_extension = ".tmp"); string $name_suffix = 1, $file_extension = ".tmp");
Description: changes file permission for given file(s). Description: changes file permission for given file(s).
$file_path = dir path where file exists $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 $perms = new permission of the file, similar to $mode args of chmod() call
$name_prefix = common name prefix, default is "file" $name_prefix = common name prefix, default is "file"
$name_suffix = suffix to end the common name given in name_prefix to create $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 $file_extension = default is .tmp
Returns: Returns:
Integer, Count of total files permission changed. Integer, Count of total files permission changed.
*/ */
function change_file_perms($file_path, function change_file_perms($file_path,
$count = 1, $count = 1,
$perms = 0755, $perms = 0755,
$name_prefix = "file", $name_prefix = "file",
$name_suffix = 1, $name_suffix = 1,
$file_extension = ".tmp" ) $file_extension = ".tmp" )
{ {
$changed = 0; $changed = 0;
if( $count <= 0 ) if( $count <= 0 )
return $changed; return $changed;
if ( $name_suffix <= 0) if ( $name_suffix <= 0)
@ -182,34 +182,34 @@ function change_file_perms($file_path,
if( chmod($filename, $perms) ) if( chmod($filename, $perms) )
$changed++; $changed++;
$name_suffix++; $name_suffix++;
} }
return $changed; return $changed;
} }
/* /*
Function: array create_files( string $file_path, Function: array create_files( string $file_path,
int $count = 1, int $count = 1,
string $content_type = "numeric", string $content_type = "numeric",
int $permission = 0755, int $permission = 0755,
int $size = 1, int $size = 1,
string $mode = "w", string $mode = "w",
string $name_prefix = "file", string $name_prefix = "file",
int $name_suffix = 1, int $name_suffix = 1,
string $flag = "kilobytes" string $flag = "kilobytes"
string $file_extension = ".tmp" 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. permissions. File is filled with content of size specified.
$file_path = dir where files will be created $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 unqiue numeric value to make the file name unique, default = file
$name_suffix = suffix to be used for the name, default = 1 $name_suffix = suffix to be used for the name, default = 1
$count = total no. of files to be created, 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" modes used for only reading the file. Default = "w"
$permission = An octal number, This should be similar to $mode $permission = An octal number, This should be similar to $mode
specified in chmod() call. specified in chmod() call.
$content_type = Specify type of the content to fill in the file. $content_type = Specify type of the content to fill in the file.
"numeric" = fill file with numeric values "numeric" = fill file with numeric values
"text" = fill file with regular text "text" = fill file with regular text
"empty" = empty file "empty" = empty file
@ -218,16 +218,16 @@ function change_file_perms($file_path,
If imporper $content type is specified, file is created as empty 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. $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 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. multiple of KB.
"kilobytes" = take size in terms of 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 $file_extension = default is .tmp
Returns: Returns:
An array with following key value pair: An array with following key value pair:
created => total file created created => total file created
filled => total files filled filled => total files filled
perms_changed => total files permission changed perms_changed => total files permission changed
*/ */
function create_files( $file_path, function create_files( $file_path,
@ -253,7 +253,7 @@ function create_files( $file_path,
if ( $size == 0 ) if ( $size == 0 )
return $return_value; return $return_value;
// prepare the size based on flag // prepare the size based on flag
$file_size = $size; $file_size = $size;
if ( $flag == "kilobytes" ) { if ( $flag == "kilobytes" ) {
$file_size = $file_size * 1024; $file_size = $file_size * 1024;
@ -288,11 +288,11 @@ function create_files( $file_path,
fclose($file_handle); fclose($file_handle);
return $return_value; return $return_value;
} // end of if } // 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) ) if( fill_file($file_handle, $content_type, $file_size) )
$return_value['filled']++; $return_value['filled']++;
fclose($file_handle); fclose($file_handle);
$tmp_name_suffix++; $tmp_name_suffix++;
@ -300,9 +300,9 @@ function create_files( $file_path,
} }
// change all file's permissions // 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); $name_suffix, $file_extension);
return $return_value; return $return_value;
} }
@ -336,8 +336,8 @@ function create_files( $file_path,
alphanumeric = fill with alphanumeric text alphanumeric = fill with alphanumeric text
If imporper $content type is specified, file is created as empty 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. $size = size of the fill in terms of kilobyte, i.e size of the file.
$link_type = type of the link to be created $link_type = type of the link to be created
"soft" = soft link "soft" = soft link
"hard" = hard link "hard" = hard link
$filename = file used to create a link on $filename = file used to create a link on
@ -392,12 +392,12 @@ function create_links($file_path,
} }
break; break;
} }
if ( $link_file_content == "empty" ) { if ( $link_file_content == "empty" ) {
$return_value['filled'] = 1; $return_value['filled'] = 1;
return $return_value; return $return_value;
} }
// fill the file with specific type of data and size // fill the file with specific type of data and size
$tmp_name_suffix = $link_name_suffix; $tmp_name_suffix = $link_name_suffix;
$linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension; $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) { if($file_handle == false) {
return $return_value; return $return_value;
} // end of if } // 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) ) if( fill_file($file_handle, $link_file_content, $link_size) )
$return_value['filled']++; $return_value['filled']++;
@ -415,11 +415,11 @@ function create_links($file_path,
// change the permission of the link file, only if hard link. // change the permission of the link file, only if hard link.
// this is not applicable to soft links // this is not applicable to soft links
if( $link_type == "hard" ) { if( $link_type == "hard" ) {
$return_value['perms_changed'] = change_file_perms($file_path, $return_value['perms_changed'] = change_file_perms($file_path,
$link_count, $link_count,
$link_perms, $link_perms,
$link_name_prefix, $link_name_prefix,
$link_name_suffix, $link_name_suffix,
$link_file_extension ); $link_file_extension );
} }
@ -427,10 +427,10 @@ function create_links($file_path,
return $return_value; return $return_value;
} }
/* /*
Function: bool delete_file(string $filename); Function: bool delete_file(string $filename);
Description: delete a given file if exists Description: delete a given file if exists
Returns: true on success Returns: true on success
false on failure false on failure
file_not_found if file doesn't exist 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" ); int name_suffix = 1, $file_extension = ".tmp" );
Description: Deletes given number of files if exists. Description: Deletes given number of files if exists.
$file_path = location of the files $file_path = location of the files
@ -460,15 +460,15 @@ function delete_file($filename) {
failed = Count of failed to delete failed = Count of failed to delete
*/ */
function delete_files($file_path, function delete_files($file_path,
$count = 1, $count = 1,
$name_prefix = "file", $name_prefix = "file",
$name_suffix = 1, $name_suffix = 1,
$file_extension = ".tmp") $file_extension = ".tmp")
{ {
$return_value = array ('deleted' => 0, 'notfound' => 0, 'failed' => 0); $return_value = array ('deleted' => 0, 'notfound' => 0, 'failed' => 0);
if ( $name_suffix < 1 ) if ( $name_suffix < 1 )
$name_suffix = 1; $name_suffix = 1;
for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) { for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
$filename = $file_path."/".$name_prefix.$name_suffix.$file_extension; $filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
$name_suffix++; $name_suffix++;
@ -480,20 +480,20 @@ function delete_files($file_path,
} else { } else {
$return_value['failed']++; $return_value['failed']++;
} }
} // end of for } // end of for
return $return_value; return $return_value;
} }
/* /*
Function: array delete_links( $file_path, Function: array delete_links( $file_path,
$link_file_count, $link_file_count,
$link_name_prefix, $link_name_prefix,
$link_name_suffix, $link_name_suffix,
$link_file_extension ); $link_file_extension );
Description: Deletes given number of links if exists. Uses delete_files() function Description: Deletes given number of links if exists. Uses delete_files() function
$file_path = location of link files $file_path = location of link files
$link_file_count = Number 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) $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 numeric starting from $link_name_suffix up to count
$link_name_suffix = first numeric suffix in the name $link_name_suffix = first numeric suffix in the name
@ -504,16 +504,16 @@ function delete_files($file_path,
failed = Count of failed to delete failed = Count of failed to delete
*/ */
function delete_links($file_path, function delete_links($file_path,
$link_file_count = 1, $link_file_count = 1,
$link_name_prefix = "link", $link_name_prefix = "link",
$link_name_suffix = 1, $link_name_suffix = 1,
$link_file_extension = ".tmp") $link_file_extension = ".tmp")
{ {
// call the delete files to delete links // call the delete files to delete links
$return_value = delete_files( $file_path, $return_value = delete_files( $file_path,
$link_file_count, $link_file_count,
$link_name_prefix, $link_name_prefix,
$link_name_suffix, $link_name_suffix,
$link_file_extension ); $link_file_extension );
return $return_value; return $return_value;
} }
@ -524,7 +524,7 @@ function delete_links($file_path,
Prototype: Prototype:
function compare_self_stat( array $stat ); function compare_self_stat( array $stat );
Description: 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 corresponding next 13 values of the same stat for equality
$stat = stat array $stat = stat array
@ -536,7 +536,7 @@ function compare_self_stat( array $stat )
$return_value = true; $return_value = true;
// named keys present in a stat // 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", "rdev", "size", "atime", "mtime", "ctime",
"blksize", "blocks"); "blksize", "blocks");
@ -557,7 +557,7 @@ function compare_self_stat( array $stat )
} }
} // end of foreach } // 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 // dump the stat array so that its easy to figure out the error
if ($return_value == false ) { if ($return_value == false ) {
echo "\n Dumping stat array ...\n"; echo "\n Dumping stat array ...\n";
@ -569,7 +569,7 @@ function compare_self_stat( array $stat )
/* /*
Prototype: Prototype:
function compare_stats( array $stat1, array $stat2, array $fields, function compare_stats( array $stat1, array $stat2, array $fields,
[string $op = "==", [ bool $flag = false] ]); [string $op = "==", [ bool $flag = false] ]);
Description: Description:
Compares two stat values, stat value should be obtained by stat/lstat Compares two stat values, stat value should be obtained by stat/lstat
@ -580,12 +580,12 @@ Description:
"==" compare for equality "==" compare for equality
">" if each element of stat1 is > than stat2 ">" if each element of stat1 is > than stat2
"<" 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 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", "dev", "ino", "mode", "nlink", "uid", "gid",
"rdev", "size", "atime", "mtime", "ctime", "rdev", "size", "atime", "mtime", "ctime",
"blksize", "blocks"); "blksize", "blocks");
@ -599,8 +599,8 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
$result = true; $result = true;
// compare values of given key from each stat array // compare values of given key from each stat array
for($index = 0; $index < count($fields); $index++) for($index = 0; $index < count($fields); $index++)
{ {
switch( $op ) switch( $op )
{ {
@ -635,7 +635,7 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
break; 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 // dump the stat array so that easy to figure out the error
if ( $result == false ) { if ( $result == false ) {
echo "\n Dumping stat array 1...\n"; echo "\n Dumping stat array 1...\n";

View file

@ -9,7 +9,7 @@ function get_junction(){
// junction.exe isn't included with Windows // junction.exe isn't included with Windows
// its a sysinternals tool for working with filesystem links // its a sysinternals tool for working with filesystem links
// see: http://technet.microsoft.com/en-us/sysinternals/bb896768 // see: http://technet.microsoft.com/en-us/sysinternals/bb896768
// install somewhere that is on %path% or added to %path% // install somewhere that is on %path% or added to %path%
return "junction.exe"; return "junction.exe";
} }

View file

@ -109,21 +109,21 @@ function remove_data($id, $dir = NULL)
$objects = scandir($dir); $objects = scandir($dir);
foreach ($objects as $object) { foreach ($objects as $object) {
if ($object != "." && $object != "..") { if ($object != "." && $object != "..") {
if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir") if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir")
remove_data($id, $dir . DIRECTORY_SEPARATOR . $object); remove_data($id, $dir . DIRECTORY_SEPARATOR . $object);
else else
unlink($dir . DIRECTORY_SEPARATOR . $object); unlink($dir . DIRECTORY_SEPARATOR . $object);
} }
} }
reset($objects); reset($objects);
rmdir($dir); rmdir($dir);
} }
} }
function create_data($id, $item = "", $cp = 65001, $utf8 = true) function create_data($id, $item = "", $cp = 65001, $utf8 = true)
{ {
if ($utf8) { 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"; include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc";
return create_data_from_utf8($id, $item, $cp); return create_data_from_utf8($id, $item, $cp);
} else { } else {

View file

@ -3,46 +3,46 @@
$server = '{localhost}'; $server = '{localhost}';
$default_mailbox = $server . "INBOX"; $default_mailbox = $server . "INBOX";
$domain = "example.com"; $domain = "example.com";
$admin_user = "webmaster"; // a user with admin access $admin_user = "webmaster"; // a user with admin access
$username = "$admin_user@$domain"; $username = "$admin_user@$domain";
$password = 'p4ssw0rd'; $password = 'p4ssw0rd';
$users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids $users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids
$mailbox_prefix = "phpttest"; // name used for test mailbox $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 * @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 * @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"){ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
global $server, $default_mailbox, $username, $password; global $server, $default_mailbox, $username, $password;
// open a stream to default mailbox // open a stream to default mailbox
$imap_stream = imap_open($default_mailbox, $username, $password); $imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) { if ($imap_stream === false) {
echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n"; echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
return false; return false;
} }
echo "Create a temporary mailbox and add " . $message_count . " msgs\n"; echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
$new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type); $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
if ($new_mailbox === false) { if ($new_mailbox === false) {
echo "Cant create a temporary mailbox: " . imap_last_error(). "\n"; echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
return false; return false;
} }
echo ".. mailbox '$new_mailbox' created\n"; echo ".. mailbox '$new_mailbox' created\n";
// reopen stream to new mailbox // reopen stream to new mailbox
if (imap_reopen($imap_stream, $new_mailbox) === false) { if (imap_reopen($imap_stream, $new_mailbox) === false) {
echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n"; echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
return false; return false;
} }
return $imap_stream; 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"){ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
global $default_mailbox, $mailbox_prefix; global $default_mailbox, $mailbox_prefix;
$mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix; $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
$mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*'); $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
// check mailbox does not already exist // check mailbox does not already exist
if ($mailboxes) { if ($mailboxes) {
foreach($mailboxes as $value) { 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"); exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
} }
} }
} }
if (imap_createmailbox($imap_stream, $mailbox) === false) { if (imap_createmailbox($imap_stream, $mailbox) === false) {
return false; return false;
} }
// Add number of test msgs requested // Add number of test msgs requested
if ($message_count > 0) { if ($message_count > 0) {
populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type); populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
} }
return $mailbox; return $mailbox;
} }
@ -100,42 +100,42 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
$envelope["from"]= "foo@anywhere.com"; $envelope["from"]= "foo@anywhere.com";
$envelope["to"] = "$users[0]@$domain"; $envelope["to"] = "$users[0]@$domain";
$envelope["subject"] = "Test msg $i"; $envelope["subject"] = "Test msg $i";
$part1["type"] = TYPEMULTIPART; $part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed"; $part1["subtype"] = "mixed";
$part2["type"] = TYPETEXT; $part2["type"] = TYPETEXT;
$part2["subtype"] = "plain"; $part2["subtype"] = "plain";
$part2["description"] = "imap_mail_compose() function"; $part2["description"] = "imap_mail_compose() function";
$part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx"; $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
$part3["type"] = TYPETEXT; $part3["type"] = TYPETEXT;
$part3["subtype"] = "plain"; $part3["subtype"] = "plain";
$part3["description"] = "Example"; $part3["description"] = "Example";
$part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"; $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
$part4["type"] = TYPETEXT; $part4["type"] = TYPETEXT;
$part4["subtype"] = "plain"; $part4["subtype"] = "plain";
$part4["description"] = "Return Values"; $part4["description"] = "Return Values";
$part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz"; $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
$body[1] = $part1; $body[1] = $part1;
$body[2] = $part2; $body[2] = $part2;
$body[3] = $part3; $body[3] = $part3;
$body[4] = $part4; $body[4] = $part4;
$msg = imap_mail_compose($envelope, $body); $msg = imap_mail_compose($envelope, $body);
} }
imap_append($imap_stream, $mailbox, $msg); 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 * @param string mailbox complete mailbox name
* @return mailbox name * @return mailbox name
*/ */
function get_mailbox_name($mailbox){ function get_mailbox_name($mailbox){

View file

@ -10,7 +10,7 @@ if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
// imap uses tcp port 143 // imap uses tcp port 143
socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server"); socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
} }
// Change these to make tests run successfully // Change these to make tests run successfully
$mailbox = '{localhost}'; $mailbox = '{localhost}';
$username = 'webmaster@example.com'; $username = 'webmaster@example.com';

View file

@ -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 */ /* gotcha */
return $php_path."/cgi/php-cgi"; return $php_path."/cgi/php-cgi";
} }

View file

@ -437,12 +437,12 @@ class Client
/** /**
* Execute a request to the FastCGI application asyncronously * Execute a request to the FastCGI application asyncronously
* *
* This sends request to application and returns the assigned ID for that request. * 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 * 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. * 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 * invocation comes back on this socket and is mistaken for response to request made with same ID
* during this request. * during this request.
* *
@ -502,7 +502,7 @@ class Client
/** /**
* Blocking call that waits for response to specific request * Blocking call that waits for response to specific request
* *
* @param Integer $requestId * @param Integer $requestId
* @param Integer $timeoutMs [optional] the number of milliseconds to wait. Defaults to the ReadWriteTimeout value set. * @param Integer $timeoutMs [optional] the number of milliseconds to wait. Defaults to the ReadWriteTimeout value set.
* @return string response body * @return string response body
@ -542,7 +542,7 @@ class Client
} }
if ($resp['type'] == self::END_REQUEST) { if ($resp['type'] == self::END_REQUEST) {
$this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_OK; $this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_OK;
if ($resp['requestId'] == $requestId) { if ($resp['requestId'] == $requestId) {
break; break;
} }
} }

View file

@ -64,7 +64,7 @@ function run_fpm($config, &$out = false, $extra_args = '') /* {{{ */
function test_fpm_conf($config, &$msg = NULL) { /* {{{ */ function test_fpm_conf($config, &$msg = NULL) { /* {{{ */
$cfg = dirname(__FILE__).'/test-fpm-config.tmp'; $cfg = dirname(__FILE__).'/test-fpm-config.tmp';
file_put_contents($cfg, $config); 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) { if ($code) {
$msg = preg_replace("/\[.+?\]/", "", $output[0]); $msg = preg_replace("/\[.+?\]/", "", $output[0]);
return false; return false;

View file

@ -1,5 +1,5 @@
<?php <?php
class A { class A {
const MY_CONST = "hello from A"; const MY_CONST = "hello from A";
} }
?> ?>

View file

@ -1,4 +1,4 @@
<?php <?php
interface I { interface I {
function f($a = null); function f($a = null);
} }

View file

@ -1,3 +1,3 @@
<?php <?php
echo "Hello"; echo "Hello";
?> ?>

View file

@ -1,4 +1,4 @@
<?php <?php
function MyFunc ($a) { function MyFunc ($a) {
echo $a; echo $a;
} }

View file

@ -10,11 +10,11 @@
?> ?>
*** Testing assignments and variable aliasing: ***<br> *** Testing assignments and variable aliasing: ***<br>
<?php <?php
/* This test tests assignments to variables using other variables as variable-names */ /* This test tests assignments to variables using other variables as variable-names */
$a = "b"; $a = "b";
$$a = "test"; $$a = "test";
$$$a = "blah"; $$$a = "blah";
${$$$a}["associative arrays work too"] = "this is nifty"; ${$$$a}["associative arrays work too"] = "this is nifty";
?> ?>
This should read "blah": <?php echo "$test<br>\n"; ?> 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> *************************************************<br>
*** Testing integer operators ***<br> *** Testing integer operators ***<br>
<?php <?php
/* test just about any operator possible on $i and $j (ints) */ /* test just about any operator possible on $i and $j (ints) */
$i = 5; $i = 5;
$j = 3; $j = 3;
@ -38,7 +38,7 @@ Correct result - 3: <?php echo $j%$i; ?><br>
*********************************<br> *********************************<br>
*** Testing real operators ***<br> *** Testing real operators ***<br>
<?php <?php
/* test just about any operator possible on $i and $j (floats) */ /* test just about any operator possible on $i and $j (floats) */
$i = 5.0; $i = 5.0;
$j = 3.0; $j = 3.0;
@ -55,7 +55,7 @@ Correct result - 3: <?php echo $j%$i; ?><br>
*** Testing if/elseif/else control ***<br> *** Testing if/elseif/else control ***<br>
<?php <?php
/* sick if/elseif/else test by Andi :) */ /* sick if/elseif/else test by Andi :) */
$a = 5; $a = 5;
if ($a == "4") { if ($a == "4") {
@ -90,7 +90,7 @@ if ($a == "4") {
*** Seriously nested if's test ***<br> *** Seriously nested if's test ***<br>
** spelling correction by kluzz ** ** spelling correction by kluzz **
<?php <?php
/* yet another sick if/elseif/else test by Zeev */ /* yet another sick if/elseif/else test by Zeev */
$i=$j=0; $i=$j=0;
echo "Only two lines of text should follow:<br>\n"; 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"; echo "hmm, this shouldn't be displayed #1<br>\n";
$j++; $j++;
if (1) { if (1) {
$i $i
+= +=
$j; $j;
if (0) { 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 */ } elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
$i = ++$j; $i = ++$j;
echo "hmm, this shouldn't be displayed #2<br>\n"; echo "hmm, this shouldn't be displayed #2<br>\n";
if (1) { if (1) {
$j = ++$i; $j = ++$i;
if (0) { if (0) {
$j = $i*2+$j*($i++); $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> *** C-style else-if's ***<br>
<?php <?php
/* looks like without we even tried, C-style else-if structure works fine! */ /* looks like without we even tried, C-style else-if structure works fine! */
if ($a=0) { if ($a=0) {
echo "This shouldn't be displayed<br>\n"; echo "This shouldn't be displayed<br>\n";
@ -199,7 +199,7 @@ if (0) { /* this code is not supposed to be executed */
*************************<br> *************************<br>
*** WHILE tests ***<br> *** WHILE tests ***<br>
<?php <?php
$i=0; $i=0;
$j=20; $j=20;
while ($i<(2*$j)) { while ($i<(2*$j)) {
@ -217,7 +217,7 @@ while ($i<(2*$j)) {
*** Nested WHILEs ***<br> *** Nested WHILEs ***<br>
<?php <?php
$arr_len=3; $arr_len=3;
$i=0; $i=0;
@ -253,7 +253,7 @@ while ($i<$arr_len) {
*********************<br> *********************<br>
*** hash test... ***<br> *** hash test... ***<br>
<?php <?php
/* /*
$i=0; $i=0;
@ -273,7 +273,7 @@ echo "commented out...";
**************************<br> **************************<br>
*** Hash resizing test ***<br> *** Hash resizing test ***<br>
<?php <?php
$i = 10; $i = 10;
$a = 'b'; $a = 'b';
while ($i > 0) { while ($i > 0) {
@ -295,7 +295,7 @@ while ($i > 0) {
*** break/continue test ***<br> *** break/continue test ***<br>
<?php <?php
$i=0; $i=0;
echo "\$i should go from 0 to 2<br>\n"; echo "\$i should go from 0 to 2<br>\n";
@ -349,7 +349,7 @@ while ($i<5) {
<?php include("023-2.inc"); ?> <?php include("023-2.inc"); ?>
********************************<br> ********************************<br>
<?php <?php
{ {
echo "Tests completed.<br>\n"; # testing some PHP style comment... echo "Tests completed.<br>\n"; # testing some PHP style comment...
} }

View file

@ -1,5 +1,5 @@
<html> <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. from regression_test.phtml. This is normal HTML.
<?php echo "and this is PHP code, 2+2=".(2+2).""; ?> <?php echo "and this is PHP code, 2+2=".(2+2).""; ?>

View file

@ -5,7 +5,7 @@ date.timezone=UTC
--FILE-- --FILE--
PHP Regression Test PHP Regression Test
<?php <?php
include("023-1.inc"); include("023-1.inc");
@ -246,7 +246,7 @@ $i=2<br>
*** Nested file include test ***<br> *** Nested file include test ***<br>
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Looped regression test (may take a while) Looped regression test (may take a while)
--FILE-- --FILE--
<?php <?php
for ($jdk=0; $jdk<50; $jdk++) { for ($jdk=0; $jdk<50; $jdk++) {
?><html> ?><html>
<head> <head>
@ -11,11 +11,11 @@ for ($jdk=0; $jdk<50; $jdk++) {
*/ */
?> ?>
*** Testing assignments and variable aliasing: *** *** Testing assignments and variable aliasing: ***
<?php <?php
/* This test tests assignments to variables using other variables as variable-names */ /* This test tests assignments to variables using other variables as variable-names */
$a = "b"; $a = "b";
$$a = "test"; $$a = "test";
$$$a = "blah"; $$$a = "blah";
${$$$a}["associative arrays work too"] = "this is nifty"; ${$$$a}["associative arrays work too"] = "this is nifty";
?> ?>
This should read "blah": <?php echo "$test\n"; ?> 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 *** *** Testing integer operators ***
<?php <?php
/* test just about any operator possible on $i and $j (ints) */ /* test just about any operator possible on $i and $j (ints) */
$i = 5; $i = 5;
$j = 3; $j = 3;
@ -47,7 +47,7 @@ Correct result - 3: <?php echo $j%$i; ?>
********************************* *********************************
*** Testing real operators *** *** Testing real operators ***
<?php <?php
/* test just about any operator possible on $i and $j (floats) */ /* test just about any operator possible on $i and $j (floats) */
$i = 5.0; $i = 5.0;
$j = 3.0; $j = 3.0;
@ -72,7 +72,7 @@ Correct result - 3: <?php echo $j%$i; ?>
*** Testing if/elseif/else control *** *** Testing if/elseif/else control ***
<?php <?php
/* sick if/elseif/else test by Andi :) */ /* sick if/elseif/else test by Andi :) */
$a = 5; $a = 5;
if ($a == "4") { if ($a == "4") {
@ -107,7 +107,7 @@ if ($a == "4") {
*** Seriously nested if's test *** *** Seriously nested if's test ***
** spelling correction by kluzz ** ** spelling correction by kluzz **
<?php <?php
/* yet another sick if/elseif/else test by Zeev */ /* yet another sick if/elseif/else test by Zeev */
$i=$j=0; $i=$j=0;
echo "Only two lines of text should follow:\n"; 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 */ } elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
$i = ++$j; $i = ++$j;
echo "hmm, this shouldn't be displayed #2\n"; echo "hmm, this shouldn't be displayed #2\n";
if (1) { if (1) {
$j = ++$i; $j = ++$i;
if (0) { if (0) {
$j = $i*2+$j*($i++); $j = $i*2+$j*($i++);
@ -197,7 +197,7 @@ if (0) { /* this code is not supposed to be executed */
?> ?>
*** C-style else-if's *** *** C-style else-if's ***
<?php <?php
/* looks like without we even tried, C-style else-if structure works fine! */ /* looks like without we even tried, C-style else-if structure works fine! */
if ($a=0) { if ($a=0) {
echo "This shouldn't be displayed\n"; echo "This shouldn't be displayed\n";
@ -214,7 +214,7 @@ if (0) { /* this code is not supposed to be executed */
************************* *************************
*** WHILE tests *** *** WHILE tests ***
<?php <?php
$i=0; $i=0;
$j=20; $j=20;
while ($i<(2*$j)) { while ($i<(2*$j)) {
@ -232,7 +232,7 @@ while ($i<(2*$j)) {
*** Nested WHILEs *** *** Nested WHILEs ***
<?php <?php
$arr_len=3; $arr_len=3;
$i=0; $i=0;
@ -268,7 +268,7 @@ while ($i<$arr_len) {
********************* *********************
*** hash test... *** *** hash test... ***
<?php <?php
/* /*
$i=0; $i=0;
@ -288,7 +288,7 @@ echo "commented out...";
************************** **************************
*** Hash resizing test *** *** Hash resizing test ***
<?php <?php
$i = 10; $i = 10;
$a = "b"; $a = "b";
while ($i > 0) { while ($i > 0) {
@ -310,7 +310,7 @@ while ($i > 0) {
*** break/continue test *** *** break/continue test ***
<?php <?php
$i=0; $i=0;
echo "\$i should go from 0 to 2\n"; echo "\$i should go from 0 to 2\n";
@ -364,7 +364,7 @@ while ($i<5) {
<?php include("023-2.inc"); ?> <?php include("023-2.inc"); ?>
******************************** ********************************
<?php <?php
{ {
echo "Tests completed.\n"; # testing some PHP style comment... echo "Tests completed.\n"; # testing some PHP style comment...
} }
@ -589,7 +589,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -814,7 +814,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -1039,7 +1039,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -1264,7 +1264,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -1489,7 +1489,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -1714,7 +1714,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -1939,7 +1939,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -2164,7 +2164,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -2389,7 +2389,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -2614,7 +2614,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -2839,7 +2839,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -3064,7 +3064,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -3289,7 +3289,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -3514,7 +3514,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -3739,7 +3739,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -3964,7 +3964,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -4189,7 +4189,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -4414,7 +4414,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -4639,7 +4639,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -4864,7 +4864,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -5089,7 +5089,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -5314,7 +5314,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -5539,7 +5539,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -5764,7 +5764,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -5989,7 +5989,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -6214,7 +6214,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -6439,7 +6439,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -6664,7 +6664,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -6889,7 +6889,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -7114,7 +7114,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -7339,7 +7339,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -7564,7 +7564,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -7789,7 +7789,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -8014,7 +8014,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -8239,7 +8239,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -8464,7 +8464,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -8689,7 +8689,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -8914,7 +8914,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -9139,7 +9139,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -9364,7 +9364,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -9589,7 +9589,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -9814,7 +9814,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -10039,7 +10039,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -10264,7 +10264,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -10489,7 +10489,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -10714,7 +10714,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -10939,7 +10939,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -11164,7 +11164,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -11389,7 +11389,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>
@ -11614,7 +11614,7 @@ $i=2
*** Nested file include test *** *** Nested file include test ***
<html> <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. from regression_test.phtml. This is normal HTML.
and this is PHP code, 2+2=4 and this is PHP code, 2+2=4
</html> </html>

View file

@ -15,7 +15,7 @@ TESTS;
Remember to NOT put a trailing ; after a line! Remember to NOT put a trailing ; after a line!
*/ */
error_reporting(E_ALL); error_reporting(E_ALL);
$tests = explode("\n",$tests); $tests = explode("\n",$tests);
$success = TRUE; $success = TRUE;
foreach ($tests as $n=>$test) foreach ($tests as $n=>$test)
@ -72,4 +72,4 @@ foreach ($tests as $n=>$test)
} }
} }
if ($success) echo "OK"; if ($success) echo "OK";

View file

@ -3,7 +3,7 @@
// This file contains helper functions for testing open_basedir configuration // This file contains helper functions for testing open_basedir configuration
// Care must be taken with where the directories are created because different // Care must be taken with where the directories are created because different
// SAPIs set the working directory differently. So simply creating a directory // 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..! // 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 // 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 // Make sure the directory is valid
if (is_dir($directory) == FALSE) { if (is_dir($directory) == FALSE) {
return FALSE; return FALSE;
} }
// Check we can access the directory // Check we can access the directory
if (is_readable($directory) == FALSE) { if (is_readable($directory) == FALSE) {
@ -110,7 +110,7 @@ function test_open_basedir_array($function) {
global $savedDirectory; global $savedDirectory;
test_open_basedir_before($function); 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("./../.")));
var_dump(is_array($function("../ok"))); var_dump(is_array($function("../ok")));
var_dump(is_array($function("ok.txt"))); var_dump(is_array($function("ok.txt")));
@ -124,7 +124,7 @@ function test_open_basedir_array($function) {
function test_open_basedir($function) { function test_open_basedir($function) {
global $savedDirectory; global $savedDirectory;
test_open_basedir_before($function); test_open_basedir_before($function);
test_open_basedir_error($function); test_open_basedir_error($function);
var_dump($function("./../.")); var_dump($function("./../."));
var_dump($function("../ok")); var_dump($function("../ok"));
var_dump($function("ok.txt")); var_dump($function("ok.txt"));