import zend iconv tests
Esse commit está contido em:
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
|
||||
$options = array(
|
||||
'scheme' => 'Q',
|
||||
'input-charset' => 'UTF-8',
|
||||
'output-charset' => 'UTF-8',
|
||||
'line-length' => 30,
|
||||
);
|
||||
|
||||
echo iconv_mime_encode('Subject', $text, $options);
|
||||
@@ -0,0 +1,6 @@
|
||||
Subject: =?UTF-8?Q?=E3=83=86?=
|
||||
=?UTF-8?Q?=E3=82=B9?=
|
||||
=?UTF-8?Q?=E3=83=88?=
|
||||
=?UTF-8?Q?=E3=83=86?=
|
||||
=?UTF-8?Q?=E3=82=B9?=
|
||||
=?UTF-8?Q?=E3=83=88?=
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$m = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
|
||||
var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?B?Kg==?= .", $m));
|
||||
var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?Q?*?= .", $m));
|
||||
var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?B?".chr(0xA1)."?= .", $m));
|
||||
var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?Q?".chr(0xA1)."?= .", $m));
|
||||
|
||||
var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?B?Kg==?= ."));
|
||||
var_dump(iconv_mime_decode("Legal encoded-word: =?utf-8?Q?*?= ."));
|
||||
var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?B?".chr(0xA1)."?= ."));
|
||||
var_dump(iconv_mime_decode("Illegal encoded-word: =?utf-8?Q?".chr(0xA1)."?= ."));
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
string(23) "Legal encoded-word: * ."
|
||||
string(23) "Legal encoded-word: * ."
|
||||
string(24) "Illegal encoded-word: ."
|
||||
string(23) "Illegal encoded-word: ."
|
||||
string(23) "Legal encoded-word: * ."
|
||||
string(23) "Legal encoded-word: * ."
|
||||
string(24) "Illegal encoded-word: ."
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$str = "PATHOLOGIES MÉDICO-CHIRUR. ADUL. PL";
|
||||
$str_iconv = iconv('CP850', 'ISO-8859-1', $str );
|
||||
var_dump($str_iconv);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$headers = <<<HEADERS
|
||||
From: =?UTF-8?B?PGZvb0BleGFtcGxlLmNvbT4=?=
|
||||
Subject: =?ks_c_5601-1987?B?UkU6odk=?=
|
||||
X-Foo: =?ks_c_5601-1987?B?UkU6odk=?= Foo
|
||||
X-Bar: =?ks_c_5601-1987?B?UkU6odk=?= =?UTF-8?Q?Foo?=
|
||||
To: <test@example.com>
|
||||
HEADERS;
|
||||
|
||||
$decoded = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
|
||||
|
||||
var_dump($decoded['From']);
|
||||
var_dump($decoded['Subject']);
|
||||
var_dump($decoded['X-Foo']);
|
||||
var_dump($decoded['X-Bar']);
|
||||
var_dump($decoded['To']);
|
||||
|
||||
$decoded = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR | ICONV_MIME_DECODE_STRICT, 'UTF-8');
|
||||
|
||||
var_dump($decoded['From']);
|
||||
var_dump($decoded['Subject']);
|
||||
var_dump($decoded['X-Foo']);
|
||||
var_dump($decoded['X-Bar']);
|
||||
var_dump($decoded['To']);
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
string(17) "<foo@example.com>"
|
||||
string(%d) "%s"
|
||||
string(%d) "%sFoo"
|
||||
string(%d) "%sFoo"
|
||||
string(18) "<test@example.com>"
|
||||
string(17) "<foo@example.com>"
|
||||
string(%d) "%s"
|
||||
string(%d) "%sFoo"
|
||||
string(%d) "%sFoo"
|
||||
string(18) "<test@example.com>"
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/* Prototype : mixed iconv_get_encoding([string type])
|
||||
* Description: Get internal encoding and output encoding for ob_iconv_handler()
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test Error functionality of iconv_get_encoding
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_get_encoding() : error functionality ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
Nothing
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $encoding argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// invalid string data
|
||||
/*18*/ "Nothing",
|
||||
'Nothing',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of mb_regex_encoding()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_get_encoding($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_get_encoding() : error functionality ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/* Prototype : array iconv_mime_decode_headers(string headers [, int mode, string charset])
|
||||
* Description: Decodes multiple mime header fields
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode_headers() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode_headers() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$headers = <<<EOF
|
||||
Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=
|
||||
To: example@example.com
|
||||
Date: Thu, 1 Jan 1970 00:00:00 +0000
|
||||
Message-Id: <example@example.com>
|
||||
Received: from localhost (localhost [127.0.0.1]) by localhost
|
||||
with SMTP id example for <example@example.com>;
|
||||
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
|
||||
(envelope-from example-return-0000-example=example.com@example.com)
|
||||
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
|
||||
|
||||
EOF;
|
||||
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'ISO-8859-1';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode_headers()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_mime_decode_headers($input, $mode, $charset));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,98 @@
|
||||
*** Testing iconv_mime_decode_headers() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 2 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 3 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 17 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 18 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 19 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 20 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 21 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 22 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 23 --
|
||||
array(0) {
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/* Prototype : array iconv_mime_decode_headers(string headers [, int mode, string charset])
|
||||
* Description: Decodes multiple mime header fields
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode_headers() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode_headers() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$headers = <<<EOF
|
||||
Subject: =?UTF-8?B?QSBTYW1wbGUgVGVzdA==?=
|
||||
To: example@example.com
|
||||
Date: Thu, 1 Jan 1970 00:00:00 +0000
|
||||
Message-Id: <example@example.com>
|
||||
Received: from localhost (localhost [127.0.0.1]) by localhost
|
||||
with SMTP id example for <example@example.com>;
|
||||
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
|
||||
(envelope-from example-return-0000-example=example.com@example.com)
|
||||
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
|
||||
|
||||
EOF;
|
||||
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'UTF-8';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode_headers()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_mime_decode_headers($headers, $input, $charset));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,353 @@
|
||||
*** Testing iconv_mime_decode_headers() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 2 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 3 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 23 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/* Prototype : array iconv_mime_decode_headers(string headers [, int mode, string charset])
|
||||
* Description: Decodes multiple mime header fields
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode_headers() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode_headers() : usage variations ***\n";
|
||||
|
||||
// Some of the parameters actually passed to charset will request to use
|
||||
// a default charset determined by the platform. In order for this test to
|
||||
// run on both linux and windows, the subject will have to be ascii only.
|
||||
// Initialise function arguments not being substituted
|
||||
$headers = <<<EOF
|
||||
Subject: =?UTF-8?B?QSBTYW1wbGUgVGVzdA==?=
|
||||
To: example@example.com
|
||||
Date: Thu, 1 Jan 1970 00:00:00 +0000
|
||||
Message-Id: <example@example.com>
|
||||
Received: from localhost (localhost [127.0.0.1]) by localhost
|
||||
with SMTP id example for <example@example.com>;
|
||||
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
|
||||
(envelope-from example-return-0000-example=example.com@example.com)
|
||||
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
|
||||
|
||||
EOF;
|
||||
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'UTF-8';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode_headers()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_mime_decode_headers($headers, $input, $charset));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,353 @@
|
||||
*** Testing iconv_mime_decode_headers() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 2 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 3 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 23 --
|
||||
array(5) {
|
||||
["Subject"]=>
|
||||
string(13) "A Sample Test"
|
||||
["To"]=>
|
||||
string(19) "example@example.com"
|
||||
["Date"]=>
|
||||
string(30) "Thu, 1 Jan 1970 00:00:00 +0000"
|
||||
["Message-Id"]=>
|
||||
string(21) "<example@example.com>"
|
||||
["Received"]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(204) "from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)"
|
||||
[1]=>
|
||||
string(57) "(qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000"
|
||||
}
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/* Prototype : string iconv_mime_decode(string encoded_string [, int mode, string charset])
|
||||
* Description: Decodes a mime header field
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$header = b'Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=';
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'ISO-8859-1';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_mime_decode($input, $mode, $charset));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_mime_decode() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
string(1) "0"
|
||||
|
||||
-- Iteration 2 --
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 3 --
|
||||
string(5) "12345"
|
||||
|
||||
-- Iteration 4 --
|
||||
string(5) "-2345"
|
||||
|
||||
-- Iteration 5 --
|
||||
string(4) "10.5"
|
||||
|
||||
-- Iteration 6 --
|
||||
string(5) "-10.5"
|
||||
|
||||
-- Iteration 7 --
|
||||
string(12) "123456789000"
|
||||
|
||||
-- Iteration 8 --
|
||||
string(13) "1.23456789E-9"
|
||||
|
||||
-- Iteration 9 --
|
||||
string(3) "0.5"
|
||||
|
||||
-- Iteration 10 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 11 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 12 --
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 13 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 14 --
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 15 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 16 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 17 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 18 --
|
||||
string(6) "string"
|
||||
|
||||
-- Iteration 19 --
|
||||
string(6) "string"
|
||||
|
||||
-- Iteration 20 --
|
||||
string(11) "hello world"
|
||||
|
||||
-- Iteration 21 --
|
||||
string(14) "Class A object"
|
||||
|
||||
-- Iteration 22 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 23 --
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/* Prototype : string iconv_mime_decode(string encoded_string [, int mode, string charset])
|
||||
* Description: Decodes a mime header field
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$header = b'Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=';
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'UTF-8';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( bin2hex(iconv_mime_decode($header, $input, $charset)));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,81 @@
|
||||
*** Testing iconv_mime_decode() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 2 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 3 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 4 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 5 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 6 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 7 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 8 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 9 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 10 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 11 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 12 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 13 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 14 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 15 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 16 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 17 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 22 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 23 --
|
||||
string(52) "5375626a6563743a205072c3bc66756e67205072c3bc66756e67"
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
string(0) ""
|
||||
Done
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/* Prototype : string iconv_mime_decode(string encoded_string [, int mode, string charset])
|
||||
* Description: Decodes a mime header field
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types to $str argument to see how iconv_mime_decode() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_mime_decode() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
// Some of the parameters actually passed to charset will request to use
|
||||
// a default charset determined by the platform. In order for this test to
|
||||
// run on both linux and windows, the subject will have to be ascii only.
|
||||
$header = b'Subject: =?UTF-8?B?QSBTYW1wbGUgVGVzdA==?=';
|
||||
$mode = ICONV_MIME_DECODE_CONTINUE_ON_ERROR;
|
||||
$charset = 'UTF-8';
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_mime_decode()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
$res = iconv_mime_decode($header, $mode, $input);
|
||||
if ($res !== false) {
|
||||
var_dump(bin2hex($res));
|
||||
}
|
||||
else {
|
||||
var_dump($res);
|
||||
}
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,90 @@
|
||||
*** Testing iconv_mime_decode() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 11 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 12 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 14 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 16 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 17 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 23 --
|
||||
string(44) "5375626a6563743a20412053616d706c652054657374"
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/* Prototype : bool iconv_set_encoding(string type, string charset)
|
||||
* Description: Sets internal encoding and output encoding for ob_iconv_handler()
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test Error functionality of iconv_get_encoding
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_set_encoding() : error functionality ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
Nothing
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $encoding argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// invalid string data
|
||||
/*18*/ "Nothing",
|
||||
'Nothing',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of mb_regex_encoding()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_set_encoding($input, "UTF-8") );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_set_encoding() : error functionality ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
Done
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/* Prototype : bool iconv_set_encoding(string type, string charset)
|
||||
* Description: Sets internal encoding and output encoding for ob_iconv_handler()
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test Error functionality of iconv_get_encoding
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_set_encoding() : error functionality ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
Nothing
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $encoding argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// invalid string data
|
||||
/*18*/ "Nothing",
|
||||
'Nothing',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of mb_regex_encoding()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_set_encoding("internal_encoding", $input) );
|
||||
var_dump( iconv_set_encoding("input_encoding", $input) );
|
||||
var_dump( iconv_set_encoding("output_encoding", $input) );
|
||||
var_dump( iconv_get_encoding("internal_encoding") );
|
||||
var_dump( iconv_get_encoding("input_encoding") );
|
||||
var_dump( iconv_get_encoding("output_encoding") );
|
||||
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,197 @@
|
||||
*** Testing iconv_set_encoding() : error functionality ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
string(1) "0"
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(5) "12345"
|
||||
string(5) "12345"
|
||||
string(5) "12345"
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(5) "-2345"
|
||||
string(5) "-2345"
|
||||
string(5) "-2345"
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(4) "10.5"
|
||||
string(4) "10.5"
|
||||
string(4) "10.5"
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(5) "-10.5"
|
||||
string(5) "-10.5"
|
||||
string(5) "-10.5"
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(12) "123456789000"
|
||||
string(12) "123456789000"
|
||||
string(12) "123456789000"
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(13) "1.23456789E-9"
|
||||
string(13) "1.23456789E-9"
|
||||
string(13) "1.23456789E-9"
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
string(3) "0.5"
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
string(1) "1"
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
string(7) "Nothing"
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(5) "UTF-8"
|
||||
string(5) "UTF-8"
|
||||
string(5) "UTF-8"
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
Done
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strlen(string str [, string charset])
|
||||
* Description: Get character numbers of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strlen an incorrect number of arguments to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strlen() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing iconv_strlen() function with Zero arguments --\n";
|
||||
var_dump( iconv_strlen() );
|
||||
|
||||
//Test iconv_strlen with one more than the expected number of arguments
|
||||
echo "\n-- Testing iconv_strlen() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$encoding = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( iconv_strlen($str, $encoding, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
@@ -0,0 +1,10 @@
|
||||
*** Testing iconv_strlen() : error conditions ***
|
||||
|
||||
-- Testing iconv_strlen() function with Zero arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Testing iconv_strlen() function with more than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strlen(string str [, string charset])
|
||||
* Description: Get character numbers of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test iconv_strlen when passed an unknown encoding
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strlen() : error ***\n";
|
||||
|
||||
$string = 'abcdef';
|
||||
|
||||
$encoding = 'unknown-encoding';
|
||||
|
||||
var_dump(iconv_strlen($string, $encoding));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
@@ -0,0 +1,4 @@
|
||||
*** Testing iconv_strlen() : error ***
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strlen(string str [, string charset])
|
||||
* Description: Get character numbers of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test iconv_strlen by passing different data types as $str argument
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strlen() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $str argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -12345,
|
||||
|
||||
// float data
|
||||
/*5*/
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float 12.3456789000e-10' => 12.3456789000e-10,
|
||||
'float .5' => .5,
|
||||
|
||||
// null data
|
||||
/*10*/
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
/*12*/
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// string data
|
||||
/*18*/
|
||||
'string DQ' => "string",
|
||||
'string SQ' => 'string',
|
||||
'mixed case string' => "sTrInG",
|
||||
'heredoc' => $heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/
|
||||
'instance of class' => new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strlen()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $key =>$value) {
|
||||
echo "\n--$key--\n";
|
||||
var_dump( iconv_strlen($value, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
@@ -0,0 +1,78 @@
|
||||
*** Testing iconv_strlen() : usage variations ***
|
||||
|
||||
--int 0--
|
||||
int(1)
|
||||
|
||||
--int 1--
|
||||
int(1)
|
||||
|
||||
--int 12345--
|
||||
int(5)
|
||||
|
||||
--int -12345--
|
||||
int(6)
|
||||
|
||||
--float 10.5--
|
||||
int(4)
|
||||
|
||||
--float -10.5--
|
||||
int(5)
|
||||
|
||||
--float 12.3456789000e10--
|
||||
int(12)
|
||||
|
||||
--float 12.3456789000e-10--
|
||||
int(13)
|
||||
|
||||
--float .5--
|
||||
int(3)
|
||||
|
||||
--uppercase NULL--
|
||||
int(0)
|
||||
|
||||
--lowercase null--
|
||||
int(0)
|
||||
|
||||
--lowercase true--
|
||||
int(1)
|
||||
|
||||
--lowercase false--
|
||||
int(0)
|
||||
|
||||
--uppercase TRUE--
|
||||
int(1)
|
||||
|
||||
--uppercase FALSE--
|
||||
int(0)
|
||||
|
||||
--empty string DQ--
|
||||
int(0)
|
||||
|
||||
--empty string SQ--
|
||||
int(0)
|
||||
|
||||
--string DQ--
|
||||
int(6)
|
||||
|
||||
--string SQ--
|
||||
int(6)
|
||||
|
||||
--mixed case string--
|
||||
int(6)
|
||||
|
||||
--heredoc--
|
||||
int(11)
|
||||
|
||||
--instance of class--
|
||||
int(14)
|
||||
|
||||
--undefined var--
|
||||
int(0)
|
||||
|
||||
--unset var--
|
||||
int(0)
|
||||
|
||||
--resource--
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strlen(string str [, string charset])
|
||||
* Description: Get character numbers of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test iconv_strlen() by passing different data types as $encoding argument.
|
||||
* Where possible 'UTF-8' has been entered as a string value
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strlen() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$str = 'string value';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
UTF-8
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $input argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "UTF-8",
|
||||
'UTF-8',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strlen()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strlen($str, $input));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,86 @@
|
||||
*** Testing iconv_strlen() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 11 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 12 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 14 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 16 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 17 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 20 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 21 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 22 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 23 --
|
||||
int(12)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test how iconv_strpos behaves when passed an incorrect number of arguments
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test iconv_strpos with one more than the expected number of arguments
|
||||
echo "\n-- Testing iconv_strpos() function with more than expected no. of arguments --\n";
|
||||
$haystack = 'string_val';
|
||||
$needle = 'string_val';
|
||||
$offset = 10;
|
||||
$encoding = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( iconv_strpos($haystack, $needle, $offset, $encoding, $extra_arg) );
|
||||
|
||||
// Testing iconv_strpos with one less than the expected number of arguments
|
||||
echo "\n-- Testing iconv_strpos() function with less than expected no. of arguments --\n";
|
||||
$haystack = 'string_val';
|
||||
var_dump( iconv_strpos($haystack) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
*** Testing iconv_strpos() : error conditions ***
|
||||
|
||||
-- Testing iconv_strpos() function with more than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Testing iconv_strpos() function with less than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an unknown encoding to iconv_strpos() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : error conditions ***\n";
|
||||
$haystack = 'Hello, world';
|
||||
$needle = 'world';
|
||||
$offset = 2;
|
||||
$encoding = 'unknown-encoding';
|
||||
|
||||
var_dump( iconv_strpos($haystack, $needle, $offset, $encoding) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,4 @@
|
||||
*** Testing iconv_strpos() : error conditions ***
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strpos different data types as $haystack arg to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$needle = 'string_val';
|
||||
$offset = 0;
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $haystack argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strpos($input, $needle, $offset, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strpos different data types as $needle arg to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$haystack = 'string_val';
|
||||
$offset = 0;
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $needle argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strpos($haystack, $input, $offset, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(0)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(0)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strpos different data types as $offset arg to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$needle = b'a';
|
||||
$haystack = b'string_val';
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $offest argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strpos($haystack, $needle, $input, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,84 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 2 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 9 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 10 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 11 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 12 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 13 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 14 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 15 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 16 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 23 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strpos different data types as $offset arg to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$needle = b'a';
|
||||
$haystack = b'string_val';
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $offest argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strpos($haystack, $needle, $input, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,83 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 2 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 8 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 9 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 10 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 11 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 12 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 13 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 14 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 15 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 16 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 23 --
|
||||
int(8)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Pass iconv_strpos different data types as $encoding arg to test behaviour
|
||||
* Where possible 'UTF-8' has been entered as a string value
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$haystack = b'string_val';
|
||||
$needle = b'val';
|
||||
$offset = 0;
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
UTF-8
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $input argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "UTF-8",
|
||||
'UTF-8',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strpos($haystack, $needle, $offset, $input));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,86 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 11 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 12 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 14 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 16 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 17 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 20 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 21 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 22 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 23 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strrpos() an incorrect number of arguments
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test iconv_strrpos with one more than the expected number of arguments
|
||||
echo "\n-- Testing iconv_strrpos() function with more than expected no. of arguments --\n";
|
||||
$haystack = 'string_val';
|
||||
$needle = 'string_val';
|
||||
$encoding = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( iconv_strrpos($haystack, $needle, $encoding, $extra_arg) );
|
||||
|
||||
// Testing iconv_strrpos with one less than the expected number of arguments
|
||||
echo "\n-- Testing iconv_strrpos() function with less than expected no. of arguments --\n";
|
||||
$haystack = 'string_val';
|
||||
var_dump( iconv_strrpos($haystack) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
*** Testing iconv_strrpos() : error conditions ***
|
||||
|
||||
-- Testing iconv_strrpos() function with more than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Testing iconv_strrpos() function with less than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strrpos() an encoding that doesn't exist
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : error conditions ***\n";
|
||||
|
||||
$haystack = 'This is an English string. 0123456789.';
|
||||
$needle = '123';
|
||||
$offset = 5;
|
||||
$encoding = 'unknown-encoding';
|
||||
|
||||
var_dump(iconv_strrpos($haystack, $needle , $encoding));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,4 @@
|
||||
*** Testing iconv_strrpos() : error conditions ***
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strrpos() different data types as $haystack argument to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$needle = 'world';
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "hello, world";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello, world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $haystack argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "hello, world",
|
||||
'hello, world',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strrpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strrpos($input, $needle, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_strrpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 20 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 21 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strrpos() different data types as $needle argument to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$haystack = 'hello, world';
|
||||
$encoding = 'utf-8';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "world";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $needle argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "world",
|
||||
'world',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strrpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strrpos($haystack, $input, $encoding));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
*** Testing iconv_strrpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 20 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 21 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass iconv_strrpos() different data types as $encoding argument to test behaviour
|
||||
* Where possible 'UTF-8' has been entered as a string value
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$haystack = b'hello, world';
|
||||
$needle = b'world';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "UTF-8";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
UTF-8
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $encoding argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*18*/ "UTF-8",
|
||||
'UTF-8',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*21*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*22*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*23*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*24*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of iconv_strrpos()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( iconv_strrpos($haystack, $needle, $input));
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,86 @@
|
||||
*** Testing iconv_strrpos() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 11 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 12 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 14 --
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 16 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 17 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 18 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 19 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 20 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 21 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 22 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 23 --
|
||||
int(7)
|
||||
|
||||
-- Iteration 24 --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/* Prototype : string iconv_substr(string str, int offset, [int length, string charset])
|
||||
* Description: Returns part of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to iconv_substr() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_substr() : error conditions ***\n";
|
||||
|
||||
//Test iconv_substr with one more than the expected number of arguments
|
||||
echo "\n-- Testing iconv_substr() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$start = 10;
|
||||
$length = 10;
|
||||
$encoding = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( iconv_substr($str, $start, $length, $encoding, $extra_arg) );
|
||||
|
||||
// Testing iconv_substr with one less than the expected number of arguments
|
||||
echo "\n-- Testing iconv_substr() function with less than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
var_dump( iconv_substr($str) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
*** Testing iconv_substr() : error conditions ***
|
||||
|
||||
-- Testing iconv_substr() function with more than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
-- Testing iconv_substr() function with less than expected no. of arguments --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/* Prototype : string iconv_substr(string str, int offset, [int length, string charset])
|
||||
* Description: Returns part of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an unknown encoding to iconv_substr() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_substr() : error conditions ***\n";
|
||||
|
||||
$str = 'Hello, world';
|
||||
$start = 1;
|
||||
$length = 5;
|
||||
$encoding = 'unknown-encoding';
|
||||
|
||||
var_dump( iconv_substr($str, $start, $length, $encoding));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,4 @@
|
||||
*** Testing iconv_substr() : error conditions ***
|
||||
HipHop Notice: %a
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
var_dump(iconv_strpos('11--','1-',0,'UTF-8'));
|
||||
var_dump(iconv_strpos('-11--','1-',0,'UTF-8'));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
int(1)
|
||||
int(2)
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
var_dump(iconv_substr('x', 0, 1, 'UTF-8'));
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
string(1) "x"
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
echo iconv_mime_decode('=?utf-8?Q?Nachricht_=c3=bcber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . "\n";
|
||||
echo iconv_mime_decode('=?utf-8?Q?Nachricht_=C3=BCber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . "\n";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
Nachricht über Kontaktformular www.inexio.net
|
||||
Nachricht über Kontaktformular www.inexio.net
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv($a, "b", "test"));
|
||||
var_dump(iconv("x", $a, "test"));
|
||||
?>
|
||||
@@ -0,0 +1,4 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
if (@iconv('blah', 'blah', 'blah') != '') {
|
||||
die("failed\n");
|
||||
}
|
||||
}
|
||||
echo "success\n";
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
success
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/* Prototype : string iconv(string in_charset, string out_charset, string str)
|
||||
* Description: Returns converted string in desired encoding
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of iconv()
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv() : basic functionality ***\n";
|
||||
|
||||
//All strings are the same when displayed in their respective encodings
|
||||
$sjis_string = base64_decode(b'k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
|
||||
$euc_jp_string = base64_decode(b'xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==');
|
||||
$utf8_string = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
|
||||
|
||||
echo "\n-- Convert to EUC-JP --\n";
|
||||
echo "Expected EUC-JP encoded string in base64:\n";
|
||||
var_dump(bin2hex($euc_jp_string));
|
||||
echo "Converted Strings:\n";
|
||||
var_dump(bin2hex(iconv('SJIS', 'EUC-JP', $sjis_string )));
|
||||
var_dump(bin2hex(iconv('UTF-8', 'EUC-JP', $utf8_string)));
|
||||
|
||||
echo "\n-- Convert to SJIS --\n";
|
||||
echo "Expected SJIS encoded string in base64:\n";
|
||||
var_dump(bin2hex($sjis_string));
|
||||
echo "Converted Strings:\n";
|
||||
var_dump(bin2hex(iconv('EUC-JP', 'SJIS', $euc_jp_string)));
|
||||
var_dump(bin2hex(iconv('UTF-8', 'SJIS', $utf8_string)));
|
||||
|
||||
echo "\n-- Convert to UTF-8 --\n";
|
||||
echo "Expected UTF-8 encoded string in base64:\n";
|
||||
var_dump(bin2hex($utf8_string));
|
||||
echo "Converted Strings:\n";
|
||||
var_dump(bin2hex(iconv('SJIS', 'UTF-8', $sjis_string)));
|
||||
var_dump(bin2hex(iconv('EUC-JP', 'UTF-8', $euc_jp_string)));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
*** Testing iconv() : basic functionality ***
|
||||
|
||||
-- Convert to EUC-JP --
|
||||
Expected EUC-JP encoded string in base64:
|
||||
string(74) "c6fccbdcb8eca5c6a5ada5b9a5c8a4c7a4b9a1a33031323334a3b5a3b6a3b7a3b8a3b9a1a3"
|
||||
Converted Strings:
|
||||
string(74) "c6fccbdcb8eca5c6a5ada5b9a5c8a4c7a4b9a1a33031323334a3b5a3b6a3b7a3b8a3b9a1a3"
|
||||
string(74) "c6fccbdcb8eca5c6a5ada5b9a5c8a4c7a4b9a1a33031323334a3b5a3b6a3b7a3b8a3b9a1a3"
|
||||
|
||||
-- Convert to SJIS --
|
||||
Expected SJIS encoded string in base64:
|
||||
string(74) "93fa967b8cea8365834c8358836782c582b781423031323334825482558256825782588142"
|
||||
Converted Strings:
|
||||
string(74) "93fa967b8cea8365834c8358836782c582b781423031323334825482558256825782588142"
|
||||
string(74) "93fa967b8cea8365834c8358836782c582b781423031323334825482558256825782588142"
|
||||
|
||||
-- Convert to UTF-8 --
|
||||
Expected UTF-8 encoded string in base64:
|
||||
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
|
||||
Converted Strings:
|
||||
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
|
||||
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
|
||||
Done
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
iconv_set_encoding("internal_encoding", "UTF-8");
|
||||
iconv_set_encoding("output_encoding", "UTF-8");
|
||||
iconv_set_encoding("input_encoding", "UTF-8");
|
||||
|
||||
var_dump( iconv_get_encoding('internal_encoding') );
|
||||
var_dump( iconv_get_encoding('output_encoding') );
|
||||
var_dump( iconv_get_encoding('input_encoding') );
|
||||
var_dump( iconv_get_encoding('all') );
|
||||
var_dump( iconv_get_encoding('foo') );
|
||||
var_dump( iconv_get_encoding() );
|
||||
|
||||
|
||||
|
||||
iconv_set_encoding("internal_encoding", "ISO-8859-1");
|
||||
iconv_set_encoding("output_encoding", "ISO-8859-1");
|
||||
iconv_set_encoding("input_encoding", "ISO-8859-1");
|
||||
|
||||
var_dump( iconv_get_encoding('internal_encoding') );
|
||||
var_dump( iconv_get_encoding('output_encoding') );
|
||||
var_dump( iconv_get_encoding('input_encoding') );
|
||||
var_dump( iconv_get_encoding('all') );
|
||||
var_dump( iconv_get_encoding('foo') );
|
||||
var_dump( iconv_get_encoding() );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,40 @@
|
||||
string(5) "UTF-8"
|
||||
string(5) "UTF-8"
|
||||
string(5) "UTF-8"
|
||||
array(3) {
|
||||
["input_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
["output_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
["internal_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
}
|
||||
bool(false)
|
||||
array(3) {
|
||||
["input_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
["output_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
["internal_encoding"]=>
|
||||
string(5) "UTF-8"
|
||||
}
|
||||
string(10) "ISO-8859-1"
|
||||
string(10) "ISO-8859-1"
|
||||
string(10) "ISO-8859-1"
|
||||
array(3) {
|
||||
["input_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
["output_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
["internal_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
}
|
||||
bool(false)
|
||||
array(3) {
|
||||
["input_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
["output_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
["internal_encoding"]=>
|
||||
string(10) "ISO-8859-1"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv_mime_decode("a", null, $a));
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv_mime_decode_headers("a", null, $a));
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv_set_encoding("input_encoding", $a));
|
||||
var_dump(iconv_set_encoding("output_encoding", $a));
|
||||
var_dump(iconv_set_encoding("internal_encoding", $a));
|
||||
?>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9791999);
|
||||
var_dump(iconv_strlen(1, $a));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
function foo($str, $charset) {
|
||||
var_dump(strlen($str));
|
||||
var_dump(iconv_strlen($str, $charset));
|
||||
}
|
||||
|
||||
foo("abc", "ASCII");
|
||||
foo("日本語 EUC-JP", "EUC-JP");
|
||||
?>
|
||||
@@ -0,0 +1,4 @@
|
||||
int(3)
|
||||
int(3)
|
||||
int(13)
|
||||
int(10)
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strlen(string str [, string charset])
|
||||
* Description: Get character numbers of a string
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of iconv_strlen()
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strlen() : basic functionality***\n";
|
||||
|
||||
$string_ascii = b'abc def';
|
||||
//Japanese string in UTF-8
|
||||
$string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
|
||||
|
||||
echo "\n-- ASCII String --\n";
|
||||
var_dump(iconv_strlen($string_ascii));
|
||||
|
||||
echo "\n-- Multibyte String --\n";
|
||||
var_dump(iconv_strlen($string_mb, 'UTF-8'));
|
||||
?>
|
||||
===DONE===
|
||||
@@ -0,0 +1,8 @@
|
||||
*** Testing iconv_strlen() : basic functionality***
|
||||
|
||||
-- ASCII String --
|
||||
int(7)
|
||||
|
||||
-- Multibyte String --
|
||||
int(21)
|
||||
===DONE===
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv_strpos("a", "b", 0, $a));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of iconv_strpos with ASCII and multibyte characters
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strpos() : basic functionality***\n";
|
||||
|
||||
iconv_set_encoding("internal_encoding", "UTF-8");
|
||||
|
||||
$string_ascii = b'abc def';
|
||||
//Japanese string in UTF-8
|
||||
$string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
|
||||
|
||||
echo "\n-- ASCII string 1 --\n";
|
||||
var_dump(iconv_strpos($string_ascii, b'd', 2, 'ISO-8859-1'));
|
||||
|
||||
echo "\n-- ASCII string 2 --\n";
|
||||
var_dump(iconv_strpos($string_ascii, b'123'));
|
||||
|
||||
echo "\n-- Multibyte string 1 --\n";
|
||||
$needle1 = base64_decode('5pel5pys6Kqe');
|
||||
var_dump(iconv_strpos($string_mb, $needle1));
|
||||
|
||||
echo "\n-- Multibyte string 2 --\n";
|
||||
$needle2 = base64_decode(b"44GT44KT44Gr44Gh44Gv44CB5LiW55WM");
|
||||
var_dump(iconv_strpos($string_mb, $needle2));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
*** Testing iconv_strpos() : basic functionality***
|
||||
|
||||
-- ASCII string 1 --
|
||||
int(4)
|
||||
|
||||
-- ASCII string 2 --
|
||||
bool(false)
|
||||
|
||||
-- Multibyte string 1 --
|
||||
int(0)
|
||||
|
||||
-- Multibyte string 2 --
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]])
|
||||
* Description: Find position of first occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test how iconv_strpos() behaves when passed different integers as $offset argument
|
||||
* The character length of $string_ascii and $string_mb is the same,
|
||||
* and the needle appears at the same positions in both strings
|
||||
*/
|
||||
|
||||
iconv_set_encoding("internal_encoding", "UTF-8");
|
||||
|
||||
echo "*** Testing iconv_strpos() : usage variations ***\n";
|
||||
|
||||
$string_ascii = b'+Is an English string'; //21 chars
|
||||
$needle_ascii = b'g';
|
||||
|
||||
$string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
|
||||
$needle_mb = base64_decode(b'44CC');
|
||||
|
||||
/*
|
||||
* Loop through integers as multiples of ten for $offset argument
|
||||
* iconv_strpos should not be able to accept negative values as $offset.
|
||||
* 60 is larger than *BYTE* count for $string_mb
|
||||
*/
|
||||
for ($i = -10; $i <= 60; $i += 10) {
|
||||
echo "\n**-- Offset is: $i --**\n";
|
||||
echo "-- ASCII String --\n";
|
||||
var_dump(iconv_strpos($string_ascii, $needle_ascii, $i));
|
||||
echo "--Multibyte String --\n";
|
||||
var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
|
||||
}
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,52 @@
|
||||
*** Testing iconv_strpos() : usage variations ***
|
||||
|
||||
**-- Offset is: -10 --**
|
||||
-- ASCII String --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
--Multibyte String --
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
|
||||
**-- Offset is: 0 --**
|
||||
-- ASCII String --
|
||||
int(9)
|
||||
--Multibyte String --
|
||||
int(9)
|
||||
|
||||
**-- Offset is: 10 --**
|
||||
-- ASCII String --
|
||||
int(20)
|
||||
--Multibyte String --
|
||||
int(20)
|
||||
|
||||
**-- Offset is: 20 --**
|
||||
-- ASCII String --
|
||||
int(20)
|
||||
--Multibyte String --
|
||||
int(20)
|
||||
|
||||
**-- Offset is: 30 --**
|
||||
-- ASCII String --
|
||||
bool(false)
|
||||
--Multibyte String --
|
||||
bool(false)
|
||||
|
||||
**-- Offset is: 40 --**
|
||||
-- ASCII String --
|
||||
bool(false)
|
||||
--Multibyte String --
|
||||
bool(false)
|
||||
|
||||
**-- Offset is: 50 --**
|
||||
-- ASCII String --
|
||||
bool(false)
|
||||
--Multibyte String --
|
||||
bool(false)
|
||||
|
||||
**-- Offset is: 60 --**
|
||||
-- ASCII String --
|
||||
bool(false)
|
||||
--Multibyte String --
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = str_repeat("/", 9000000);
|
||||
var_dump(iconv_strrpos("a", "b", $a));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
|
||||
* Description: Find position of last occurrence of a string within another
|
||||
* Source code: ext/iconv/iconv.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of iconv_strrpos()
|
||||
*/
|
||||
|
||||
echo "*** Testing iconv_strrpos() : basic ***\n";
|
||||
|
||||
iconv_set_encoding("internal_encoding", "UTF-8");
|
||||
|
||||
$string_ascii = b'This is an English string. 0123456789.';
|
||||
//Japanese string in UTF-8
|
||||
$string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
|
||||
|
||||
echo "\n-- ASCII string 1 --\n";
|
||||
var_dump(iconv_strrpos($string_ascii, b'is', 'ISO-8859-1'));
|
||||
|
||||
echo "\n-- ASCII string 2 --\n";
|
||||
var_dump(iconv_strrpos($string_ascii, b'hello, world'));
|
||||
|
||||
echo "\n-- Multibyte string 1 --\n";
|
||||
$needle1 = base64_decode(b'44CC');
|
||||
var_dump(iconv_strrpos($string_mb, $needle1));
|
||||
|
||||
echo "\n-- Multibyte string 2 --\n";
|
||||
$needle2 = base64_decode(b'44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
|
||||
var_dump(iconv_strrpos($string_mb, $needle2));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
*** Testing iconv_strrpos() : basic ***
|
||||
|
||||
-- ASCII string 1 --
|
||||
int(15)
|
||||
|
||||
-- ASCII string 2 --
|
||||
bool(false)
|
||||
|
||||
-- Multibyte string 1 --
|
||||
int(20)
|
||||
|
||||
-- Multibyte string 2 --
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$a = str_repeat('A', 99897);
|
||||
$b = str_repeat('/', 2798349);
|
||||
var_dump(iconv_substr($a, 0, 1, $b));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
bool(false)
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário