Fix CRLF line-endings in tests

Also fix a single instance of CRLF in ibase_query.c.
This commit is contained in:
Nikita Popov 2016-11-20 21:24:51 +01:00
parent 563a341df7
commit 45f7b2bcc8
211 changed files with 11935 additions and 11935 deletions

View file

@ -1,71 +1,71 @@
--TEST-- --TEST--
Bug #55509 (segfault on x86_64 using more than 2G memory) Bug #55509 (segfault on x86_64 using more than 2G memory)
--SKIPIF-- --SKIPIF--
<?php <?php
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die('skip Not for 32-bits OS'); die('skip Not for 32-bits OS');
} }
$zend_mm_enabled = getenv("USE_ZEND_ALLOC"); $zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") { if ($zend_mm_enabled === "0") {
die("skip Zend MM disabled"); die("skip Zend MM disabled");
} }
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
// check the available memory // check the available memory
if (PHP_OS == 'Linux') { if (PHP_OS == 'Linux') {
$lines = file('/proc/meminfo'); $lines = file('/proc/meminfo');
$infos = array(); $infos = array();
foreach ($lines as $line) { foreach ($lines as $line) {
$tmp = explode(":", $line); $tmp = explode(":", $line);
$index = strtolower($tmp[0]); $index = strtolower($tmp[0]);
$value = (int)ltrim($tmp[1], " ")*1024; $value = (int)ltrim($tmp[1], " ")*1024;
$infos[$index] = $value; $infos[$index] = $value;
} }
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached']; $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
if ($freeMemory < 2100*1024*1024) { if ($freeMemory < 2100*1024*1024) {
die('skip Not enough memory.'); die('skip Not enough memory.');
} }
} }
elseif (PHP_OS == 'FreeBSD') { elseif (PHP_OS == 'FreeBSD') {
$lines = explode("\n",`sysctl -a`); $lines = explode("\n",`sysctl -a`);
$infos = array(); $infos = array();
foreach ($lines as $line) { foreach ($lines as $line) {
if(!$line){ if(!$line){
continue; continue;
} }
$tmp = explode(":", $line); $tmp = explode(":", $line);
$index = strtolower($tmp[0]); $index = strtolower($tmp[0]);
$value = trim($tmp[1], " "); $value = trim($tmp[1], " ");
$infos[$index] = $value; $infos[$index] = $value;
} }
$freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize']) $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
+($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize']) +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
+($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']); +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
if ($freeMemory < 2100*1024*1024) { if ($freeMemory < 2100*1024*1024) {
die('skip Not enough memory.'); die('skip Not enough memory.');
} }
} }
?> ?>
--INI-- --INI--
memory_limit=2100M memory_limit=2100M
--FILE-- --FILE--
<?php <?php
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5); $a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
echo "1\n"; echo "1\n";
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5); $a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
echo "2\n"; echo "2\n";
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5); $a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
echo "3\n"; echo "3\n";
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5); $a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
echo "4\n"; echo "4\n";
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5); $a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
echo "5\n"; echo "5\n";
?> ?>
--EXPECTF-- --EXPECTF--
1 1
2 2
3 3
4 4
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d

View file

@ -1,30 +1,30 @@
--TEST-- --TEST--
Bug #64979 (Wrong behavior of static variables in closure generators) Bug #64979 (Wrong behavior of static variables in closure generators)
--FILE-- --FILE--
<?php <?php
function new_closure_gen() { function new_closure_gen() {
return function() { return function() {
static $foo = 0; static $foo = 0;
yield ++$foo; yield ++$foo;
}; };
} }
$closure1 = new_closure_gen(); $closure1 = new_closure_gen();
$closure2 = new_closure_gen(); $closure2 = new_closure_gen();
$gen1 = $closure1(); $gen1 = $closure1();
$gen2 = $closure1(); $gen2 = $closure1();
$gen3 = $closure2(); $gen3 = $closure2();
foreach (array($gen1, $gen2, $gen3) as $gen) { foreach (array($gen1, $gen2, $gen3) as $gen) {
foreach ($gen as $val) { foreach ($gen as $val) {
var_dump($val); var_dump($val);
} }
} }
?> ?>
--EXPECT-- --EXPECT--
int(1) int(1)
int(2) int(2)
int(1) int(1)

View file

@ -1,23 +1,23 @@
--TEST-- --TEST--
Bug #71474: Crash because of VM stack corruption on Magento2 Bug #71474: Crash because of VM stack corruption on Magento2
--FILE-- --FILE--
<?php <?php
class foo { class foo {
function __call($name, $args) { function __call($name, $args) {
$a = $b = $c = $d = $e = $f = 1; $a = $b = $c = $d = $e = $f = 1;
} }
} }
function test($n, $x) { function test($n, $x) {
// var_dump($n); // var_dump($n);
if ($n > 0) { if ($n > 0) {
$x->bug(); $x->bug();
test($n - 1, $x); test($n - 1, $x);
} }
} }
test(3000, new foo()); test(3000, new foo());
echo "OK\n"; echo "OK\n";
?> ?>
--EXPECT-- --EXPECT--
OK OK

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Bug #72918 (negative offset inside a quoted string leads to parse error) Bug #72918 (negative offset inside a quoted string leads to parse error)
--FILE-- --FILE--
<?php <?php
$array = [-3 => 'foo']; $array = [-3 => 'foo'];
$string = 'abcde'; $string = 'abcde';
echo "$array[-3]\n"; echo "$array[-3]\n";
echo "$string[-3]\n"; echo "$string[-3]\n";
echo <<<EOT echo <<<EOT
$array[-3] $array[-3]
$string[-3] $string[-3]
EOT; EOT;
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
foo foo
c c
foo foo
c c
===DONE=== ===DONE===

View file

@ -1,12 +1,12 @@
--TEST-- --TEST--
string offset 002 string offset 002
--FILE-- --FILE--
<?php <?php
$a = "aaa"; $a = "aaa";
$x = array(&$a[1]); $x = array(&$a[1]);
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3 Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
Stack trace: Stack trace:
#0 {main} #0 {main}
thrown in %sstr_offset_002.php on line 3 thrown in %sstr_offset_002.php on line 3

View file

@ -1,23 +1,23 @@
--TEST-- --TEST--
Check for problems with case sensitivity in compositions Check for problems with case sensitivity in compositions
--FILE-- --FILE--
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
trait A { trait A {
public function M1() {} public function M1() {}
public function M2() {} public function M2() {}
} }
trait B { trait B {
public function M1() {} public function M1() {}
public function M2() {} public function M2() {}
} }
class MyClass { class MyClass {
use A; use A;
use B; use B;
} }
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Traits with static methods. Traits with static methods.
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return 'Test'; return 'Test';
} }
} }
class A { class A {
use TestTrait; use TestTrait;
} }
echo A::test(); echo A::test();
?> ?>
--EXPECT-- --EXPECT--
Test Test

View file

@ -1,23 +1,23 @@
--TEST-- --TEST--
Traits with static methods referenced using variable. Traits with static methods referenced using variable.
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return 'Test'; return 'Test';
} }
} }
class A { class A {
use TestTrait; use TestTrait;
} }
$class = "A"; $class = "A";
echo $class::test(); echo $class::test();
?> ?>
--EXPECT-- --EXPECT--
Test Test

View file

@ -1,27 +1,27 @@
--TEST-- --TEST--
Traits with late static bindings. Traits with late static bindings.
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return static::$test; return static::$test;
} }
} }
class A { class A {
use TestTrait; use TestTrait;
protected static $test = "Test A"; protected static $test = "Test A";
} }
class B extends A { class B extends A {
protected static $test = "Test B"; protected static $test = "Test B";
} }
echo B::test(); echo B::test();
?> ?>
--EXPECT-- --EXPECT--
Test B Test B

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Traits with __callStatic magic method. Traits with __callStatic magic method.
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function __callStatic($name, $arguments) { public static function __callStatic($name, $arguments) {
return $name; return $name;
} }
} }
class A { class A {
use TestTrait; use TestTrait;
} }
echo A::Test(); echo A::Test();
?> ?>
--EXPECT-- --EXPECT--
Test Test

View file

@ -1,28 +1,28 @@
--TEST-- --TEST--
Traits and forward_static_call(). Traits and forward_static_call().
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return 'Forwarded '.forward_static_call(array('A', 'test')); return 'Forwarded '.forward_static_call(array('A', 'test'));
} }
} }
class A { class A {
public static function test() { public static function test() {
return "Test A"; return "Test A";
} }
} }
class B extends A { class B extends A {
use TestTrait; use TestTrait;
} }
echo B::test(); echo B::test();
?> ?>
--EXPECT-- --EXPECT--
Forwarded Test A Forwarded Test A

View file

@ -1,24 +1,24 @@
--TEST-- --TEST--
Traits and get_called_class(). Traits and get_called_class().
--CREDITS-- --CREDITS--
Simas Toleikis simast@gmail.com Simas Toleikis simast@gmail.com
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return get_called_class(); return get_called_class();
} }
} }
class A { class A {
use TestTrait; use TestTrait;
} }
class B extends A { } class B extends A { }
echo B::test(); echo B::test();
?> ?>
--EXPECT-- --EXPECT--
B B

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
__TRAIT__: Basics, a constant denoiting the trait of definition. __TRAIT__: Basics, a constant denoiting the trait of definition.
--FILE-- --FILE--
<?php <?php
trait TestTrait { trait TestTrait {
public static function test() { public static function test() {
return __TRAIT__; return __TRAIT__;
} }
} }
class Direct { class Direct {
use TestTrait; use TestTrait;
} }
class IndirectInheritance extends Direct { class IndirectInheritance extends Direct {
} }
trait TestTraitIndirect { trait TestTraitIndirect {
use TestTrait; use TestTrait;
} }
class Indirect { class Indirect {
use TestTraitIndirect; use TestTraitIndirect;
} }
echo Direct::test()."\n"; echo Direct::test()."\n";
echo IndirectInheritance::test()."\n"; echo IndirectInheritance::test()."\n";
echo Indirect::test()."\n"; echo Indirect::test()."\n";
?> ?>
--EXPECT-- --EXPECT--
TestTrait TestTrait
TestTrait TestTrait
TestTrait TestTrait

View file

@ -1,27 +1,27 @@
--TEST-- --TEST--
__TRAIT__: Use outside of traits. __TRAIT__: Use outside of traits.
--FILE-- --FILE--
<?php <?php
class MyClass { class MyClass {
static function test() { static function test() {
return __TRAIT__; return __TRAIT__;
} }
} }
function someFun() { function someFun() {
return __TRAIT__; return __TRAIT__;
} }
$t = __TRAIT__; $t = __TRAIT__;
var_dump($t); var_dump($t);
$t = MyClass::test(); $t = MyClass::test();
var_dump($t); var_dump($t);
$t = someFun(); $t = someFun();
var_dump($t); var_dump($t);
?> ?>
--EXPECT-- --EXPECT--
string(0) "" string(0) ""
string(0) "" string(0) ""
string(0) "" string(0) ""

View file

@ -1,53 +1,53 @@
--TEST-- --TEST--
Check libcurl config on windows Check libcurl config on windows
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded("curl")) { if (!extension_loaded("curl")) {
die('skip - curl extension not available in this build'); die('skip - curl extension not available in this build');
} }
if(substr(PHP_OS, 0, 3) != 'WIN' ) if(substr(PHP_OS, 0, 3) != 'WIN' )
die("skip for windows only"); die("skip for windows only");
?> ?>
--FILE-- --FILE--
<?php <?php
ob_start(); ob_start();
phpinfo(); phpinfo();
$s = ob_get_contents(); $s = ob_get_contents();
ob_end_clean(); ob_end_clean();
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m); preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
echo $m[1], "\n"; echo $m[1], "\n";
?> ?>
DONE DONE
--EXPECTF-- --EXPECTF--
cURL support => enabled cURL support => enabled
cURL Information => %s cURL Information => %s
Age => %d Age => %d
Features Features
AsynchDNS => Yes AsynchDNS => Yes
CharConv => No CharConv => No
Debug => No Debug => No
GSS-Negotiate => No GSS-Negotiate => No
IDN => Yes IDN => Yes
IPv6 => Yes IPv6 => Yes
krb4 => No krb4 => No
Largefile => Yes Largefile => Yes
libz => Yes libz => Yes
NTLM => Yes NTLM => Yes
NTLMWB => No NTLMWB => No
SPNEGO => Yes SPNEGO => Yes
SSL => Yes SSL => Yes
SSPI => Yes SSPI => Yes
TLS-SRP => No TLS-SRP => No
HTTP2 => No HTTP2 => No
GSSAPI => No GSSAPI => No
KERBEROS5 => Yes KERBEROS5 => Yes
UNIX_SOCKETS => No UNIX_SOCKETS => No
PSL => No PSL => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => %s-pc-win32 Host => %s-pc-win32
SSL Version => OpenSSL/%s SSL Version => OpenSSL/%s
ZLib Version => %s ZLib Version => %s
libSSH Version => libssh2/%s libSSH Version => libssh2/%s
DONE DONE

View file

@ -1,28 +1,28 @@
--TEST-- --TEST--
Test curl_version() function : error conditions Test curl_version() function : error conditions
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?> <?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
--FILE-- --FILE--
<?php <?php
/* Prototype : array curl_version ([ int $age ] ) /* Prototype : array curl_version ([ int $age ] )
* Description: Returns information about the cURL version. * Description: Returns information about the cURL version.
* Source code: ext/curl/interface.c * Source code: ext/curl/interface.c
*/ */
echo "*** Testing curl_version() : error conditions ***\n"; echo "*** Testing curl_version() : error conditions ***\n";
echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n"; echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
$extra_arg = 10; $extra_arg = 10;
var_dump( curl_version(1, $extra_arg) ); var_dump( curl_version(1, $extra_arg) );
?> ?>
===Done=== ===Done===
--EXPECTF-- --EXPECTF--
*** Testing curl_version() : error conditions *** *** Testing curl_version() : error conditions ***
-- Testing curl_version() function with more than expected no. of arguments -- -- Testing curl_version() function with more than expected no. of arguments --
Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
NULL NULL
===Done=== ===Done===

View file

@ -1,159 +1,159 @@
--TEST-- --TEST--
Test curl_version() function : usage variations - test values for $ascii argument Test curl_version() function : usage variations - test values for $ascii argument
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); <?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?> if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
--FILE-- --FILE--
<?php <?php
/* Prototype : array curl_version ([ int $age ] ) /* Prototype : array curl_version ([ int $age ] )
* Description: Returns information about the cURL version. * Description: Returns information about the cURL version.
* Source code: ext/curl/interface.c * Source code: ext/curl/interface.c
*/ */
echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n"; echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
//get an unset variable //get an unset variable
$unset_var = 'string_val'; $unset_var = 'string_val';
unset($unset_var); unset($unset_var);
//defining a class //defining a class
class sample { class sample {
public function __toString() { public function __toString() {
return "sample object"; return "sample object";
} }
} }
//getting the resource //getting the resource
$file_handle = fopen(__FILE__, "r"); $file_handle = fopen(__FILE__, "r");
// array with different values for $input // array with different values for $input
$inputs = array ( $inputs = array (
// integer values // integer values
0, 0,
1, 1,
255, 255,
256, 256,
PHP_INT_MAX, PHP_INT_MAX,
-PHP_INT_MAX, -PHP_INT_MAX,
// float values // float values
10.5, 10.5,
-20.5, -20.5,
10.1234567e10, 10.1234567e10,
// array values // array values
array(), array(),
array(0), array(0),
array(1, 2), array(1, 2),
//string values //string values
"ABC", "ABC",
'abc', 'abc',
"2abc", "2abc",
// boolean values // boolean values
true, true,
false, false,
TRUE, TRUE,
FALSE, FALSE,
// null values // null values
NULL, NULL,
null, null,
// objects // objects
new sample(), new sample(),
// resource // resource
$file_handle, $file_handle,
// undefined variable // undefined variable
@$undefined_var, @$undefined_var,
// unset variable // unset variable
@$unset_var @$unset_var
); );
// loop through with each element of the $inputs array to test curl_version() function // loop through with each element of the $inputs array to test curl_version() function
$count = 1; $count = 1;
foreach($inputs as $input) { foreach($inputs as $input) {
echo "-- Iteration $count --\n"; echo "-- Iteration $count --\n";
var_dump( is_array(curl_version($input)) ); var_dump( is_array(curl_version($input)) );
$count ++; $count ++;
} }
fclose($file_handle); //closing the file handle fclose($file_handle); //closing the file handle
?> ?>
===Done=== ===Done===
--EXPECTF-- --EXPECTF--
*** Testing curl_version() function: with unexpected inputs for 'age' argument *** *** Testing curl_version() function: with unexpected inputs for 'age' argument ***
-- Iteration 1 -- -- Iteration 1 --
bool(true) bool(true)
-- Iteration 2 -- -- Iteration 2 --
bool(true) bool(true)
-- Iteration 3 -- -- Iteration 3 --
bool(true) bool(true)
-- Iteration 4 -- -- Iteration 4 --
bool(true) bool(true)
-- Iteration 5 -- -- Iteration 5 --
bool(true) bool(true)
-- Iteration 6 -- -- Iteration 6 --
bool(true) bool(true)
-- Iteration 7 -- -- Iteration 7 --
bool(true) bool(true)
-- Iteration 8 -- -- Iteration 8 --
bool(true) bool(true)
-- Iteration 9 -- -- Iteration 9 --
bool(true) bool(true)
-- Iteration 10 -- -- Iteration 10 --
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
bool(false) bool(false)
-- Iteration 11 -- -- Iteration 11 --
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
bool(false) bool(false)
-- Iteration 12 -- -- Iteration 12 --
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
bool(false) bool(false)
-- Iteration 13 -- -- Iteration 13 --
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
bool(false) bool(false)
-- Iteration 14 -- -- Iteration 14 --
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
bool(false) bool(false)
-- Iteration 15 -- -- Iteration 15 --
Notice: A non well formed numeric value encountered in %s on line %d Notice: A non well formed numeric value encountered in %s on line %d
bool(true) bool(true)
-- Iteration 16 -- -- Iteration 16 --
bool(true) bool(true)
-- Iteration 17 -- -- Iteration 17 --
bool(true) bool(true)
-- Iteration 18 -- -- Iteration 18 --
bool(true) bool(true)
-- Iteration 19 -- -- Iteration 19 --
bool(true) bool(true)
-- Iteration 20 -- -- Iteration 20 --
bool(true) bool(true)
-- Iteration 21 -- -- Iteration 21 --
bool(true) bool(true)
-- Iteration 22 -- -- Iteration 22 --
Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
bool(false) bool(false)
-- Iteration 23 -- -- Iteration 23 --
Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
bool(false) bool(false)
-- Iteration 24 -- -- Iteration 24 --
bool(true) bool(true)
-- Iteration 25 -- -- Iteration 25 --
bool(true) bool(true)
===Done=== ===Done===

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6) Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?> <?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE-- --FILE--
<?php <?php
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE)); var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
?> ?>
--EXPECT-- --EXPECT--
string(7) "FC00::1" string(7) "FC00::1"
bool(false) bool(false)
string(2) "::" string(2) "::"
bool(false) bool(false)
string(3) "::1" string(3) "::1"
bool(false) bool(false)
string(10) "fe8:5:6::1" string(10) "fe8:5:6::1"
bool(false) bool(false)
string(12) "2001:0db8::1" string(12) "2001:0db8::1"
bool(false) bool(false)
string(5) "5f::1" string(5) "5f::1"
bool(false) bool(false)
string(7) "3ff3::1" string(7) "3ff3::1"
bool(false) bool(false)

View file

@ -1,10 +1,10 @@
--TEST-- --TEST--
#49274, fatal error when an object does not implement toString #49274, fatal error when an object does not implement toString
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?> <?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE-- --FILE--
<?php <?php
var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL)); var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
?> ?>
--EXPECTF-- --EXPECTF--
bool(false) bool(false)

View file

@ -1,26 +1,26 @@
--TEST-- --TEST--
Bug #42434 (ImageLine w/ antialias = 1px shorter) Bug #42434 (ImageLine w/ antialias = 1px shorter)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) { if (!extension_loaded('gd')) {
die('skip gd extension not available'); die('skip gd extension not available');
} }
?> ?>
--FILE-- --FILE--
<?php <?php
$im = imagecreatetruecolor(10, 2); $im = imagecreatetruecolor(10, 2);
imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF); imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
imageantialias($im, true); imageantialias($im, true);
imageline($im, 0, 0, 10, 0, 0x000000); imageline($im, 0, 0, 10, 0, 0x000000);
if (imagecolorat($im, 9, 0) == 0x000000) { if (imagecolorat($im, 9, 0) == 0x000000) {
echo 'DONE'; echo 'DONE';
} else { } else {
echo 'Bugged'; echo 'Bugged';
} }
imagedestroy($im); imagedestroy($im);
?> ?>
--EXPECTF-- --EXPECTF--
DONE DONE

View file

@ -1,60 +1,60 @@
--TEST-- --TEST--
Bug #53156 (imagerectangle problem with point ordering) Bug #53156 (imagerectangle problem with point ordering)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) { if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
die("skip test requires GD 2.3 or newer"); die("skip test requires GD 2.3 or newer");
} }
?> ?>
--FILE-- --FILE--
<?php <?php
function draw_and_check_pixel($x, $y) function draw_and_check_pixel($x, $y)
{ {
global $img, $black, $red; global $img, $black, $red;
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-'; echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
imagesetpixel($img, $x, $y, $red); imagesetpixel($img, $x, $y, $red);
} }
function draw_and_check_rectangle($x1, $y1, $x2, $y2) function draw_and_check_rectangle($x1, $y1, $x2, $y2)
{ {
global $img, $black; global $img, $black;
echo 'Rectangle: '; echo 'Rectangle: ';
imagerectangle($img, $x1, $y1, $x2, $y2, $black); imagerectangle($img, $x1, $y1, $x2, $y2, $black);
$x = ($x1 + $x2) / 2; $x = ($x1 + $x2) / 2;
$y = ($y1 + $y2) / 2; $y = ($y1 + $y2) / 2;
draw_and_check_pixel($x, $y1); draw_and_check_pixel($x, $y1);
draw_and_check_pixel($x1, $y); draw_and_check_pixel($x1, $y);
draw_and_check_pixel($x, $y2); draw_and_check_pixel($x, $y2);
draw_and_check_pixel($x2, $y); draw_and_check_pixel($x2, $y);
echo PHP_EOL; echo PHP_EOL;
} }
$img = imagecreate(110, 210); $img = imagecreate(110, 210);
$bgnd = imagecolorallocate($img, 255, 255, 255); $bgnd = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0); $black = imagecolorallocate($img, 0, 0, 0);
$red = imagecolorallocate($img, 255, 0, 0); $red = imagecolorallocate($img, 255, 0, 0);
draw_and_check_rectangle( 10, 10, 50, 50); draw_and_check_rectangle( 10, 10, 50, 50);
draw_and_check_rectangle( 50, 60, 10, 100); draw_and_check_rectangle( 50, 60, 10, 100);
draw_and_check_rectangle( 50, 150, 10, 110); draw_and_check_rectangle( 50, 150, 10, 110);
draw_and_check_rectangle( 10, 200, 50, 160); draw_and_check_rectangle( 10, 200, 50, 160);
imagesetthickness($img, 4); imagesetthickness($img, 4);
draw_and_check_rectangle( 60, 10, 100, 50); draw_and_check_rectangle( 60, 10, 100, 50);
draw_and_check_rectangle(100, 60, 60, 100); draw_and_check_rectangle(100, 60, 60, 100);
draw_and_check_rectangle(100, 150, 60, 110); draw_and_check_rectangle(100, 150, 60, 110);
draw_and_check_rectangle( 60, 200, 100, 160); draw_and_check_rectangle( 60, 200, 100, 160);
//imagepng($img, __DIR__ . '/bug53156.png'); // debug //imagepng($img, __DIR__ . '/bug53156.png'); // debug
?> ?>
--EXPECT-- --EXPECT--
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++
Rectangle: ++++ Rectangle: ++++

View file

@ -1,15 +1,15 @@
--TEST-- --TEST--
Bug #72494 (imagecropauto out-of-bounds access) Bug #72494 (imagecropauto out-of-bounds access)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
$im = imagecreate(10,10); $im = imagecreate(10,10);
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337); imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
?> ?>
===DONE=== ===DONE===
--EXPECTF-- --EXPECTF--
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
===DONE=== ===DONE===

View file

@ -1,24 +1,24 @@
--TEST-- --TEST--
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation()) Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$src = imagecreatetruecolor(100, 100); $src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF); imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
imageellipse($src, 49,49, 40,40, 0x000000); imageellipse($src, 49,49, 40,40, 0x000000);
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR); imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
imagescale($src, 200, 200, IMG_BILINEAR_FIXED); imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
$dst = imagerotate($src, 60, 0xFFFFFF); $dst = imagerotate($src, 60, 0xFFFFFF);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst); test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
The images are equal. The images are equal.
===DONE=== ===DONE===

View file

@ -1,20 +1,20 @@
--TEST-- --TEST--
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette()) Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) { if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
die('skip only for bundled libgd or external libgd >= 2.2.4'); die('skip only for bundled libgd or external libgd >= 2.2.4');
} }
?> ?>
--FILE-- --FILE--
<?php <?php
$src = imagecreate(100, 100); $src = imagecreate(100, 100);
imagecolorallocate($src, 255, 255, 255); imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED); $dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99)); printf("color: %x\n", imagecolorat($dst, 99, 99));
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
color: ffffff color: ffffff
===DONE=== ===DONE===

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette()) Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) { if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
die('skip only for external libgd < 2.2.4'); die('skip only for external libgd < 2.2.4');
} }
?> ?>
--FILE-- --FILE--
<?php <?php
$src = imagecreate(100, 100); $src = imagecreate(100, 100);
imagecolorallocate($src, 255, 255, 255); imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED); $dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99)); printf("color: %x\n", imagecolorat($dst, 99, 99));
?> ?>
===DONE=== ===DONE===
--XFAIL-- --XFAIL--
Bug #330 has not yet been fixed Bug #330 has not yet been fixed
--EXPECT-- --EXPECT--
color: ffffff color: ffffff
===DONE=== ===DONE===

View file

@ -1,148 +1,148 @@
<?php <?php
function get_gd_version() function get_gd_version()
{ {
return GD_VERSION; return GD_VERSION;
} }
function get_php_info() function get_php_info()
{ {
ob_start(); ob_start();
phpinfo(); phpinfo();
$info = ob_get_contents(); $info = ob_get_contents();
ob_end_clean(); ob_end_clean();
return $info; return $info;
} }
function get_freetype_version() function get_freetype_version()
{ {
$version = 0; $version = 0;
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libjpeg_version() function get_libjpeg_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) { if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libpng_version() function get_libpng_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
function get_libxpm_version() function get_libxpm_version()
{ {
$version = 0; $version = 0;
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) { if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
$version = $match[1]; $version = $match[1];
} }
return $version; return $version;
} }
/** /**
* Tests that an in-memory image equals a PNG file. * Tests that an in-memory image equals a PNG file.
* *
* It checks for equal image sizes, and whether any pixels are different. * It checks for equal image sizes, and whether any pixels are different.
* The textual result is printed, so the EXPECT section should contain the line * The textual result is printed, so the EXPECT section should contain the line
* "The images are equal." * "The images are equal."
* *
* If the PNG file does not exists, or the images are not equal, a diagnostic * If the PNG file does not exists, or the images are not equal, a diagnostic
* message is printed, and the actual file is stored right beside the temporary * message is printed, and the actual file is stored right beside the temporary
* .php test file with the extension .out.png, to be able to manually inspect * .php test file with the extension .out.png, to be able to manually inspect
* the result. * the result.
* *
* @param string $filename * @param string $filename
* @param resource $actual * @param resource $actual
* @return void * @return void
*/ */
function test_image_equals_file($filename, $actual) function test_image_equals_file($filename, $actual)
{ {
if (!file_exists($filename)) { if (!file_exists($filename)) {
echo "The expected image does not exist.\n"; echo "The expected image does not exist.\n";
save_actual_image($actual); save_actual_image($actual);
return; return;
} }
$actual = test_to_truecolor($actual); $actual = test_to_truecolor($actual);
$expected = imagecreatefrompng($filename); $expected = imagecreatefrompng($filename);
$expected = test_to_truecolor($expected); $expected = test_to_truecolor($expected);
$exp_x = imagesx($expected); $exp_x = imagesx($expected);
$exp_y = imagesy($expected); $exp_y = imagesy($expected);
$act_x = imagesx($actual); $act_x = imagesx($actual);
$act_y = imagesy($actual); $act_y = imagesy($actual);
if ($exp_x != $act_x || $exp_y != $act_y) { if ($exp_x != $act_x || $exp_y != $act_y) {
echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n"; echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
save_actual_image($actual); save_actual_image($actual);
return; return;
} }
$pixels_changed = 0; $pixels_changed = 0;
for ($y = 0; $y < $exp_y; $y++) { for ($y = 0; $y < $exp_y; $y++) {
for ($x = 0; $x < $exp_x; $x ++) { for ($x = 0; $x < $exp_x; $x ++) {
$exp_c = imagecolorat($expected, $x, $y); $exp_c = imagecolorat($expected, $x, $y);
$act_c = imagecolorat($actual, $x, $y); $act_c = imagecolorat($actual, $x, $y);
if ($exp_c != $act_c) { if ($exp_c != $act_c) {
$pixels_changed++; $pixels_changed++;
} }
} }
} }
if (!$pixels_changed) { if (!$pixels_changed) {
echo "The images are equal.\n"; echo "The images are equal.\n";
} else { } else {
echo "The images differ in {$pixels_changed} pixels.\n"; echo "The images differ in {$pixels_changed} pixels.\n";
save_actual_image($actual); save_actual_image($actual);
} }
} }
/** /**
* Returns the truecolor version of an image. * Returns the truecolor version of an image.
* *
* @param resource $image * @param resource $image
* @return resource * @return resource
*/ */
function test_to_truecolor($image) function test_to_truecolor($image)
{ {
if (imageistruecolor($image)) { if (imageistruecolor($image)) {
return $image; return $image;
} else { } else {
$width = imagesx($image); $width = imagesx($image);
$height = imagesy($image); $height = imagesy($image);
$result = imagecreatetruecolor($width, $height); $result = imagecreatetruecolor($width, $height);
imagecopy($result, $image, 0,0, 0,0, $width, $height); imagecopy($result, $image, 0,0, 0,0, $width, $height);
return $result; return $result;
} }
} }
/** /**
* Saves an actual image to disk. * Saves an actual image to disk.
* *
* The image is saved right beside the temporary .php test file with the * The image is saved right beside the temporary .php test file with the
* extension .out.png. * extension .out.png.
* *
* @param resource $image * @param resource $image
* @return void * @return void
*/ */
function save_actual_image($image) function save_actual_image($image)
{ {
$pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']); $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png"; $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
imagepng($image, $filename); imagepng($image, $filename);
} }

View file

@ -1,85 +1,85 @@
--TEST-- --TEST--
Testing imagecropauto() Testing imagecropauto()
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
if (GD_BUNDLED) die('skip requires external libgd'); if (GD_BUNDLED) die('skip requires external libgd');
?> ?>
--FILE-- --FILE--
<?php <?php
echo "TC IMG_CROP_DEFAULT\n"; echo "TC IMG_CROP_DEFAULT\n";
$im = imagecreatetruecolor(99, 99); $im = imagecreatetruecolor(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); $im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_DEFAULT\n"; echo "Palette IMG_CROP_DEFAULT\n";
$im = imagecreate(99, 99); $im = imagecreate(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); $im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "TC IMG_CROP_SIDES\n"; echo "TC IMG_CROP_SIDES\n";
$im = imagecreatetruecolor(99, 99); $im = imagecreatetruecolor(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_SIDES); $im_crop = imagecropauto($im, IMG_CROP_SIDES);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_SIDES\n"; echo "Palette IMG_CROP_SIDES\n";
$im = imagecreate(99, 99); $im = imagecreate(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_SIDES); $im_crop = imagecropauto($im, IMG_CROP_SIDES);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "TC IMG_CROP_BLACK\n"; echo "TC IMG_CROP_BLACK\n";
$im = imagecreatetruecolor(50, 50); $im = imagecreatetruecolor(50, 50);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_BLACK); $im_crop = imagecropauto($im, IMG_CROP_BLACK);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_BLACK\n"; echo "Palette IMG_CROP_BLACK\n";
$im = imagecreate(50, 50); $im = imagecreate(50, 50);
$bgd = imagecolorallocate($im, 0, 0, 0); $bgd = imagecolorallocate($im, 0, 0, 0);
$b = imagecolorallocate($im, 0, 0, 255); $b = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_BLACK); $im_crop = imagecropauto($im, IMG_CROP_BLACK);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "IMG_CROP_THRESHOLD\n"; echo "IMG_CROP_THRESHOLD\n";
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); $im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); $im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
imagepng($im_crop, __DIR__ . "/crop_threshold.png"); imagepng($im_crop, __DIR__ . "/crop_threshold.png");
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
@unlink(__DIR__ . "/crop_threshold.png"); @unlink(__DIR__ . "/crop_threshold.png");
?> ?>
--EXPECT-- --EXPECT--
TC IMG_CROP_DEFAULT TC IMG_CROP_DEFAULT
int(99) int(99)
int(99) int(99)
Palette IMG_CROP_DEFAULT Palette IMG_CROP_DEFAULT
int(99) int(99)
int(99) int(99)
TC IMG_CROP_SIDES TC IMG_CROP_SIDES
int(11) int(11)
int(11) int(11)
Palette IMG_CROP_SIDES Palette IMG_CROP_SIDES
int(11) int(11)
int(11) int(11)
TC IMG_CROP_BLACK TC IMG_CROP_BLACK
int(11) int(11)
int(11) int(11)
Palette IMG_CROP_BLACK Palette IMG_CROP_BLACK
int(11) int(11)
int(11) int(11)
IMG_CROP_THRESHOLD IMG_CROP_THRESHOLD
int(240) int(240)
int(134) int(134)

View file

@ -1,85 +1,85 @@
--TEST-- --TEST--
Testing imagecropauto() Testing imagecropauto()
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
if (!GD_BUNDLED) die('skip requires bundled libgd'); if (!GD_BUNDLED) die('skip requires bundled libgd');
?> ?>
--FILE-- --FILE--
<?php <?php
echo "TC IMG_CROP_DEFAULT\n"; echo "TC IMG_CROP_DEFAULT\n";
$im = imagecreatetruecolor(99, 99); $im = imagecreatetruecolor(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); $im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_DEFAULT\n"; echo "Palette IMG_CROP_DEFAULT\n";
$im = imagecreate(99, 99); $im = imagecreate(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); $im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "TC IMG_CROP_SIDES\n"; echo "TC IMG_CROP_SIDES\n";
$im = imagecreatetruecolor(99, 99); $im = imagecreatetruecolor(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_SIDES); $im_crop = imagecropauto($im, IMG_CROP_SIDES);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_SIDES\n"; echo "Palette IMG_CROP_SIDES\n";
$im = imagecreate(99, 99); $im = imagecreate(99, 99);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_SIDES); $im_crop = imagecropauto($im, IMG_CROP_SIDES);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "TC IMG_CROP_BLACK\n"; echo "TC IMG_CROP_BLACK\n";
$im = imagecreatetruecolor(50, 50); $im = imagecreatetruecolor(50, 50);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_BLACK); $im_crop = imagecropauto($im, IMG_CROP_BLACK);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "Palette IMG_CROP_BLACK\n"; echo "Palette IMG_CROP_BLACK\n";
$im = imagecreate(50, 50); $im = imagecreate(50, 50);
$bgd = imagecolorallocate($im, 0, 0, 0); $bgd = imagecolorallocate($im, 0, 0, 0);
$b = imagecolorallocate($im, 0, 0, 255); $b = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 20, 20, 30, 30, 0xff); imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
$im_crop = imagecropauto($im, IMG_CROP_BLACK); $im_crop = imagecropauto($im, IMG_CROP_BLACK);
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
echo "IMG_CROP_THRESHOLD\n"; echo "IMG_CROP_THRESHOLD\n";
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); $im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); $im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
imagepng($im_crop, __DIR__ . "/crop_threshold.png"); imagepng($im_crop, __DIR__ . "/crop_threshold.png");
var_dump(imagesx($im_crop)); var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop)); var_dump(imagesy($im_crop));
@unlink(__DIR__ . "/crop_threshold.png"); @unlink(__DIR__ . "/crop_threshold.png");
?> ?>
--EXPECT-- --EXPECT--
TC IMG_CROP_DEFAULT TC IMG_CROP_DEFAULT
int(11) int(11)
int(11) int(11)
Palette IMG_CROP_DEFAULT Palette IMG_CROP_DEFAULT
int(11) int(11)
int(11) int(11)
TC IMG_CROP_SIDES TC IMG_CROP_SIDES
int(11) int(11)
int(11) int(11)
Palette IMG_CROP_SIDES Palette IMG_CROP_SIDES
int(11) int(11)
int(11) int(11)
TC IMG_CROP_BLACK TC IMG_CROP_BLACK
int(11) int(11)
int(11) int(11)
Palette IMG_CROP_BLACK Palette IMG_CROP_BLACK
int(11) int(11)
int(11) int(11)
IMG_CROP_THRESHOLD IMG_CROP_THRESHOLD
int(240) int(240)
int(134) int(134)

View file

@ -1,21 +1,21 @@
--TEST-- --TEST--
Testing wrong param passing imageellipse() of GD library Testing wrong param passing imageellipse() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-20 #testfest PHPSP on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 400, 300 ); $image = imagecreatetruecolor( 400, 300 );
// try to draw a white ellipse // try to draw a white ellipse
imageellipse( $image, 200, 150, 300, 200 ); imageellipse( $image, 200, 150, 300, 200 );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d

View file

@ -1,26 +1,26 @@
--TEST-- --TEST--
Testing wrong param passing imagefilltoborder() of GD library Testing wrong param passing imagefilltoborder() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded("gd")) die("skip GD not present; skipping test"); if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) ); imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
// Draw an ellipse to fill with a black border // Draw an ellipse to fill with a black border
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) ); imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
// Try to fill border // Try to fill border
imagefilltoborder( $image, 50, 50 ); imagefilltoborder( $image, 50, 50 );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d

View file

@ -1,30 +1,30 @@
--TEST-- --TEST--
Testing imageflip() of GD library Testing imageflip() of GD library
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
$im = imagecreatetruecolor( 99, 99 ); $im = imagecreatetruecolor( 99, 99 );
imagesetpixel($im, 0, 0, 0xFF); imagesetpixel($im, 0, 0, 0xFF);
imagesetpixel($im, 0, 98, 0x00FF00); imagesetpixel($im, 0, 98, 0x00FF00);
imagesetpixel($im, 98, 0, 0xFF0000); imagesetpixel($im, 98, 0, 0xFF0000);
imagesetpixel($im, 98, 98, 0x0000FF); imagesetpixel($im, 98, 98, 0x0000FF);
imageflip($im, IMG_FLIP_HORIZONTAL); imageflip($im, IMG_FLIP_HORIZONTAL);
imageflip($im, IMG_FLIP_VERTICAL); imageflip($im, IMG_FLIP_VERTICAL);
imageflip($im, IMG_FLIP_BOTH); imageflip($im, IMG_FLIP_BOTH);
var_dump(dechex(imagecolorat($im, 0, 0))); var_dump(dechex(imagecolorat($im, 0, 0)));
var_dump(dechex(imagecolorat($im, 0, 98))); var_dump(dechex(imagecolorat($im, 0, 98)));
var_dump(dechex(imagecolorat($im, 98, 0))); var_dump(dechex(imagecolorat($im, 98, 0)));
var_dump(dechex(imagecolorat($im, 98, 98))); var_dump(dechex(imagecolorat($im, 98, 98)));
?> ?>
--EXPECT-- --EXPECT--
string(2) "ff" string(2) "ff"
string(4) "ff00" string(4) "ff00"
string(6) "ff0000" string(6) "ff0000"
string(2) "ff" string(2) "ff"

View file

@ -1,72 +1,72 @@
--TEST-- --TEST--
Apply imagegammacorrect() to a step wedge Apply imagegammacorrect() to a step wedge
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
test_gamma_both(1, 2); test_gamma_both(1, 2);
test_gamma_both(1, 1); test_gamma_both(1, 1);
test_gamma_both(2, 1); test_gamma_both(2, 1);
function test_gamma_both($in, $out) function test_gamma_both($in, $out)
{ {
test_gamma($in, $out, 'imagecreate'); test_gamma($in, $out, 'imagecreate');
test_gamma($in, $out, 'imagecreatetruecolor'); test_gamma($in, $out, 'imagecreatetruecolor');
} }
function test_gamma($in, $out, $constructor) function test_gamma($in, $out, $constructor)
{ {
$im = $constructor(640, 480); $im = $constructor(640, 480);
for ($j = 0; $j < 4; $j++) { for ($j = 0; $j < 4; $j++) {
for ($i = 0; $i < 32; $i++) { for ($i = 0; $i < 32; $i++) {
draw_cell($im, $i, $j); draw_cell($im, $i, $j);
} }
} }
imagegammacorrect($im, $in, $out); imagegammacorrect($im, $in, $out);
$filename = __DIR__ . DIRECTORY_SEPARATOR $filename = __DIR__ . DIRECTORY_SEPARATOR
. "imagegammacorrect_variation2_{$in}_{$out}.png"; . "imagegammacorrect_variation2_{$in}_{$out}.png";
$kind = $constructor === 'imagecreate' ? 'palette' : 'truecolor'; $kind = $constructor === 'imagecreate' ? 'palette' : 'truecolor';
echo "$kind gamma ($in, $out): "; echo "$kind gamma ($in, $out): ";
test_image_equals_file($filename, $im); test_image_equals_file($filename, $im);
} }
function draw_cell($im, $x, $y) function draw_cell($im, $x, $y)
{ {
$x1 = 20 * $x; $x1 = 20 * $x;
$y1 = 120 * $y; $y1 = 120 * $y;
$x2 = $x1 + 19; $x2 = $x1 + 19;
$y2 = $y1 + 119; $y2 = $y1 + 119;
$color = cell_color($im, $x, $y); $color = cell_color($im, $x, $y);
imagefilledrectangle($im, $x1,$y1, $x2,$y2, $color); imagefilledrectangle($im, $x1,$y1, $x2,$y2, $color);
} }
function cell_color($im, $x, $y) function cell_color($im, $x, $y)
{ {
$channel = 8 * $x + 4; $channel = 8 * $x + 4;
switch ($y) { switch ($y) {
case 0: case 0:
return imagecolorallocate($im, $channel, $channel, $channel); return imagecolorallocate($im, $channel, $channel, $channel);
case 1: case 1:
return imagecolorallocate($im, $channel, 0, 0); return imagecolorallocate($im, $channel, 0, 0);
case 2: case 2:
return imagecolorallocate($im, 0, $channel, 0); return imagecolorallocate($im, 0, $channel, 0);
case 3: case 3:
return imagecolorallocate($im, 0, 0, $channel); return imagecolorallocate($im, 0, 0, $channel);
} }
} }
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
palette gamma (1, 2): The images are equal. palette gamma (1, 2): The images are equal.
truecolor gamma (1, 2): The images are equal. truecolor gamma (1, 2): The images are equal.
palette gamma (1, 1): The images are equal. palette gamma (1, 1): The images are equal.
truecolor gamma (1, 1): The images are equal. truecolor gamma (1, 1): The images are equal.
palette gamma (2, 1): The images are equal. palette gamma (2, 1): The images are equal.
truecolor gamma (2, 1): The images are equal. truecolor gamma (2, 1): The images are equal.
===DONE=== ===DONE===

View file

@ -1,34 +1,34 @@
--TEST-- --TEST--
imagegd() writes truecolor images without palette conversion imagegd() writes truecolor images without palette conversion
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreatetruecolor(10, 10); $im = imagecreatetruecolor(10, 10);
$white = imagecolorallocate($im, 255, 255, 255); $white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0,0, 9,9, $white); imagefilledrectangle($im, 0,0, 9,9, $white);
$blue = imagecolorallocate($im, 0, 0, 255); $blue = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 3,3, 6,6, $blue); imagefilledrectangle($im, 3,3, 6,6, $blue);
ob_start(); ob_start();
imagegd($im); imagegd($im);
$buffer = ob_get_clean(); $buffer = ob_get_clean();
$header = unpack('nsignature/nwidth/nheight/Ctruecolor', $buffer); $header = unpack('nsignature/nwidth/nheight/Ctruecolor', $buffer);
printf("signature: %d\n", $header['signature']); printf("signature: %d\n", $header['signature']);
printf("truecolor: %d\n", $header['truecolor']); printf("truecolor: %d\n", $header['truecolor']);
printf("size: %d\n", strlen($buffer)); printf("size: %d\n", strlen($buffer));
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im); test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im);
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
signature: 65534 signature: 65534
truecolor: 1 truecolor: 1
size: 411 size: 411
The images are equal. The images are equal.
===DONE=== ===DONE===

View file

@ -1,29 +1,29 @@
--TEST-- --TEST--
imageopenpolygon(): basic test imageopenpolygon(): basic test
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreatetruecolor(100, 100); $im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 255, 255, 255); $white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0); $black = imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0); $red = imagecolorallocate($im, 255, 0, 0);
$green = imagecolorallocate($im, 0, 128, 0); $green = imagecolorallocate($im, 0, 128, 0);
$blue = imagecolorallocate($im, 0, 0, 255); $blue = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 0,0, 99,99, $white); imagefilledrectangle($im, 0,0, 99,99, $white);
imageopenpolygon($im, [10,10, 49,89, 89,10], 3, $black); imageopenpolygon($im, [10,10, 49,89, 89,10], 3, $black);
imageopenpolygon($im, [10,89, 35,10, 60,89, 85,10], 4, $red); imageopenpolygon($im, [10,89, 35,10, 60,89, 85,10], 4, $red);
imageopenpolygon($im, [10,49, 30,89, 50,10, 70,89, 90,10], 5, $green); imageopenpolygon($im, [10,49, 30,89, 50,10, 70,89, 90,10], 5, $green);
imageopenpolygon($im, [10,50, 25,10, 40,89, 55,10, 80,89, 90,50], 6, $blue); imageopenpolygon($im, [10,50, 25,10, 40,89, 55,10, 80,89, 90,50], 6, $blue);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im); test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im);
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
The images are equal. The images are equal.
===DONE=== ===DONE===

View file

@ -1,24 +1,24 @@
--TEST-- --TEST--
antialiased imagepolygon() antialiased imagepolygon()
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreatetruecolor(100, 100); $im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 255, 255, 255); $white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0); $black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0,0, 99,99, $white); imagefilledrectangle($im, 0,0, 99,99, $white);
imageantialias($im, true); imageantialias($im, true);
imagepolygon($im, [10,10, 49,89, 89,49], 3, $black); imagepolygon($im, [10,10, 49,89, 89,49], 3, $black);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im); test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im);
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
The images are equal. The images are equal.
===DONE=== ===DONE===

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Testing imagerectangle() of GD library Testing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
include_once __DIR__ . '/func.inc'; include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image); test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
?> ?>
--EXPECT-- --EXPECT--
The images are equal. The images are equal.

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a resource // Create a resource
$image = tmpfile(); $image = tmpfile();
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 50, 50, 2 ); imagerectangle( $image, 0, 0, 50, 50, 2 );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) ); imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) ); imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) ); imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 50, 50, 'wrong param' ); imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
Testing wrong param passing imagerectangle() of GD library Testing wrong param passing imagerectangle() of GD library
--CREDITS-- --CREDITS--
Ivan Rosolen <contato [at] ivanrosolen [dot] com> Ivan Rosolen <contato [at] ivanrosolen [dot] com>
#testfest PHPSP on 2009-06-30 #testfest PHPSP on 2009-06-30
--SKIPIF-- --SKIPIF--
<?php <?php
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
?> ?>
--FILE-- --FILE--
<?php <?php
// Create a image // Create a image
$image = imagecreatetruecolor( 100, 100 ); $image = imagecreatetruecolor( 100, 100 );
// Draw a rectangle // Draw a rectangle
imagerectangle( $image, 0, 0, 50, 50 ); imagerectangle( $image, 0, 0, 50, 50 );
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d

View file

@ -1,42 +1,42 @@
--TEST-- --TEST--
test_image_equals_file(): comparing palette images test_image_equals_file(): comparing palette images
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreate(10, 10); $im = imagecreate(10, 10);
imagecolorallocate($im, 255, 255, 255); imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0); $red = imagecolorallocate($im, 255, 0, 0);
imagefilledrectangle($im, 3,3, 7,7, $red); imagefilledrectangle($im, 3,3, 7,7, $red);
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png'; $filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
imagepng($im, $filename); imagepng($im, $filename);
$im = imagecreate(10, 10); $im = imagecreate(10, 10);
imagecolorallocate($im, 255, 255, 255); imagecolorallocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 0, 0, 255); $blue = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 3,3, 7,7, $blue); imagefilledrectangle($im, 3,3, 7,7, $blue);
test_image_equals_file($filename, $im); test_image_equals_file($filename, $im);
$im = imagecreate(10, 10); $im = imagecreate(10, 10);
imagecolorallocate($im, 255, 255, 255); imagecolorallocate($im, 255, 255, 255);
imagecolorallocate($im, 0, 0, 0); imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0); $red = imagecolorallocate($im, 255, 0, 0);
imagefilledrectangle($im, 3,3, 7,7, $red); imagefilledrectangle($im, 3,3, 7,7, $red);
test_image_equals_file($filename, $im); test_image_equals_file($filename, $im);
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
The images differ in 25 pixels. The images differ in 25 pixels.
The images are equal. The images are equal.
===DONE=== ===DONE===
--CLEAN-- --CLEAN--
<?php <?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png'); unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
?> ?>

View file

@ -1,38 +1,38 @@
--TEST-- --TEST--
imagewebp() and imagecreatefromwebp() - basic test imagewebp() and imagecreatefromwebp() - basic test
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('gd')) die('skip gd extension not available'); if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) { if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
die("skip test requires GD 2.2.0 or higher"); die("skip test requires GD 2.2.0 or higher");
} }
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp')) if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
die('skip WebP support not available'); die('skip WebP support not available');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once __DIR__ . '/similarity.inc'; require_once __DIR__ . '/similarity.inc';
$filename = __DIR__ . '/webp_basic.webp'; $filename = __DIR__ . '/webp_basic.webp';
$im1 = imagecreatetruecolor(75, 75); $im1 = imagecreatetruecolor(75, 75);
$white = imagecolorallocate($im1, 255, 255, 255); $white = imagecolorallocate($im1, 255, 255, 255);
$red = imagecolorallocate($im1, 255, 0, 0); $red = imagecolorallocate($im1, 255, 0, 0);
$green = imagecolorallocate($im1, 0, 255, 0); $green = imagecolorallocate($im1, 0, 255, 0);
$blue = imagecolorallocate($im1, 0, 0, 255); $blue = imagecolorallocate($im1, 0, 0, 255);
imagefilledrectangle($im1, 0, 0, 74, 74, $white); imagefilledrectangle($im1, 0, 0, 74, 74, $white);
imageline($im1, 3, 3, 71, 71, $red); imageline($im1, 3, 3, 71, 71, $red);
imageellipse($im1, 18, 54, 36, 36, $green); imageellipse($im1, 18, 54, 36, 36, $green);
imagerectangle($im1, 41, 3, 71, 33, $blue); imagerectangle($im1, 41, 3, 71, 33, $blue);
imagewebp($im1, $filename); imagewebp($im1, $filename);
$im2 = imagecreatefromwebp($filename); $im2 = imagecreatefromwebp($filename);
imagewebp($im2, $filename); imagewebp($im2, $filename);
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5); var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
@unlink(__DIR__ . '/webp_basic.webp'); @unlink(__DIR__ . '/webp_basic.webp');
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)

View file

@ -1887,7 +1887,7 @@ PHP_FUNCTION(ibase_num_fields)
if (type == le_query) { if (type == le_query) {
ibase_query *ib_query; ibase_query *ib_query;
ib_query = (ibase_query *)zend_fetch_resource_ex(result, LE_QUERY, le_query); ib_query = (ibase_query *)zend_fetch_resource_ex(result, LE_QUERY, le_query);
sqlda = ib_query->out_sqlda; sqlda = ib_query->out_sqlda;
} else { } else {

View file

@ -31,4 +31,4 @@ int(0)
int(0) int(0)
int(0) int(0)
int(1) int(1)
==DONE== ==DONE==

View file

@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000);
--EXPECT-- --EXPECT--
bool(true) bool(true)
bool(true) bool(true)
==DONE== ==DONE==

View file

@ -23,4 +23,4 @@ bool(true)
int(6) int(6)
bool(true) bool(true)
int(5) int(5)
==DONE== ==DONE==

View file

@ -1,41 +1,41 @@
--TEST-- --TEST--
IntlDateFormatter::formatObject(): IntlCalendar tests IntlDateFormatter::formatObject(): IntlCalendar tests
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?> <?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
--FILE-- --FILE--
<?php <?php
ini_set("intl.error_level", E_WARNING); ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT"); ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", "Europe/Lisbon"); ini_set("date.timezone", "Europe/Lisbon");
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon $cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
echo IntlDateFormatter::formatObject($cal), "\n"; echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n"; echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n"; echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00'); $cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n"; echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil'); $cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.); $cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
echo IntlDateFormatter::formatObject($cal), "\n"; echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?> ?>
==DONE== ==DONE==
--EXPECTF-- --EXPECTF--
01/01/2012 00:00:00 01/01/2012 00:00:00
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012 12:00:00 AM Jan 1, 2012 12:00:00 AM
1/1/12 12:00:00 AM Western European %STime 1/1/12 12:00:00 AM Western European %STime
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
06/02/1433 00:00:00 06/02/1433 00:00:00
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
==DONE== ==DONE==

View file

@ -1,10 +1,10 @@
--TEST-- --TEST--
IntlDateFormatter::formatObject(): IntlCalendar tests IntlDateFormatter::formatObject(): IntlCalendar tests
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
--FILE-- --FILE--
<?php <?php
ini_set("intl.error_level", E_WARNING); ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT"); ini_set("intl.default_locale", "pt_PT");
@ -27,8 +27,8 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\
?> ?>
==DONE== ==DONE==
--EXPECTF-- --EXPECTF--
01/01/2012, 00:00:00 01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012, 12:00:00 AM Jan 1, 2012, 12:00:00 AM

View file

@ -1,34 +1,34 @@
--TEST-- --TEST--
IntlDateFormatter::formatObject(): DateTime tests IntlDateFormatter::formatObject(): DateTime tests
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('intl')) die('skip intl extension not enabled') ?> if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?> <?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
--FILE-- --FILE--
<?php <?php
ini_set("intl.error_level", E_WARNING); ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT"); ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", "Europe/Lisbon"); ini_set("date.timezone", "Europe/Lisbon");
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon $dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
echo IntlDateFormatter::formatObject($dt), "\n"; echo IntlDateFormatter::formatObject($dt), "\n";
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n"; echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
$dt = new DateTime('2012-01-01 05:00:00+03:00'); $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?> ?>
==DONE== ==DONE==
--EXPECTF-- --EXPECTF--
01/01/2012 00:00:00 01/01/2012 00:00:00
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012 12:00:00 AM Jan 1, 2012 12:00:00 AM
1/1/12 12:00:00 AM Western European %STime 1/1/12 12:00:00 AM Western European %STime
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
==DONE== ==DONE==

View file

@ -1,10 +1,10 @@
--TEST-- --TEST--
IntlDateFormatter::formatObject(): DateTime tests IntlDateFormatter::formatObject(): DateTime tests
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
--FILE-- --FILE--
<?php <?php
ini_set("intl.error_level", E_WARNING); ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT"); ini_set("intl.default_locale", "pt_PT");
@ -22,8 +22,8 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?> ?>
==DONE== ==DONE==
--EXPECTF-- --EXPECTF--
01/01/2012, 00:00:00 01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
Jan 1, 2012, 12:00:00 AM Jan 1, 2012, 12:00:00 AM

View file

@ -1,10 +1,10 @@
--TEST-- --TEST--
IntlDateFormatter::formatObject(): error conditions IntlDateFormatter::formatObject(): error conditions
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('intl')) if (!extension_loaded('intl'))
die('skip intl extension not enabled'); die('skip intl extension not enabled');
--FILE-- --FILE--
<?php <?php
ini_set("intl.error_level", E_WARNING); ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT"); ini_set("intl.default_locale", "pt_PT");
@ -30,8 +30,8 @@ var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
?> ?>
==DONE== ==DONE==
--EXPECTF-- --EXPECTF--
Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
bool(false) bool(false)
@ -71,4 +71,4 @@ bool(false)
Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
bool(false) bool(false)
==DONE== ==DONE==

View file

@ -28,4 +28,4 @@ IntlTimeZone Object
[rawOffset] => %i [rawOffset] => %i
[currentOffset] => %i [currentOffset] => %i
) )
==DONE== ==DONE==

View file

@ -20,4 +20,4 @@ string(13) "Europe/Lisbon"
bool(true) bool(true)
string(0) "" string(0) ""
bool(false) bool(false)
==DONE== ==DONE==

View file

@ -32,4 +32,4 @@ string(5) "+0000"
string(3) "GMT" string(3) "GMT"
string(3) "GMT" string(3) "GMT"
string(13) "Portugal Time" string(13) "Portugal Time"
==DONE== ==DONE==

View file

@ -1,23 +1,23 @@
--TEST-- --TEST--
Bug #52981 (Unicode properties are outdated (from Unicode 3.2)) Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
--SKIPIF-- --SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE-- --FILE--
<?php <?php
function test($str) function test($str)
{ {
$upper = mb_strtoupper($str, 'UTF-8'); $upper = mb_strtoupper($str, 'UTF-8');
$len = strlen($upper); $len = strlen($upper);
for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' '; for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
echo "\n"; echo "\n";
} }
// OK // OK
test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001) test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
// not OK // not OK
test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005) test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009) test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
--EXPECTF-- --EXPECTF--
f0 90 90 90 f0 90 90 90
e2 b0 80 e2 b0 80
d4 a4 d4 a4

View file

@ -1,58 +1,58 @@
--TEST-- --TEST--
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169 mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
--CREDIT-- --CREDIT--
Ryan Biesemeyer <ryan@yaauie.com> Ryan Biesemeyer <ryan@yaauie.com>
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?> <?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE-- --FILE--
<?php <?php
for( $i=1; $i<=64; $i = $i*2 ){ for( $i=1; $i<=64; $i = $i*2 ){
echo 'Input: '. $i . PHP_EOL; echo 'Input: '. $i . PHP_EOL;
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM ); $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
echo ' Length: ' . strlen( $random ) . PHP_EOL; echo ' Length: ' . strlen( $random ) . PHP_EOL;
echo ' Hex: '. bin2hex( $random ) . PHP_EOL; echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
echo PHP_EOL; echo PHP_EOL;
} }
?> ?>
--EXPECTF-- --EXPECTF--
Input: 1 Input: 1
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 1 Length: 1
Hex: %x Hex: %x
Input: 2 Input: 2
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 2 Length: 2
Hex: %x Hex: %x
Input: 4 Input: 4
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 4 Length: 4
Hex: %x Hex: %x
Input: 8 Input: 8
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 8 Length: 8
Hex: %x Hex: %x
Input: 16 Input: 16
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 16 Length: 16
Hex: %x Hex: %x
Input: 32 Input: 32
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 32 Length: 32
Hex: %x Hex: %x
Input: 64 Input: 64
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 64 Length: 64
Hex: %x Hex: %x

View file

@ -1,66 +1,66 @@
--TEST-- --TEST--
Bug #53503 (mysqli::query returns false after successful LOAD DATA query) Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die("skip Cannot connect to MySQL"); die("skip Cannot connect to MySQL");
include_once("local_infile_tools.inc"); include_once("local_infile_tools.inc");
if ($msg = check_local_infile_support($link, $engine)) if ($msg = check_local_infile_support($link, $engine))
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error)); die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
mysqli_close($link); mysqli_close($link);
?> ?>
--FILE-- --FILE--
<?php <?php
require_once("connect.inc"); require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
} }
if (!$link->query("DROP TABLE IF EXISTS test")) { if (!$link->query("DROP TABLE IF EXISTS test")) {
printf("[002] [%d] %s\n", $link->errno, $link->error); printf("[002] [%d] %s\n", $link->errno, $link->error);
} }
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) { if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
printf("[003] [%d] %s\n", $link->errno, $link->error); printf("[003] [%d] %s\n", $link->errno, $link->error);
} }
if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n")) if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
printf("[004] Failed to create CVS file\n"); printf("[004] Failed to create CVS file\n");
if (!$link->query("SELECT 1 FROM DUAL")) if (!$link->query("SELECT 1 FROM DUAL"))
printf("[005] [%d] %s\n", $link->errno, $link->error); printf("[005] [%d] %s\n", $link->errno, $link->error);
if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) { if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
printf("[006] [%d] %s\n", $link->errno, $link->error); printf("[006] [%d] %s\n", $link->errno, $link->error);
echo "bug"; echo "bug";
} else { } else {
echo "done"; echo "done";
} }
$link->close(); $link->close();
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
require_once('connect.inc'); require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket); $host, $user, $db, $port, $socket);
} }
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) { if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
} }
$link->close(); $link->close();
unlink('bug53503.data'); unlink('bug53503.data');
?> ?>
--EXPECT-- --EXPECT--
done done

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
Bug #55653 PS crash with libmysql when binding same variable as param and out Bug #55653 PS crash with libmysql when binding same variable as param and out
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once("connect.inc"); require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
} }
$in_and_out = "a"; $in_and_out = "a";
if (!($stmt = $link->stmt_init())) if (!($stmt = $link->stmt_init()))
printf("[002] [%d] %s\n", $link->errno, $link->error); printf("[002] [%d] %s\n", $link->errno, $link->error);
if (!($stmt->prepare("SELECT ?")) || if (!($stmt->prepare("SELECT ?")) ||
!($stmt->bind_param("s", $in_and_out)) || !($stmt->bind_param("s", $in_and_out)) ||
!($stmt->execute()) || !($stmt->execute()) ||
!($stmt->bind_result($in_and_out))) !($stmt->bind_result($in_and_out)))
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
if (!$stmt->fetch()) if (!$stmt->fetch())
printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
if ("a" !== $in_and_out) if ("a" !== $in_and_out)
printf("[005] Wrong result: '%s'\n", $in_and_out); printf("[005] Wrong result: '%s'\n", $in_and_out);
echo "done!"; echo "done!";
?> ?>
--EXPECT-- --EXPECT--
done! done!

View file

@ -1,20 +1,20 @@
--TEST-- --TEST--
Bug #55859 mysqli->stat property access gives error Bug #55859 mysqli->stat property access gives error
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once("connect.inc"); require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
} }
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat)); var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
echo "done!"; echo "done!";
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)
done! done!

View file

@ -1,40 +1,40 @@
--TEST-- --TEST--
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset() Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once('skipifconnectfailure.inc'); require_once('skipifconnectfailure.inc');
?> ?>
--FILE-- --FILE--
<?php <?php
require_once("connect.inc"); require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
} }
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) { if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
} }
if (FALSE === $stmt->execute()) { if (FALSE === $stmt->execute()) {
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error); printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
} }
if (FALSE === $stmt->store_result()) { if (FALSE === $stmt->store_result()) {
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
} }
$one = NULL; $one = NULL;
if (FALSE === $stmt->bind_result($one)) { if (FALSE === $stmt->bind_result($one)) {
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
} }
if (FALSE === $stmt->reset()) { if (FALSE === $stmt->reset()) {
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
} }
while ($stmt->fetch()) { while ($stmt->fetch()) {
var_dump($one); var_dump($one);
} }
$stmt->close(); $stmt->close();
$link->close(); $link->close();
echo "done!"; echo "done!";
?> ?>
--EXPECT-- --EXPECT--
int(42) int(42)
done! done!

View file

@ -1,26 +1,26 @@
--TEST-- --TEST--
Bug #62885 (mysqli_poll - Segmentation fault) Bug #62885 (mysqli_poll - Segmentation fault)
--SKIPIF-- --SKIPIF--
<?php <?php
require_once('skipif.inc'); require_once('skipif.inc');
require_once("connect.inc"); require_once("connect.inc");
if (!$IS_MYSQLND) { if (!$IS_MYSQLND) {
die("skip mysqlnd only test"); die("skip mysqlnd only test");
} }
?> ?>
--FILE-- --FILE--
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
$tablica = array(); $tablica = array();
$test1 = mysqli_poll($test2, $test3, $tablica, null); $test1 = mysqli_poll($test2, $test3, $tablica, null);
$test2 = array(); $test2 = array();
$test2 = array(); $test2 = array();
$test1 = mysqli_poll($test2, $test3, $tablica, null); $test1 = mysqli_poll($test2, $test3, $tablica, null);
echo "okey"; echo "okey";
?> ?>
--EXPECTF-- --EXPECTF--
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
okey okey

View file

@ -1,96 +1,96 @@
--TEST-- --TEST--
Bug #72524 (Binding null values triggers ORA-24816 error) Bug #72524 (Binding null values triggers ORA-24816 error)
--SKIPIF-- --SKIPIF--
<?php <?php
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs $target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc'); require(dirname(__FILE__).'/skipif.inc');
?> ?>
--FILE-- --FILE--
<?php <?php
require(dirname(__FILE__).'/connect.inc'); require(dirname(__FILE__).'/connect.inc');
// Initialize // Initialize
$stmtarray = array( $stmtarray = array(
"CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)" "CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
); );
oci8_test_sql_execute($c, $stmtarray); oci8_test_sql_execute($c, $stmtarray);
// Run test // Run test
$sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)"; $sql = "INSERT INTO mytable VALUES (:clob_col, :varchar2_col)";
echo "Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default\n"; echo "Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default\n";
$stmt = oci_parse($c, $sql); $stmt = oci_parse($c, $sql);
$clob = NULL; $clob = NULL;
$varchar2 = NULL; $varchar2 = NULL;
oci_bind_by_name($stmt, ':clob_col', $clob); oci_bind_by_name($stmt, ':clob_col', $clob);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2); oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
var_dump(oci_execute($stmt)); var_dump(oci_execute($stmt));
echo "Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default\n"; echo "Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default\n";
$clob = ''; $clob = '';
$varchar2 = ''; $varchar2 = '';
oci_bind_by_name($stmt, ':clob_col', $clob); oci_bind_by_name($stmt, ':clob_col', $clob);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2); oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
var_dump(oci_execute($stmt)); var_dump(oci_execute($stmt));
echo "Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default\n"; echo "Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default\n";
$clob = 'abc'; $clob = 'abc';
$varchar2 = 'abc'; $varchar2 = 'abc';
oci_bind_by_name($stmt, ':clob_col', $clob, 0); oci_bind_by_name($stmt, ':clob_col', $clob, 0);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0); oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
var_dump(oci_execute($stmt)); var_dump(oci_execute($stmt));
echo "Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default\n"; echo "Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default\n";
$clob = NULL; $clob = NULL;
$varchar2 = NULL; $varchar2 = NULL;
oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG); oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG); oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
var_dump(oci_execute($stmt)); var_dump(oci_execute($stmt));
echo "Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default\n"; echo "Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default\n";
$clob = NULL; $clob = NULL;
$varchar2 = NULL; $varchar2 = NULL;
oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG); oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG); oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
var_dump(oci_execute($stmt)); var_dump(oci_execute($stmt));
// Cleanup // Cleanup
$stmtarray = array( $stmtarray = array(
"DROP TABLE mytable" "DROP TABLE mytable"
); );
oci8_test_sql_execute($c, $stmtarray); oci8_test_sql_execute($c, $stmtarray);
?> ?>
===DONE=== ===DONE===
<?php exit(0); ?> <?php exit(0); ?>
--EXPECTF-- --EXPECTF--
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
bool(true) bool(true)
Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
bool(true) bool(true)
Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
bool(true) bool(true)
Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default Test 4 - P1 Value: NULL P1 Length: -1 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: -1 P2 Type:Default
Warning: oci_execute(): ORA-24816: %s in %s on line %d Warning: oci_execute(): ORA-24816: %s in %s on line %d
bool(false) bool(false)
Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2 Length: 0 P2 Type:Default
Warning: oci_execute(): ORA-24816: %s in %s on line %d Warning: oci_execute(): ORA-24816: %s in %s on line %d
bool(false) bool(false)
===DONE=== ===DONE===

View file

@ -1,12 +1,12 @@
--TEST-- --TEST--
Bug #61124: Segmentation fault with openssl_decrypt Bug #61124: Segmentation fault with openssl_decrypt
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded("openssl")) die("skip"); if (!extension_loaded("openssl")) die("skip");
--FILE-- --FILE--
<?php <?php
var_dump(openssl_decrypt('kzo w2RMExUTYQXW2Xzxmg==', 'aes-128-cbc', 'pass', false, 'pass')); var_dump(openssl_decrypt('kzo w2RMExUTYQXW2Xzxmg==', 'aes-128-cbc', 'pass', false, 'pass'));
--EXPECTF-- --EXPECTF--
Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0 in %s on line %d Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0 in %s on line %d
bool(false) bool(false)

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Bug #66501: EC private key support in openssl_sign Bug #66501: EC private key support in openssl_sign
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded("openssl")) die("skip"); if (!extension_loaded("openssl")) die("skip");
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available"); if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
--FILE-- --FILE--
<?php <?php
$pkey = 'ASN1 OID: prime256v1 $pkey = 'ASN1 OID: prime256v1
-----BEGIN EC PARAMETERS----- -----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw== BggqhkjOPQMBBw==
-----END EC PARAMETERS----- -----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY----- -----BEGIN EC PRIVATE KEY-----
MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49 MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug== sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
-----END EC PRIVATE KEY-----'; -----END EC PRIVATE KEY-----';
$key = openssl_pkey_get_private($pkey); $key = openssl_pkey_get_private($pkey);
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1'); $res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
var_dump($res); var_dump($res);
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,42 +1,42 @@
--TEST-- --TEST--
Bug #69864 (Segfault in preg_replace_callback) Bug #69864 (Segfault in preg_replace_callback)
--SKIPIF-- --SKIPIF--
<?php <?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
?> ?>
--FILE-- --FILE--
<?php <?php
/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */ /* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
var_dump(preg_replace_callback('/a/', function($m) { var_dump(preg_replace_callback('/a/', function($m) {
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
} }
return 'b'; return 'b';
}, 'aa')); }, 'aa'));
var_dump(preg_replace_callback('/a/', function($m) { var_dump(preg_replace_callback('/a/', function($m) {
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???'); preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
} }
return 'b'; return 'b';
}, 'aa')); }, 'aa'));
var_dump(preg_replace_callback('/a/', function($m) { var_dump(preg_replace_callback('/a/', function($m) {
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
} }
return 'b'; return 'b';
}, 'aa')); }, 'aa'));
var_dump(preg_replace_callback('/a/', function($m) { var_dump(preg_replace_callback('/a/', function($m) {
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']); preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
} }
return 'b'; return 'b';
}, 'aa')); }, 'aa'));
?> ?>
--EXPECT-- --EXPECT--
string(2) "bb" string(2) "bb"
string(2) "bb" string(2) "bb"
string(2) "bb" string(2) "bb"
string(2) "bb" string(2) "bb"

View file

@ -1,33 +1,33 @@
--TEST-- --TEST--
PDO_MYSQL: Defining a connection charset in the DSN PDO_MYSQL: Defining a connection charset in the DSN
--SKIPIF-- --SKIPIF--
<?php <?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip(); MySQLPDOTest::skip();
?> ?>
--FILE-- --FILE--
<?php <?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
/* Connect to mysql to determine the current charset so we can diffinate it */ /* Connect to mysql to determine the current charset so we can diffinate it */
$link = MySQLPDOTest::factory(); $link = MySQLPDOTest::factory();
$charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value; $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
/* Make sure that we don't attempt to set the current character set to make this case useful */ /* Make sure that we don't attempt to set the current character set to make this case useful */
$new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1'); $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
/* Done with the original connection, create a second link to test the character set being defined */ /* Done with the original connection, create a second link to test the character set being defined */
unset($link); unset($link);
$link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset)); $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
$conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value; $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
if ($charset !== $conn_charset) { if ($charset !== $conn_charset) {
echo "done!\n"; echo "done!\n";
} else { } else {
echo "failed!\n"; echo "failed!\n";
} }
?> ?>
--EXPECTF-- --EXPECTF--
done! done!

View file

@ -1,78 +1,78 @@
--TEST-- --TEST--
PostgreSQL non-blocking async query params PostgreSQL non-blocking async query params
--SKIPIF-- --SKIPIF--
<?php <?php
include("skipif.inc"); include("skipif.inc");
if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist'); if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
?> ?>
--FILE-- --FILE--
<?php <?php
include('config.inc'); include('config.inc');
include('nonblocking.inc'); include('nonblocking.inc');
$db = pg_connect($conn_str); $db = pg_connect($conn_str);
$version = pg_version($db); $version = pg_version($db);
if ($version['protocol'] < 3) { if ($version['protocol'] < 3) {
echo "OK"; echo "OK";
exit(0); exit(0);
} }
$db_socket = pg_socket($db); $db_socket = pg_socket($db);
stream_set_blocking($db_socket, false); stream_set_blocking($db_socket, false);
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)); $sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
if ($sent === FALSE) { if ($sent === FALSE) {
echo "pg_send_query_params() error\n"; echo "pg_send_query_params() error\n";
} elseif ($sent === 0) { } elseif ($sent === 0) {
nb_flush($db, $db_socket); nb_flush($db, $db_socket);
} }
nb_consume($db, $db_socket); nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) { if (!($result = pg_get_result($db))) {
echo "pg_get_result() error\n"; echo "pg_get_result() error\n";
} }
if (!($rows = pg_num_rows($result))) { if (!($rows = pg_num_rows($result))) {
echo "pg_num_rows() error\n"; echo "pg_num_rows() error\n";
} }
for ($i=0; $i < $rows; $i++) { for ($i=0; $i < $rows; $i++) {
pg_fetch_array($result, $i, PGSQL_NUM); pg_fetch_array($result, $i, PGSQL_NUM);
} }
for ($i=0; $i < $rows; $i++) { for ($i=0; $i < $rows; $i++) {
pg_fetch_object($result); pg_fetch_object($result);
} }
for ($i=0; $i < $rows; $i++) { for ($i=0; $i < $rows; $i++) {
pg_fetch_row($result, $i); pg_fetch_row($result, $i);
} }
for ($i=0; $i < $rows; $i++) { for ($i=0; $i < $rows; $i++) {
pg_fetch_result($result, $i, 0); pg_fetch_result($result, $i, 0);
} }
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
pg_field_name($result, 0); pg_field_name($result, 0);
pg_field_num($result, $field_name); pg_field_num($result, $field_name);
pg_field_size($result, 0); pg_field_size($result, 0);
pg_field_type($result, 0); pg_field_type($result, 0);
pg_field_prtlen($result, 0); pg_field_prtlen($result, 0);
pg_field_is_null($result, 0); pg_field_is_null($result, 0);
$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")); $sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
if ($sent === FALSE) { if ($sent === FALSE) {
echo "pg_send_query_params() error\n"; echo "pg_send_query_params() error\n";
} elseif ($sent === 0) { } elseif ($sent === 0) {
nb_flush($db, $db_socket); nb_flush($db, $db_socket);
} }
pg_last_oid($result); pg_last_oid($result);
pg_free_result($result); pg_free_result($result);
pg_close($db); pg_close($db);
echo "OK"; echo "OK";
?> ?>
--EXPECT-- --EXPECT--
OK OK

View file

@ -1,28 +1,28 @@
--TEST-- --TEST--
bug#53872 (internal corruption of phar) bug#53872 (internal corruption of phar)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded("phar")) die("skip"); if (!extension_loaded("phar")) die("skip");
if (!extension_loaded("zlib")) die("skip Test needs ext/zlib"); if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
?> ?>
--INI-- --INI--
phar.readonly=0 phar.readonly=0
--FILE-- --FILE--
<?php <?php
$p=new Phar('bug53872-phar.phar'); $p=new Phar('bug53872-phar.phar');
$p->buildFromDirectory(__DIR__ . "/bug53872/"); $p->buildFromDirectory(__DIR__ . "/bug53872/");
$p->setStub('<?php __HALT_COMPILER();?\>'); $p->setStub('<?php __HALT_COMPILER();?\>');
$p->compressFiles(Phar::GZ); $p->compressFiles(Phar::GZ);
print(file_get_contents('phar://bug53872-phar.phar/first.txt')); print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
print(file_get_contents('phar://bug53872-phar.phar/second.txt')); print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
print(file_get_contents('phar://bug53872-phar.phar/third.txt')); print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
?> ?>
--CLEAN-- --CLEAN--
<?php <?php
unlink("bug53872-phar.phar"); unlink("bug53872-phar.phar");
?> ?>
--EXPECT-- --EXPECT--
content of first.txt content of first.txt
content of third.txt content of third.txt

View file

@ -1,48 +1,48 @@
--TEST-- --TEST--
Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); <?php if (!extension_loaded("phar")) die("skip");
if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows."); if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
?> ?>
--INI-- --INI--
phar.readonly=0 phar.readonly=0
--FILE-- --FILE--
<?php <?php
Phar::interceptFileFuncs(); Phar::interceptFileFuncs();
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php'; $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");'); file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
file_put_contents($pname . '/foo/hi', '<?php file_put_contents($pname . '/foo/hi', '<?php
include "' . addslashes($fname2) . '"; include "' . addslashes($fname2) . '";
readfile("foo/hi"); readfile("foo/hi");
fopen("foo/hi", "r"); fopen("foo/hi", "r");
echo file_get_contents("foo/hi"); echo file_get_contents("foo/hi");
var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi")); var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
opendir("foo/hi"); opendir("foo/hi");
?> ?>
'); ');
include $pname . '/foo/hi'; include $pname . '/foo/hi';
?> ?>
===DONE=== ===DONE===
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
--EXPECTF-- --EXPECTF--
Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
bool(false) bool(false)
bool(false) bool(false)
bool(false) bool(false)
bool(false) bool(false)
bool(false) bool(false)
Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
===DONE=== ===DONE===

View file

@ -1,76 +1,76 @@
--TEST-- --TEST--
ReflectionParameter class - canBePassedByValue() method. ReflectionParameter class - canBePassedByValue() method.
--FILE-- --FILE--
<?php <?php
function aux($fun) { function aux($fun) {
$func = new ReflectionFunction($fun); $func = new ReflectionFunction($fun);
$parameters = $func->getParameters(); $parameters = $func->getParameters();
foreach($parameters as $parameter) { foreach($parameters as $parameter) {
echo "Name: ", $parameter->getName(), "\n"; echo "Name: ", $parameter->getName(), "\n";
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n"; echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n"; echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
echo "\n"; echo "\n";
} }
} }
echo "=> array_multisort:\n\n"; echo "=> array_multisort:\n\n";
aux('array_multisort'); aux('array_multisort');
echo "=> sort:\n\n"; echo "=> sort:\n\n";
aux('sort'); aux('sort');
echo "=> user function:\n\n"; echo "=> user function:\n\n";
function ufunc(&$arg1, $arg2) {} function ufunc(&$arg1, $arg2) {}
aux('ufunc'); aux('ufunc');
echo "Done.\n"; echo "Done.\n";
?> ?>
--EXPECTF-- --EXPECTF--
=> array_multisort: => array_multisort:
Name: arr1 Name: arr1
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: yes Can be passed by value: yes
Name: sort_order Name: sort_order
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: yes Can be passed by value: yes
Name: sort_flags Name: sort_flags
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: yes Can be passed by value: yes
Name: arr2 Name: arr2
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: yes Can be passed by value: yes
=> sort: => sort:
Name: arg Name: arg
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: no Can be passed by value: no
Name: sort_flags Name: sort_flags
Is passed by reference: no Is passed by reference: no
Can be passed by value: yes Can be passed by value: yes
=> user function: => user function:
Name: arg1 Name: arg1
Is passed by reference: yes Is passed by reference: yes
Can be passed by value: no Can be passed by value: no
Name: arg2 Name: arg2
Is passed by reference: no Is passed by reference: no
Can be passed by value: yes Can be passed by value: yes
Done. Done.

View file

@ -1,34 +1,34 @@
--TEST-- --TEST--
ReflectionParameter::isDefault() ReflectionParameter::isDefault()
--FILE-- --FILE--
<?php <?php
class A { class A {
public $defprop; public $defprop;
} }
$a = new A; $a = new A;
$a->myprop = null; $a->myprop = null;
$ro = new ReflectionObject($a); $ro = new ReflectionObject($a);
$props = $ro->getProperties(); $props = $ro->getProperties();
$prop1 = $props[0]; $prop1 = $props[0];
var_dump($prop1->isDefault()); var_dump($prop1->isDefault());
$prop2 = $props[1]; $prop2 = $props[1];
var_dump($prop2->isDefault()); var_dump($prop2->isDefault());
var_dump($ro->getProperty('defprop')->isDefault()); var_dump($ro->getProperty('defprop')->isDefault());
var_dump($ro->getProperty('myprop')->isDefault()); var_dump($ro->getProperty('myprop')->isDefault());
$prop1 = new ReflectionProperty($a, 'defprop'); $prop1 = new ReflectionProperty($a, 'defprop');
$prop2 = new ReflectionProperty($a, 'myprop'); $prop2 = new ReflectionProperty($a, 'myprop');
var_dump($prop1->isDefault()); var_dump($prop1->isDefault());
var_dump($prop2->isDefault()); var_dump($prop2->isDefault());
?> ?>
==DONE== ==DONE==
--EXPECT-- --EXPECT--
bool(true) bool(true)
bool(false) bool(false)
bool(true) bool(true)
bool(false) bool(false)
bool(true) bool(true)
bool(false) bool(false)
==DONE== ==DONE==

View file

@ -1,42 +1,42 @@
--TEST-- --TEST--
Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n) Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
--SKIPIF-- --SKIPIF--
<?php include('skipif.inc'); ?> <?php include('skipif.inc'); ?>
--INI-- --INI--
session.use_trans_sid=1 session.use_trans_sid=1
session.use_cookies=0 session.use_cookies=0
session.use_only_cookies=0 session.use_only_cookies=0
session.name=sid session.name=sid
--FILE-- --FILE--
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
session_start(); session_start();
# Do not remove \r from this tests, they are essential! # Do not remove \r from this tests, they are essential!
?> ?>
<html> <html>
<head> <head>
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title> <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
</head> </head>
<body> <body>
<p>See source html code</p> <p>See source html code</p>
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
style="font: normal 11pt Times New Roman">incorrect link</a><br /> style="font: normal 11pt Times New Roman">incorrect link</a><br />
<br /> <br />
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a> <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
</body> </body>
</html> </html>
--EXPECTF-- --EXPECTF--
<html> <html>
<head> <head>
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title> <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
</head> </head>
<body> <body>
<p>See source html code</p> <p>See source html code</p>
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
style="font: normal 11pt Times New Roman">incorrect link</a><br /> style="font: normal 11pt Times New Roman">incorrect link</a><br />
<br /> <br />
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a> <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
</body> </body>
</html> </html>

View file

@ -1,22 +1,22 @@
--TEST-- --TEST--
Bug #51958: socket_accept() fails on IPv6 server sockets Bug #51958: socket_accept() fails on IPv6 server sockets
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sockets')) { if (!extension_loaded('sockets')) {
die('skip sockets extension not available.'); die('skip sockets extension not available.');
} }
if (!defined('IPPROTO_IPV6')) { if (!defined('IPPROTO_IPV6')) {
die('skip IPv6 not available.'); die('skip IPv6 not available.');
} }
if (PHP_OS != "WINNT") if (PHP_OS != "WINNT")
die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN'); die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
--FILE-- --FILE--
<?php <?php
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP); $listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
socket_bind($listenfd, "::1", 13579); socket_bind($listenfd, "::1", 13579);
socket_listen($listenfd); socket_listen($listenfd);
socket_set_nonblock($listenfd); socket_set_nonblock($listenfd);
$connfd = @socket_accept($listenfd); $connfd = @socket_accept($listenfd);
echo socket_last_error(); echo socket_last_error();
--EXPECT-- --EXPECT--
10035 10035

View file

@ -1,197 +1,197 @@
--TEST-- --TEST--
Multicast support: IPv4 receive options Multicast support: IPv4 receive options
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sockets')) { if (!extension_loaded('sockets')) {
die('skip sockets extension not available.'); die('skip sockets extension not available.');
} }
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$br = socket_bind($s, '0.0.0.0', 3000); $br = socket_bind($s, '0.0.0.0', 3000);
$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
"group" => '224.0.0.23', "group" => '224.0.0.23',
"interface" => 'lo', "interface" => 'lo',
)); ));
if ($so === false) { if ($so === false) {
die('skip interface \'lo\' is unavailable.'); die('skip interface \'lo\' is unavailable.');
} }
if (!defined("MCAST_BLOCK_SOURCE")) { if (!defined("MCAST_BLOCK_SOURCE")) {
die('skip source operations are unavailable'); die('skip source operations are unavailable');
} }
--FILE-- --FILE--
<?php <?php
include __DIR__."/mcast_helpers.php.inc"; include __DIR__."/mcast_helpers.php.inc";
$domain = AF_INET; $domain = AF_INET;
$level = IPPROTO_IP; $level = IPPROTO_IP;
$interface = "lo"; $interface = "lo";
$mcastaddr = '224.0.0.23'; $mcastaddr = '224.0.0.23';
$sblock = "127.0.0.1"; $sblock = "127.0.0.1";
echo "creating send socket bound to 127.0.0.1\n"; echo "creating send socket bound to 127.0.0.1\n";
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP); $sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
$br = socket_bind($sends1, '127.0.0.1'); $br = socket_bind($sends1, '127.0.0.1');
var_dump($br); var_dump($br);
echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n"; echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP); $sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
var_dump($br); var_dump($br);
echo "creating receive socket\n"; echo "creating receive socket\n";
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP); $s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
var_dump($s); var_dump($s);
$br = socket_bind($s, '0.0.0.0', 3000); $br = socket_bind($s, '0.0.0.0', 3000);
var_dump($br); var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$i = 0; $i = 0;
checktimeout($s, 500); checktimeout($s, 500);
while (($str = socket_read($s, 3000)) !== FALSE) { while (($str = socket_read($s, 3000)) !== FALSE) {
$i++; $i++;
echo "$i> ", $str, "\n"; echo "$i> ", $str, "\n";
if ($i == 1) { if ($i == 1) {
echo "leaving group\n"; echo "leaving group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 2) { if ($i == 2) {
echo "re-joining group\n"; echo "re-joining group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 3) { if ($i == 3) {
echo "blocking source\n"; echo "blocking source\n";
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array( $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 4) { if ($i == 4) {
echo "unblocking source\n"; echo "unblocking source\n";
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array( $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 5) { if ($i == 5) {
echo "leaving group\n"; echo "leaving group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 6) { if ($i == 6) {
echo "joining source group\n"; echo "joining source group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 7) { if ($i == 7) {
echo "leaving source group\n"; echo "leaving source group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 8) { if ($i == 8) {
/* echo "rjsg\n"; /* echo "rjsg\n";
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so);*/ var_dump($so);*/
break; break;
} }
} }
--EXPECTF-- --EXPECTF--
creating send socket bound to 127.0.0.1 creating send socket bound to 127.0.0.1
bool(true) bool(true)
creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23 creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
bool(true) bool(true)
creating receive socket creating receive socket
resource(%d) of type (Socket) resource(%d) of type (Socket)
bool(true) bool(true)
bool(true) bool(true)
int(14) int(14)
1> initial packet 1> initial packet
leaving group leaving group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
2> unicast packet 2> unicast packet
re-joining group re-joining group
bool(true) bool(true)
int(42) int(42)
int(12) int(12)
3> mcast packet 3> mcast packet
blocking source blocking source
bool(true) bool(true)
int(31) int(31)
int(14) int(14)
4> unicast packet 4> unicast packet
unblocking source unblocking source
bool(true) bool(true)
int(27) int(27)
5> mcast packet from 127.0.0.1 5> mcast packet from 127.0.0.1
leaving group leaving group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
6> unicast packet 6> unicast packet
joining source group joining source group
bool(true) bool(true)
int(27) int(27)
7> mcast packet from 127.0.0.1 7> mcast packet from 127.0.0.1
leaving source group leaving source group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
8> unicast packet 8> unicast packet

View file

@ -1,226 +1,226 @@
--TEST-- --TEST--
Multicast support: IPv6 receive options Multicast support: IPv6 receive options
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sockets')) { if (!extension_loaded('sockets')) {
die('skip sockets extension not available.'); die('skip sockets extension not available.');
} }
if (!defined('IPPROTO_IPV6')) { if (!defined('IPPROTO_IPV6')) {
die('skip IPv6 not available.'); die('skip IPv6 not available.');
} }
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP); $s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
if ($s === false) { if ($s === false) {
die("skip unable to create socket"); die("skip unable to create socket");
} }
$br = socket_bind($s, '::', 3000); $br = socket_bind($s, '::', 3000);
/* On Linux, there is no route ff00::/8 by default on lo, which makes it /* On Linux, there is no route ff00::/8 by default on lo, which makes it
* troublesome to send multicast traffic from lo, which we must since * troublesome to send multicast traffic from lo, which we must since
* we're dealing with interface-local traffic... */ * we're dealing with interface-local traffic... */
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
)); ));
if ($so === false) { if ($so === false) {
die('skip unable to join multicast group on any interface.'); die('skip unable to join multicast group on any interface.');
} }
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000); $r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
if ($r === false) { if ($r === false) {
die('skip unable to send multicast packet.'); die('skip unable to send multicast packet.');
} }
if (!defined("MCAST_JOIN_SOURCE_GROUP")) if (!defined("MCAST_JOIN_SOURCE_GROUP"))
die('skip source operations are unavailable'); die('skip source operations are unavailable');
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
)); ));
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
"source" => '2001::dead:beef', "source" => '2001::dead:beef',
)); ));
if ($so === false) { if ($so === false) {
die('skip protocol independent multicast API is unavailable.'); die('skip protocol independent multicast API is unavailable.');
} }
--FILE-- --FILE--
<?php <?php
include __DIR__."/mcast_helpers.php.inc"; include __DIR__."/mcast_helpers.php.inc";
$domain = AF_INET6; $domain = AF_INET6;
$level = IPPROTO_IPV6; $level = IPPROTO_IPV6;
$interface = 0; $interface = 0;
$mcastaddr = 'ff01::114'; $mcastaddr = 'ff01::114';
$sblock = "?"; $sblock = "?";
echo "creating send socket\n"; echo "creating send socket\n";
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); $sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
var_dump($sends1); var_dump($sends1);
echo "creating receive socket\n"; echo "creating receive socket\n";
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); $s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
var_dump($s); var_dump($s);
$br = socket_bind($s, '::0', 3000) or die("err"); $br = socket_bind($s, '::0', 3000) or die("err");
var_dump($br); var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)) or die("err"); )) or die("err");
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
checktimeout($s, 500); checktimeout($s, 500);
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort); $r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
var_dump($r, $str, $from); var_dump($r, $str, $from);
$sblock = $from; $sblock = $from;
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$i = 0; $i = 0;
checktimeout($s, 500); checktimeout($s, 500);
while (($str = socket_read($s, 3000)) !== FALSE) { while (($str = socket_read($s, 3000)) !== FALSE) {
$i++; $i++;
echo "$i> ", $str, "\n"; echo "$i> ", $str, "\n";
if ($i == 1) { if ($i == 1) {
echo "leaving group\n"; echo "leaving group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 2) { if ($i == 2) {
echo "re-joining group\n"; echo "re-joining group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 3) { if ($i == 3) {
echo "blocking source\n"; echo "blocking source\n";
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array( $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 4) { if ($i == 4) {
echo "unblocking source\n"; echo "unblocking source\n";
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array( $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 5) { if ($i == 5) {
echo "leaving group\n"; echo "leaving group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 6) { if ($i == 6) {
echo "joining source group\n"; echo "joining source group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 7) { if ($i == 7) {
echo "leaving source group\n"; echo "leaving source group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 8) { if ($i == 8) {
/*echo "joining source group\n"; /*echo "joining source group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
"source" => $sblock, "source" => $sblock,
)); ));
var_dump($so);*/ var_dump($so);*/
break; break;
} }
} }
--EXPECTF-- --EXPECTF--
creating send socket creating send socket
resource(%d) of type (Socket) resource(%d) of type (Socket)
creating receive socket creating receive socket
resource(%d) of type (Socket) resource(%d) of type (Socket)
bool(true) bool(true)
bool(true) bool(true)
int(14) int(14)
int(14) int(14)
string(14) "testing packet" string(14) "testing packet"
string(%d) "%s" string(%d) "%s"
int(14) int(14)
1> initial packet 1> initial packet
leaving group leaving group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
2> unicast packet 2> unicast packet
re-joining group re-joining group
bool(true) bool(true)
int(12) int(12)
3> mcast packet 3> mcast packet
blocking source blocking source
bool(true) bool(true)
int(31) int(31)
int(14) int(14)
4> unicast packet 4> unicast packet
unblocking source unblocking source
bool(true) bool(true)
int(12) int(12)
5> mcast packet 5> mcast packet
leaving group leaving group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
6> unicast packet 6> unicast packet
joining source group joining source group
bool(true) bool(true)
int(32) int(32)
7> mcast packet from desired source 7> mcast packet from desired source
leaving source group leaving source group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
8> unicast packet 8> unicast packet

View file

@ -1,131 +1,131 @@
--TEST-- --TEST--
Multicast support: IPv6 receive options (limited) Multicast support: IPv6 receive options (limited)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sockets')) { if (!extension_loaded('sockets')) {
die('skip sockets extension not available.'); die('skip sockets extension not available.');
} }
if (!defined('IPPROTO_IPV6')) { if (!defined('IPPROTO_IPV6')) {
die('skip IPv6 not available.'); die('skip IPv6 not available.');
} }
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP); $s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
$br = socket_bind($s, '::', 3000); $br = socket_bind($s, '::', 3000);
/* On Linux, there is no route ff00::/8 by default on lo, which makes it /* On Linux, there is no route ff00::/8 by default on lo, which makes it
* troublesome to send multicast traffic from lo, which we must since * troublesome to send multicast traffic from lo, which we must since
* we're dealing with interface-local traffic... */ * we're dealing with interface-local traffic... */
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
)); ));
if ($so === false) { if ($so === false) {
die('skip unable to join multicast group on any interface.'); die('skip unable to join multicast group on any interface.');
} }
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000); $r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
if ($r === false) { if ($r === false) {
die('skip unable to send multicast packet.'); die('skip unable to send multicast packet.');
} }
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
)); ));
if (defined("MCAST_JOIN_SOURCE_GROUP")) { if (defined("MCAST_JOIN_SOURCE_GROUP")) {
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array( $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
"group" => 'ff01::114', "group" => 'ff01::114',
"interface" => 0, "interface" => 0,
"source" => '2001::dead:beef', "source" => '2001::dead:beef',
)); ));
if ($so !== false) { if ($so !== false) {
die('skip protocol independent multicast API is available.'); die('skip protocol independent multicast API is available.');
} }
} }
--FILE-- --FILE--
<?php <?php
include __DIR__."/mcast_helpers.php.inc"; include __DIR__."/mcast_helpers.php.inc";
$domain = AF_INET6; $domain = AF_INET6;
$level = IPPROTO_IPV6; $level = IPPROTO_IPV6;
$interface = 0; $interface = 0;
$mcastaddr = 'ff01::114'; $mcastaddr = 'ff01::114';
$sblock = "?"; $sblock = "?";
echo "creating send socket\n"; echo "creating send socket\n";
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); $sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
var_dump($sends1); var_dump($sends1);
echo "creating receive socket\n"; echo "creating receive socket\n";
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); $s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
var_dump($s); var_dump($s);
$br = socket_bind($s, '::0', 3000) or die("err"); $br = socket_bind($s, '::0', 3000) or die("err");
var_dump($br); var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)) or die("err"); )) or die("err");
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
checktimeout($s, 500); checktimeout($s, 500);
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort); $r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
var_dump($r, $str, $from); var_dump($r, $str, $from);
$sblock = $from; $sblock = $from;
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$i = 0; $i = 0;
checktimeout($s, 500); checktimeout($s, 500);
while (($str = socket_read($s, 3000, 500)) !== FALSE) { while (($str = socket_read($s, 3000, 500)) !== FALSE) {
$i++; $i++;
echo "$i> ", $str, "\n"; echo "$i> ", $str, "\n";
if ($i == 1) { if ($i == 1) {
echo "leaving group\n"; echo "leaving group\n";
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
var_dump($r); var_dump($r);
} }
if ($i == 2) { if ($i == 2) {
echo "re-joining group\n"; echo "re-joining group\n";
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
"group" => $mcastaddr, "group" => $mcastaddr,
"interface" => $interface, "interface" => $interface,
)); ));
var_dump($so); var_dump($so);
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
var_dump($r); var_dump($r);
} }
if ($i == 3) { if ($i == 3) {
break; break;
} }
} }
--EXPECTF-- --EXPECTF--
creating send socket creating send socket
resource(%d) of type (Socket) resource(%d) of type (Socket)
creating receive socket creating receive socket
resource(%d) of type (Socket) resource(%d) of type (Socket)
bool(true) bool(true)
bool(true) bool(true)
int(14) int(14)
int(14) int(14)
string(14) "testing packet" string(14) "testing packet"
string(%d) "%s" string(%d) "%s"
int(14) int(14)
1> initial packet 1> initial packet
leaving group leaving group
bool(true) bool(true)
int(20) int(20)
int(14) int(14)
2> unicast packet 2> unicast packet
re-joining group re-joining group
bool(true) bool(true)
int(12) int(12)
3> mcast packet 3> mcast packet

View file

@ -1,70 +1,70 @@
--TEST-- --TEST--
Multicast support: IPv6 send options Multicast support: IPv6 send options
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sockets')) { if (!extension_loaded('sockets')) {
die('skip sockets extension not available.'); die('skip sockets extension not available.');
} }
if (!defined('IPPROTO_IPV6')) { if (!defined('IPPROTO_IPV6')) {
die('skip IPv6 not available.'); die('skip IPv6 not available.');
} }
$level = IPPROTO_IPV6; $level = IPPROTO_IPV6;
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket"); $s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) { if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
die("skip interface 1 either doesn't exist or has no ipv6 address"); die("skip interface 1 either doesn't exist or has no ipv6 address");
} }
--FILE-- --FILE--
<?php <?php
$domain = AF_INET6; $domain = AF_INET6;
$level = IPPROTO_IPV6; $level = IPPROTO_IPV6;
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); $s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
echo "Setting IPV6_MULTICAST_TTL\n"; echo "Setting IPV6_MULTICAST_TTL\n";
$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9); $r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
var_dump($r); var_dump($r);
$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS); $r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
var_dump($r); var_dump($r);
echo "\n"; echo "\n";
echo "Setting IPV6_MULTICAST_LOOP\n"; echo "Setting IPV6_MULTICAST_LOOP\n";
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0); $r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
var_dump($r); var_dump($r);
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); $r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
var_dump($r); var_dump($r);
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1); $r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
var_dump($r); var_dump($r);
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); $r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
var_dump($r); var_dump($r);
echo "\n"; echo "\n";
echo "Setting IPV6_MULTICAST_IF\n"; echo "Setting IPV6_MULTICAST_IF\n";
echo "interface 0:\n"; echo "interface 0:\n";
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0); $r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
var_dump($r); var_dump($r);
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); $r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
var_dump($r); var_dump($r);
echo "interface 1:\n"; echo "interface 1:\n";
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1); $r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
var_dump($r); var_dump($r);
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); $r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
var_dump($r); var_dump($r);
echo "\n"; echo "\n";
--EXPECT-- --EXPECT--
Setting IPV6_MULTICAST_TTL Setting IPV6_MULTICAST_TTL
bool(true) bool(true)
int(9) int(9)
Setting IPV6_MULTICAST_LOOP Setting IPV6_MULTICAST_LOOP
bool(true) bool(true)
int(0) int(0)
bool(true) bool(true)
int(1) int(1)
Setting IPV6_MULTICAST_IF Setting IPV6_MULTICAST_IF
interface 0: interface 0:
bool(true) bool(true)
int(0) int(0)
interface 1: interface 1:
bool(true) bool(true)
int(1) int(1)

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
SPL: Spl Directory Iterator test getInode SPL: Spl Directory Iterator test getInode
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
mkdir('test_dir_ptfi'); mkdir('test_dir_ptfi');
@ -24,6 +24,6 @@ var_dump(decoct($dirIterator->getInode()));
--CLEAN-- --CLEAN--
<?php <?php
rmdir('test_dir_ptfi'); rmdir('test_dir_ptfi');
?> ?>
--EXPECTF-- --EXPECTF--
string(%d) "%d" string(%d) "%d"

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
SPL: Spl File Info test getInode SPL: Spl File Info test getInode
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
$fileInfo = new SplFileInfo('not_existing'); $fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getInode()); var_dump($fileInfo->getInode());
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s
Stack trace: Stack trace:

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
SPL: Spl File Info test getGroup SPL: Spl File Info test getGroup
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
$fileInfo = new SplFileInfo('not_existing'); $fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getGroup()); var_dump($fileInfo->getGroup());
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s
Stack trace: Stack trace:

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
SPL: Spl File Info test getInode SPL: Spl File Info test getInode
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
touch ('SplFileInfo_getInode_basic.txt'); touch ('SplFileInfo_getInode_basic.txt');
@ -25,6 +25,6 @@ var_dump($fileInfo->getInode() == $result);
--CLEAN-- --CLEAN--
<?php <?php
unlink('SplFileInfo_getInode_basic.txt'); unlink('SplFileInfo_getInode_basic.txt');
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
SPL: Spl File Info test getPerms SPL: Spl File Info test getPerms
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
$fileInfo = new SplFileInfo('not_existing'); $fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getInode()); var_dump($fileInfo->getInode());
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s
Stack trace: Stack trace:

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
SPL: Spl File Info test getOwner SPL: Spl File Info test getOwner
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
$fileInfo = new SplFileInfo('not_existing'); $fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getOwner()); var_dump($fileInfo->getOwner());
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s
Stack trace: Stack trace:

View file

@ -1,19 +1,19 @@
--TEST-- --TEST--
SPL: Spl File Info test getPerms SPL: Spl File Info test getPerms
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
touch ('SplFileInfo_getPerms_basic.txt'); touch ('SplFileInfo_getPerms_basic.txt');
@ -25,6 +25,6 @@ var_dump($fileInfo->getPerms() == 0100557);
--CLEAN-- --CLEAN--
<?php <?php
unlink('SplFileInfo_getPerms_basic.txt'); unlink('SplFileInfo_getPerms_basic.txt');
?> ?>
--EXPECTF-- --EXPECTF--
bool(true) bool(true)

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
SPL: Spl File Info test getPerms SPL: Spl File Info test getPerms
--CREDITS-- --CREDITS--
Cesare D'Amico <cesare.damico@gruppovolta.it> Cesare D'Amico <cesare.damico@gruppovolta.it>
Andrea Giorgini <agiorg@gmail.com> Andrea Giorgini <agiorg@gmail.com>
Filippo De Santis <fd@ideato.it> Filippo De Santis <fd@ideato.it>
Daniel Londero <daniel.londero@gmail.com> Daniel Londero <daniel.londero@gmail.com>
Francesco Trucchia <ft@ideato.it> Francesco Trucchia <ft@ideato.it>
Jacopo Romei <jacopo@sviluppoagile.it> Jacopo Romei <jacopo@sviluppoagile.it>
#Test Fest Cesena (Italy) on 2009-06-20 #Test Fest Cesena (Italy) on 2009-06-20
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
?> ?>
--FILE-- --FILE--
<?php <?php
//file //file
$fileInfo = new SplFileInfo('not_existing'); $fileInfo = new SplFileInfo('not_existing');
var_dump($fileInfo->getPerms() == 0100557); var_dump($fileInfo->getPerms() == 0100557);
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s
Stack trace: Stack trace:

View file

@ -1,17 +1,17 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator cannot be used with foreach by reference SPL: RecursiveIteratorIterator cannot be used with foreach by reference
--FILE-- --FILE--
<?php <?php
$arr = array(array(1,2)); $arr = array(array(1,2));
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
$recItIt = new RecursiveIteratorIterator($recArrIt); $recItIt = new RecursiveIteratorIterator($recArrIt);
foreach ($recItIt as &$val) echo "$val\n"; foreach ($recItIt as &$val) echo "$val\n";
?> ?>
--EXPECTF-- --EXPECTF--
Fatal error: An iterator cannot be used with foreach by reference in %s on line %d Fatal error: An iterator cannot be used with foreach by reference in %s on line %d

View file

@ -1,20 +1,20 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free. SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
--FILE-- --FILE--
<?php <?php
$array = array(); $array = array();
$recArrIt = new RecursiveArrayIterator($array); $recArrIt = new RecursiveArrayIterator($array);
$recItIt = new RecursiveIteratorIterator($recArrIt); $recItIt = new RecursiveIteratorIterator($recArrIt);
var_dump($recItIt->beginIteration()); var_dump($recItIt->beginIteration());
var_dump($recItIt->endIteration()); var_dump($recItIt->endIteration());
var_dump($recItIt->nextElement()); var_dump($recItIt->nextElement());
?> ?>
--EXPECTF-- --EXPECTF--
NULL NULL
NULL NULL
NULL NULL

View file

@ -1,32 +1,32 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
--FILE-- --FILE--
<?php <?php
$arr = array(array(1,2),2); $arr = array(array(1,2),2);
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function nextelement() { function nextelement() {
echo __METHOD__."\n"; echo __METHOD__."\n";
} }
} }
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($recItIt as $key => $val) echo "$key\n"; foreach ($recItIt as $key => $val) echo "$key\n";
?> ?>
--EXPECTF-- --EXPECTF--
MyRecursiveIteratorIterator::nextelement MyRecursiveIteratorIterator::nextelement
0 0
MyRecursiveIteratorIterator::nextelement MyRecursiveIteratorIterator::nextelement
1 1
MyRecursiveIteratorIterator::nextelement MyRecursiveIteratorIterator::nextelement
0 0
MyRecursiveIteratorIterator::nextelement MyRecursiveIteratorIterator::nextelement
1 1

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next() SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
--FILE-- --FILE--
<?php <?php
$arr = array(array(1,2),2); $arr = array(array(1,2),2);
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function beginchildren() { function beginchildren() {
throw new Exception; throw new Exception;
} }
} }
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
var_dump($recItIt->next()); var_dump($recItIt->next());
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); $recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
var_dump($recItIt2->next()); var_dump($recItIt2->next());
?> ?>
--EXPECTF-- --EXPECTF--
NULL NULL
Fatal error: Uncaught Exception in %s Fatal error: Uncaught Exception in %s
Stack trace: Stack trace:
#0 [internal function]: MyRecursiveIteratorIterator->beginchildren() #0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
#1 %s: RecursiveIteratorIterator->next() #1 %s: RecursiveIteratorIterator->next()
#2 {main} #2 {main}
thrown in %s on line %d thrown in %s on line %d

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next() SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
--FILE-- --FILE--
<?php <?php
$arr = array(1,2); $arr = array(1,2);
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function callHasChildren() { function callHasChildren() {
throw new Exception; throw new Exception;
} }
} }
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
var_dump($recItIt->next()); var_dump($recItIt->next());
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); $recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
var_dump($recItIt2->next()); var_dump($recItIt2->next());
?> ?>
--EXPECTF-- --EXPECTF--
NULL NULL
Fatal error: Uncaught Exception in %s Fatal error: Uncaught Exception in %s
Stack trace: Stack trace:
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren() #0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
#1 %s: RecursiveIteratorIterator->next() #1 %s: RecursiveIteratorIterator->next()
#2 {main} #2 {main}
thrown in %s on line %d thrown in %s on line %d

View file

@ -1,42 +1,42 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next() SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
--FILE-- --FILE--
<?php <?php
$arr = array(array(1,2)); $arr = array(array(1,2));
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function endchildren() { function endchildren() {
throw new Exception; throw new Exception;
} }
} }
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
foreach ($recItIt as $val) echo "$val\n"; foreach ($recItIt as $val) echo "$val\n";
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); $recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
echo "===NEXT LOOP===\n"; echo "===NEXT LOOP===\n";
foreach ($recItIt2 as $val) echo "$val\n"; foreach ($recItIt2 as $val) echo "$val\n";
?> ?>
--EXPECTF-- --EXPECTF--
1 1
2 2
===NEXT LOOP=== ===NEXT LOOP===
1 1
2 2
Fatal error: Uncaught Exception in %s Fatal error: Uncaught Exception in %s
Stack trace: Stack trace:
#0 [internal function]: MyRecursiveIteratorIterator->endchildren() #0 [internal function]: MyRecursiveIteratorIterator->endchildren()
#1 %s: RecursiveIteratorIterator->next() #1 %s: RecursiveIteratorIterator->next()
#2 {main} #2 {main}
thrown in %s on line %d thrown in %s on line %d

View file

@ -1,36 +1,36 @@
--TEST-- --TEST--
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next() SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
--FILE-- --FILE--
<?php <?php
$arr = array(1,2); $arr = array(1,2);
$arrOb = new ArrayObject($arr); $arrOb = new ArrayObject($arr);
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function nextelement() { function nextelement() {
throw new Exception; throw new Exception;
} }
} }
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
var_dump($recItIt->next()); var_dump($recItIt->next());
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); $recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
var_dump($recItIt->next()); var_dump($recItIt->next());
?> ?>
--EXPECTF-- --EXPECTF--
NULL NULL
Fatal error: Uncaught Exception in %s Fatal error: Uncaught Exception in %s
Stack trace: Stack trace:
#0 [internal function]: MyRecursiveIteratorIterator->nextelement() #0 [internal function]: MyRecursiveIteratorIterator->nextelement()
#1 %s: RecursiveIteratorIterator->next() #1 %s: RecursiveIteratorIterator->next()
#2 {main} #2 {main}
thrown in %s on line %d thrown in %s on line %d

View file

@ -1,26 +1,26 @@
--TEST-- --TEST--
Bug #73333 (2147483647 is fetched as string) Bug #73333 (2147483647 is fetched as string)
--SKIPIF-- --SKIPIF--
<?php <?php
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available'); if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
?> ?>
--FILE-- --FILE--
<?php <?php
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1); if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
$db = new SQLite3(':memory:'); $db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (bar INT)'); $db->exec('CREATE TABLE foo (bar INT)');
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) { foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
$db->exec("INSERT INTO foo VALUES ($value)"); $db->exec("INSERT INTO foo VALUES ($value)");
} }
$res = $db->query('SELECT bar FROM foo'); $res = $db->query('SELECT bar FROM foo');
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) { while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
echo gettype($row[0]), PHP_EOL; echo gettype($row[0]), PHP_EOL;
} }
?> ?>
===DONE=== ===DONE===
--EXPECT-- --EXPECT--
integer integer
integer integer
===DONE=== ===DONE===

View file

@ -1,25 +1,25 @@
--TEST-- --TEST--
Bug #43353 wrong detection of 'data' wrapper Bug #43353 wrong detection of 'data' wrapper
--SKIPIF-- --SKIPIF--
<?php <?php
if(substr(PHP_OS, 0, 3) != "WIN") if(substr(PHP_OS, 0, 3) != "WIN")
die("skip Run only on Windows"); die("skip Run only on Windows");
?> ?>
--INI-- --INI--
allow_url_fopen=1 allow_url_fopen=1
--FILE-- --FILE--
<?php <?php
var_dump(is_dir('file:///datafoo:test')); var_dump(is_dir('file:///datafoo:test'));
var_dump(is_dir('datafoo:test')); var_dump(is_dir('datafoo:test'));
var_dump(file_get_contents('data:text/plain,foo')); var_dump(file_get_contents('data:text/plain,foo'));
var_dump(file_get_contents('datafoo:text/plain,foo')); var_dump(file_get_contents('datafoo:text/plain,foo'));
?> ?>
--EXPECTF-- --EXPECTF--
bool(false) bool(false)
bool(false) bool(false)
string(3) "foo" string(3) "foo"
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
bool(false) bool(false)

View file

@ -1,17 +1,17 @@
--TEST-- --TEST--
Test fopen() function : variation: interesting paths, no use include path Test fopen() function : variation: interesting paths, no use include path
--FILE-- --FILE--
<?php <?php
// fopen with interesting windows paths. // fopen with interesting windows paths.
$testdir = __DIR__ . '/bug47177.tmpdir'; $testdir = __DIR__ . '/bug47177.tmpdir';
mkdir($testdir); mkdir($testdir);
$t = time() - 3600; $t = time() - 3600;
touch($testdir, $t); touch($testdir, $t);
clearstatcache(); clearstatcache();
$t2 = filemtime($testdir); $t2 = filemtime($testdir);
if ($t2 != $t) echo "failed (got $t2, expecting $t)\n"; if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
rmdir($testdir); rmdir($testdir);
echo "Ok."; echo "Ok.";
?> ?>
--EXPECTF-- --EXPECTF--
Ok. Ok.

View file

@ -1,23 +1,23 @@
--TEST-- --TEST--
Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode) Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
--SKIPIF-- --SKIPIF--
<?php <?php
/* unfortunately no standard function does a cast to FILE*, so we need /* unfortunately no standard function does a cast to FILE*, so we need
* curl to test this */ * curl to test this */
if (!extension_loaded("curl")) exit("skip curl extension not loaded"); if (!extension_loaded("curl")) exit("skip curl extension not loaded");
--FILE-- --FILE--
<?php <?php
$fn = __DIR__ . "/test.tmp"; $fn = __DIR__ . "/test.tmp";
@unlink($fn); @unlink($fn);
$fh = fopen($fn, 'xb'); $fh = fopen($fn, 'xb');
$ch = curl_init('http://www.yahoo.com/'); $ch = curl_init('http://www.yahoo.com/');
var_dump(curl_setopt($ch, CURLOPT_FILE, $fh)); var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
echo "Done.\n"; echo "Done.\n";
--CLEAN-- --CLEAN--
<?php <?php
$fn = __DIR__ . "/test.tmp"; $fn = __DIR__ . "/test.tmp";
@unlink($fn); @unlink($fn);
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)
Done. Done.

Some files were not shown because too many files have changed in this diff Show more