mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
This commit is contained in:
parent
563a341df7
commit
45f7b2bcc8
@ -1,71 +1,71 @@
|
||||
--TEST--
|
||||
Bug #55509 (segfault on x86_64 using more than 2G memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE == 4) {
|
||||
die('skip Not for 32-bits OS');
|
||||
}
|
||||
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
// check the available memory
|
||||
if (PHP_OS == 'Linux') {
|
||||
$lines = file('/proc/meminfo');
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = (int)ltrim($tmp[1], " ")*1024;
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
elseif (PHP_OS == 'FreeBSD') {
|
||||
$lines = explode("\n",`sysctl -a`);
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
if(!$line){
|
||||
continue;
|
||||
}
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = trim($tmp[1], " ");
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$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_free_count']*$infos['hw.pagesize']);
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=2100M
|
||||
--FILE--
|
||||
<?php
|
||||
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "1\n";
|
||||
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "2\n";
|
||||
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "3\n";
|
||||
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "4\n";
|
||||
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "5\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
|
||||
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
|
||||
--TEST--
|
||||
Bug #55509 (segfault on x86_64 using more than 2G memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_SIZE == 4) {
|
||||
die('skip Not for 32-bits OS');
|
||||
}
|
||||
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
// check the available memory
|
||||
if (PHP_OS == 'Linux') {
|
||||
$lines = file('/proc/meminfo');
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = (int)ltrim($tmp[1], " ")*1024;
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
elseif (PHP_OS == 'FreeBSD') {
|
||||
$lines = explode("\n",`sysctl -a`);
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
if(!$line){
|
||||
continue;
|
||||
}
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = trim($tmp[1], " ");
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$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_free_count']*$infos['hw.pagesize']);
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=2100M
|
||||
--FILE--
|
||||
<?php
|
||||
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "1\n";
|
||||
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "2\n";
|
||||
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "3\n";
|
||||
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "4\n";
|
||||
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
|
||||
echo "5\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
|
||||
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
|
||||
|
@ -1,30 +1,30 @@
|
||||
--TEST--
|
||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function new_closure_gen() {
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
}
|
||||
|
||||
$closure1 = new_closure_gen();
|
||||
$closure2 = new_closure_gen();
|
||||
|
||||
$gen1 = $closure1();
|
||||
$gen2 = $closure1();
|
||||
$gen3 = $closure2();
|
||||
|
||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||
foreach ($gen as $val) {
|
||||
var_dump($val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
--TEST--
|
||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function new_closure_gen() {
|
||||
return function() {
|
||||
static $foo = 0;
|
||||
yield ++$foo;
|
||||
};
|
||||
}
|
||||
|
||||
$closure1 = new_closure_gen();
|
||||
$closure2 = new_closure_gen();
|
||||
|
||||
$gen1 = $closure1();
|
||||
$gen2 = $closure1();
|
||||
$gen3 = $closure2();
|
||||
|
||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||
foreach ($gen as $val) {
|
||||
var_dump($val);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
int(1)
|
||||
|
@ -1,23 +1,23 @@
|
||||
--TEST--
|
||||
Bug #71474: Crash because of VM stack corruption on Magento2
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function __call($name, $args) {
|
||||
$a = $b = $c = $d = $e = $f = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function test($n, $x) {
|
||||
// var_dump($n);
|
||||
if ($n > 0) {
|
||||
$x->bug();
|
||||
test($n - 1, $x);
|
||||
}
|
||||
}
|
||||
|
||||
test(3000, new foo());
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
--TEST--
|
||||
Bug #71474: Crash because of VM stack corruption on Magento2
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function __call($name, $args) {
|
||||
$a = $b = $c = $d = $e = $f = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function test($n, $x) {
|
||||
// var_dump($n);
|
||||
if ($n > 0) {
|
||||
$x->bug();
|
||||
test($n - 1, $x);
|
||||
}
|
||||
}
|
||||
|
||||
test(3000, new foo());
|
||||
echo "OK\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Bug #72918 (negative offset inside a quoted string leads to parse error)
|
||||
--FILE--
|
||||
<?php
|
||||
$array = [-3 => 'foo'];
|
||||
$string = 'abcde';
|
||||
|
||||
echo "$array[-3]\n";
|
||||
echo "$string[-3]\n";
|
||||
echo <<<EOT
|
||||
$array[-3]
|
||||
$string[-3]
|
||||
|
||||
EOT;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
foo
|
||||
c
|
||||
foo
|
||||
c
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #72918 (negative offset inside a quoted string leads to parse error)
|
||||
--FILE--
|
||||
<?php
|
||||
$array = [-3 => 'foo'];
|
||||
$string = 'abcde';
|
||||
|
||||
echo "$array[-3]\n";
|
||||
echo "$string[-3]\n";
|
||||
echo <<<EOT
|
||||
$array[-3]
|
||||
$string[-3]
|
||||
|
||||
EOT;
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
foo
|
||||
c
|
||||
foo
|
||||
c
|
||||
===DONE===
|
||||
|
@ -1,12 +1,12 @@
|
||||
--TEST--
|
||||
string offset 002
|
||||
--FILE--
|
||||
<?php
|
||||
$a = "aaa";
|
||||
$x = array(&$a[1]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sstr_offset_002.php on line 3
|
||||
--TEST--
|
||||
string offset 002
|
||||
--FILE--
|
||||
<?php
|
||||
$a = "aaa";
|
||||
$x = array(&$a[1]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sstr_offset_002.php on line 3
|
||||
|
@ -1,23 +1,23 @@
|
||||
--TEST--
|
||||
Check for problems with case sensitivity in compositions
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
trait A {
|
||||
public function M1() {}
|
||||
public function M2() {}
|
||||
}
|
||||
|
||||
trait B {
|
||||
public function M1() {}
|
||||
public function M2() {}
|
||||
}
|
||||
|
||||
class MyClass {
|
||||
use A;
|
||||
use B;
|
||||
}
|
||||
?>
|
||||
--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
|
||||
--TEST--
|
||||
Check for problems with case sensitivity in compositions
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
trait A {
|
||||
public function M1() {}
|
||||
public function M2() {}
|
||||
}
|
||||
|
||||
trait B {
|
||||
public function M1() {}
|
||||
public function M2() {}
|
||||
}
|
||||
|
||||
class MyClass {
|
||||
use A;
|
||||
use B;
|
||||
}
|
||||
?>
|
||||
--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
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Traits with static methods.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Test';
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo A::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits with static methods.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Test';
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo A::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test
|
@ -1,23 +1,23 @@
|
||||
--TEST--
|
||||
Traits with static methods referenced using variable.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Test';
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
$class = "A";
|
||||
echo $class::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits with static methods referenced using variable.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Test';
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
$class = "A";
|
||||
echo $class::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test
|
@ -1,27 +1,27 @@
|
||||
--TEST--
|
||||
Traits with late static bindings.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return static::$test;
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
protected static $test = "Test A";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
protected static $test = "Test B";
|
||||
}
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits with late static bindings.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return static::$test;
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
protected static $test = "Test A";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
protected static $test = "Test B";
|
||||
}
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test B
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Traits with __callStatic magic method.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function __callStatic($name, $arguments) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo A::Test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits with __callStatic magic method.
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function __callStatic($name, $arguments) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo A::Test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test
|
@ -1,28 +1,28 @@
|
||||
--TEST--
|
||||
Traits and forward_static_call().
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Forwarded '.forward_static_call(array('A', 'test'));
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
public static function test() {
|
||||
return "Test A";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits and forward_static_call().
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return 'Forwarded '.forward_static_call(array('A', 'test'));
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
public static function test() {
|
||||
return "Test A";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Forwarded Test A
|
@ -1,24 +1,24 @@
|
||||
--TEST--
|
||||
Traits and get_called_class().
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return get_called_class();
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class B extends A { }
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Traits and get_called_class().
|
||||
--CREDITS--
|
||||
Simas Toleikis simast@gmail.com
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return get_called_class();
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class B extends A { }
|
||||
|
||||
echo B::test();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
B
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
__TRAIT__: Basics, a constant denoiting the trait of definition.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
class Direct {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class IndirectInheritance extends Direct {
|
||||
|
||||
}
|
||||
|
||||
trait TestTraitIndirect {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class Indirect {
|
||||
use TestTraitIndirect;
|
||||
}
|
||||
|
||||
echo Direct::test()."\n";
|
||||
echo IndirectInheritance::test()."\n";
|
||||
echo Indirect::test()."\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TestTrait
|
||||
TestTrait
|
||||
TestTrait
|
||||
--TEST--
|
||||
__TRAIT__: Basics, a constant denoiting the trait of definition.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait {
|
||||
public static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
class Direct {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class IndirectInheritance extends Direct {
|
||||
|
||||
}
|
||||
|
||||
trait TestTraitIndirect {
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
class Indirect {
|
||||
use TestTraitIndirect;
|
||||
}
|
||||
|
||||
echo Direct::test()."\n";
|
||||
echo IndirectInheritance::test()."\n";
|
||||
echo Indirect::test()."\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
TestTrait
|
||||
TestTrait
|
||||
TestTrait
|
||||
|
@ -1,27 +1,27 @@
|
||||
--TEST--
|
||||
__TRAIT__: Use outside of traits.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyClass {
|
||||
static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
function someFun() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
|
||||
|
||||
$t = __TRAIT__;
|
||||
var_dump($t);
|
||||
$t = MyClass::test();
|
||||
var_dump($t);
|
||||
$t = someFun();
|
||||
var_dump($t);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
--TEST--
|
||||
__TRAIT__: Use outside of traits.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyClass {
|
||||
static function test() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
}
|
||||
|
||||
function someFun() {
|
||||
return __TRAIT__;
|
||||
}
|
||||
|
||||
|
||||
$t = __TRAIT__;
|
||||
var_dump($t);
|
||||
$t = MyClass::test();
|
||||
var_dump($t);
|
||||
$t = someFun();
|
||||
var_dump($t);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
@ -1,53 +1,53 @@
|
||||
--TEST--
|
||||
Check libcurl config on windows
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
die('skip - curl extension not available in this build');
|
||||
}
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' )
|
||||
die("skip for windows only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$s = ob_get_contents();
|
||||
ob_end_clean();
|
||||
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
|
||||
|
||||
echo $m[1], "\n";
|
||||
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
cURL support => enabled
|
||||
cURL Information => %s
|
||||
Age => %d
|
||||
Features
|
||||
AsynchDNS => Yes
|
||||
CharConv => No
|
||||
Debug => No
|
||||
GSS-Negotiate => No
|
||||
IDN => Yes
|
||||
IPv6 => Yes
|
||||
krb4 => No
|
||||
Largefile => Yes
|
||||
libz => Yes
|
||||
NTLM => Yes
|
||||
NTLMWB => No
|
||||
SPNEGO => Yes
|
||||
SSL => Yes
|
||||
SSPI => Yes
|
||||
TLS-SRP => No
|
||||
HTTP2 => No
|
||||
GSSAPI => No
|
||||
KERBEROS5 => Yes
|
||||
UNIX_SOCKETS => No
|
||||
PSL => No
|
||||
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
|
||||
Host => %s-pc-win32
|
||||
SSL Version => OpenSSL/%s
|
||||
ZLib Version => %s
|
||||
libSSH Version => libssh2/%s
|
||||
DONE
|
||||
--TEST--
|
||||
Check libcurl config on windows
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) {
|
||||
die('skip - curl extension not available in this build');
|
||||
}
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' )
|
||||
die("skip for windows only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$s = ob_get_contents();
|
||||
ob_end_clean();
|
||||
preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
|
||||
|
||||
echo $m[1], "\n";
|
||||
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
cURL support => enabled
|
||||
cURL Information => %s
|
||||
Age => %d
|
||||
Features
|
||||
AsynchDNS => Yes
|
||||
CharConv => No
|
||||
Debug => No
|
||||
GSS-Negotiate => No
|
||||
IDN => Yes
|
||||
IPv6 => Yes
|
||||
krb4 => No
|
||||
Largefile => Yes
|
||||
libz => Yes
|
||||
NTLM => Yes
|
||||
NTLMWB => No
|
||||
SPNEGO => Yes
|
||||
SSL => Yes
|
||||
SSPI => Yes
|
||||
TLS-SRP => No
|
||||
HTTP2 => No
|
||||
GSSAPI => No
|
||||
KERBEROS5 => Yes
|
||||
UNIX_SOCKETS => No
|
||||
PSL => No
|
||||
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
|
||||
Host => %s-pc-win32
|
||||
SSL Version => OpenSSL/%s
|
||||
ZLib Version => %s
|
||||
libSSH Version => libssh2/%s
|
||||
DONE
|
||||
|
@ -1,28 +1,28 @@
|
||||
--TEST--
|
||||
Test curl_version() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : array curl_version ([ int $age ] )
|
||||
* Description: Returns information about the cURL version.
|
||||
* Source code: ext/curl/interface.c
|
||||
*/
|
||||
|
||||
echo "*** Testing curl_version() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( curl_version(1, $extra_arg) );
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing curl_version() : error conditions ***
|
||||
|
||||
-- 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
|
||||
NULL
|
||||
===Done===
|
||||
--TEST--
|
||||
Test curl_version() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : array curl_version ([ int $age ] )
|
||||
* Description: Returns information about the cURL version.
|
||||
* Source code: ext/curl/interface.c
|
||||
*/
|
||||
|
||||
echo "*** Testing curl_version() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( curl_version(1, $extra_arg) );
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing curl_version() : error conditions ***
|
||||
|
||||
-- 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
|
||||
NULL
|
||||
===Done===
|
||||
|
@ -1,159 +1,159 @@
|
||||
--TEST--
|
||||
Test curl_version() function : usage variations - test values for $ascii argument
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : array curl_version ([ int $age ] )
|
||||
* Description: Returns information about the cURL version.
|
||||
* Source code: ext/curl/interface.c
|
||||
*/
|
||||
|
||||
echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
//defining a class
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "sample object";
|
||||
}
|
||||
}
|
||||
|
||||
//getting the resource
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
// array with different values for $input
|
||||
$inputs = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
255,
|
||||
256,
|
||||
PHP_INT_MAX,
|
||||
-PHP_INT_MAX,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-20.5,
|
||||
10.1234567e10,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1, 2),
|
||||
|
||||
//string values
|
||||
"ABC",
|
||||
'abc',
|
||||
"2abc",
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// null values
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// objects
|
||||
new sample(),
|
||||
|
||||
// resource
|
||||
$file_handle,
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
// loop through with each element of the $inputs array to test curl_version() function
|
||||
$count = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "-- Iteration $count --\n";
|
||||
var_dump( is_array(curl_version($input)) );
|
||||
$count ++;
|
||||
}
|
||||
|
||||
fclose($file_handle); //closing the file handle
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 15 --
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
bool(true)
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
===Done===
|
||||
--TEST--
|
||||
Test curl_version() function : usage variations - test values for $ascii argument
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : array curl_version ([ int $age ] )
|
||||
* Description: Returns information about the cURL version.
|
||||
* Source code: ext/curl/interface.c
|
||||
*/
|
||||
|
||||
echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 'string_val';
|
||||
unset($unset_var);
|
||||
|
||||
//defining a class
|
||||
class sample {
|
||||
public function __toString() {
|
||||
return "sample object";
|
||||
}
|
||||
}
|
||||
|
||||
//getting the resource
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
|
||||
// array with different values for $input
|
||||
$inputs = array (
|
||||
|
||||
// integer values
|
||||
0,
|
||||
1,
|
||||
255,
|
||||
256,
|
||||
PHP_INT_MAX,
|
||||
-PHP_INT_MAX,
|
||||
|
||||
// float values
|
||||
10.5,
|
||||
-20.5,
|
||||
10.1234567e10,
|
||||
|
||||
// array values
|
||||
array(),
|
||||
array(0),
|
||||
array(1, 2),
|
||||
|
||||
//string values
|
||||
"ABC",
|
||||
'abc',
|
||||
"2abc",
|
||||
|
||||
// boolean values
|
||||
true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// null values
|
||||
NULL,
|
||||
null,
|
||||
|
||||
// objects
|
||||
new sample(),
|
||||
|
||||
// resource
|
||||
$file_handle,
|
||||
|
||||
// undefined variable
|
||||
@$undefined_var,
|
||||
|
||||
// unset variable
|
||||
@$unset_var
|
||||
);
|
||||
|
||||
// loop through with each element of the $inputs array to test curl_version() function
|
||||
$count = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "-- Iteration $count --\n";
|
||||
var_dump( is_array(curl_version($input)) );
|
||||
$count ++;
|
||||
}
|
||||
|
||||
fclose($file_handle); //closing the file handle
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 15 --
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
bool(true)
|
||||
-- Iteration 16 --
|
||||
bool(true)
|
||||
-- Iteration 17 --
|
||||
bool(true)
|
||||
-- Iteration 18 --
|
||||
bool(true)
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
|
||||
bool(false)
|
||||
-- Iteration 24 --
|
||||
bool(true)
|
||||
-- Iteration 25 --
|
||||
bool(true)
|
||||
===Done===
|
||||
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?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 | 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 | 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 | 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 | 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 | 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 | 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 | FILTER_FLAG_NO_RES_RANGE));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(7) "FC00::1"
|
||||
bool(false)
|
||||
string(2) "::"
|
||||
bool(false)
|
||||
string(3) "::1"
|
||||
bool(false)
|
||||
string(10) "fe8:5:6::1"
|
||||
bool(false)
|
||||
string(12) "2001:0db8::1"
|
||||
bool(false)
|
||||
string(5) "5f::1"
|
||||
bool(false)
|
||||
string(7) "3ff3::1"
|
||||
bool(false)
|
||||
--TEST--
|
||||
Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?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 | 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 | 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 | 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 | 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 | 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 | 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 | FILTER_FLAG_NO_RES_RANGE));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(7) "FC00::1"
|
||||
bool(false)
|
||||
string(2) "::"
|
||||
bool(false)
|
||||
string(3) "::1"
|
||||
bool(false)
|
||||
string(10) "fe8:5:6::1"
|
||||
bool(false)
|
||||
string(12) "2001:0db8::1"
|
||||
bool(false)
|
||||
string(5) "5f::1"
|
||||
bool(false)
|
||||
string(7) "3ff3::1"
|
||||
bool(false)
|
||||
|
@ -1,10 +1,10 @@
|
||||
--TEST--
|
||||
#49274, fatal error when an object does not implement toString
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
--TEST--
|
||||
#49274, fatal error when an object does not implement toString
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
|
@ -1,26 +1,26 @@
|
||||
--TEST--
|
||||
Bug #42434 (ImageLine w/ antialias = 1px shorter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die('skip gd extension not available');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 2);
|
||||
imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
|
||||
|
||||
imageantialias($im, true);
|
||||
imageline($im, 0, 0, 10, 0, 0x000000);
|
||||
|
||||
if (imagecolorat($im, 9, 0) == 0x000000) {
|
||||
echo 'DONE';
|
||||
} else {
|
||||
echo 'Bugged';
|
||||
}
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Bug #42434 (ImageLine w/ antialias = 1px shorter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) {
|
||||
die('skip gd extension not available');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 2);
|
||||
imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
|
||||
|
||||
imageantialias($im, true);
|
||||
imageline($im, 0, 0, 10, 0, 0x000000);
|
||||
|
||||
if (imagecolorat($im, 9, 0) == 0x000000) {
|
||||
echo 'DONE';
|
||||
} else {
|
||||
echo 'Bugged';
|
||||
}
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
--EXPECTF--
|
||||
DONE
|
@ -1,60 +1,60 @@
|
||||
--TEST--
|
||||
Bug #53156 (imagerectangle problem with point ordering)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
|
||||
die("skip test requires GD 2.3 or newer");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
function draw_and_check_pixel($x, $y)
|
||||
{
|
||||
global $img, $black, $red;
|
||||
|
||||
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
|
||||
imagesetpixel($img, $x, $y, $red);
|
||||
}
|
||||
|
||||
function draw_and_check_rectangle($x1, $y1, $x2, $y2)
|
||||
{
|
||||
global $img, $black;
|
||||
|
||||
echo 'Rectangle: ';
|
||||
imagerectangle($img, $x1, $y1, $x2, $y2, $black);
|
||||
$x = ($x1 + $x2) / 2;
|
||||
$y = ($y1 + $y2) / 2;
|
||||
draw_and_check_pixel($x, $y1);
|
||||
draw_and_check_pixel($x1, $y);
|
||||
draw_and_check_pixel($x, $y2);
|
||||
draw_and_check_pixel($x2, $y);
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
$img = imagecreate(110, 210);
|
||||
$bgnd = imagecolorallocate($img, 255, 255, 255);
|
||||
$black = imagecolorallocate($img, 0, 0, 0);
|
||||
$red = imagecolorallocate($img, 255, 0, 0);
|
||||
|
||||
draw_and_check_rectangle( 10, 10, 50, 50);
|
||||
draw_and_check_rectangle( 50, 60, 10, 100);
|
||||
draw_and_check_rectangle( 50, 150, 10, 110);
|
||||
draw_and_check_rectangle( 10, 200, 50, 160);
|
||||
imagesetthickness($img, 4);
|
||||
draw_and_check_rectangle( 60, 10, 100, 50);
|
||||
draw_and_check_rectangle(100, 60, 60, 100);
|
||||
draw_and_check_rectangle(100, 150, 60, 110);
|
||||
draw_and_check_rectangle( 60, 200, 100, 160);
|
||||
|
||||
//imagepng($img, __DIR__ . '/bug53156.png'); // debug
|
||||
?>
|
||||
--EXPECT--
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
--TEST--
|
||||
Bug #53156 (imagerectangle problem with point ordering)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
|
||||
die("skip test requires GD 2.3 or newer");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
function draw_and_check_pixel($x, $y)
|
||||
{
|
||||
global $img, $black, $red;
|
||||
|
||||
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
|
||||
imagesetpixel($img, $x, $y, $red);
|
||||
}
|
||||
|
||||
function draw_and_check_rectangle($x1, $y1, $x2, $y2)
|
||||
{
|
||||
global $img, $black;
|
||||
|
||||
echo 'Rectangle: ';
|
||||
imagerectangle($img, $x1, $y1, $x2, $y2, $black);
|
||||
$x = ($x1 + $x2) / 2;
|
||||
$y = ($y1 + $y2) / 2;
|
||||
draw_and_check_pixel($x, $y1);
|
||||
draw_and_check_pixel($x1, $y);
|
||||
draw_and_check_pixel($x, $y2);
|
||||
draw_and_check_pixel($x2, $y);
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
$img = imagecreate(110, 210);
|
||||
$bgnd = imagecolorallocate($img, 255, 255, 255);
|
||||
$black = imagecolorallocate($img, 0, 0, 0);
|
||||
$red = imagecolorallocate($img, 255, 0, 0);
|
||||
|
||||
draw_and_check_rectangle( 10, 10, 50, 50);
|
||||
draw_and_check_rectangle( 50, 60, 10, 100);
|
||||
draw_and_check_rectangle( 50, 150, 10, 110);
|
||||
draw_and_check_rectangle( 10, 200, 50, 160);
|
||||
imagesetthickness($img, 4);
|
||||
draw_and_check_rectangle( 60, 10, 100, 50);
|
||||
draw_and_check_rectangle(100, 60, 60, 100);
|
||||
draw_and_check_rectangle(100, 150, 60, 110);
|
||||
draw_and_check_rectangle( 60, 200, 100, 160);
|
||||
|
||||
//imagepng($img, __DIR__ . '/bug53156.png'); // debug
|
||||
?>
|
||||
--EXPECT--
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
Rectangle: ++++
|
||||
|
@ -1,15 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72494 (imagecropauto out-of-bounds access)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(10,10);
|
||||
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #72494 (imagecropauto out-of-bounds access)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(10,10);
|
||||
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
|
||||
===DONE===
|
||||
|
@ -1,24 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$src = imagecreatetruecolor(100, 100);
|
||||
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
||||
imageellipse($src, 49,49, 40,40, 0x000000);
|
||||
|
||||
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
||||
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
$dst = imagerotate($src, 60, 0xFFFFFF);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$src = imagecreatetruecolor(100, 100);
|
||||
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
||||
imageellipse($src, 49,49, 40,40, 0x000000);
|
||||
|
||||
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
||||
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
$dst = imagerotate($src, 60, 0xFFFFFF);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
|
@ -1,20 +1,20 @@
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
|
||||
die('skip only for bundled libgd or external libgd >= 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
|
||||
die('skip only for bundled libgd or external libgd >= 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
|
||||
die('skip only for external libgd < 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--XFAIL--
|
||||
Bug #330 has not yet been fixed
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
|
||||
die('skip only for external libgd < 2.2.4');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$src = imagecreate(100, 100);
|
||||
imagecolorallocate($src, 255, 255, 255);
|
||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||
?>
|
||||
===DONE===
|
||||
--XFAIL--
|
||||
Bug #330 has not yet been fixed
|
||||
--EXPECT--
|
||||
color: ffffff
|
||||
===DONE===
|
||||
|
@ -1,148 +1,148 @@
|
||||
<?php
|
||||
|
||||
function get_gd_version()
|
||||
{
|
||||
return GD_VERSION;
|
||||
}
|
||||
|
||||
function get_php_info()
|
||||
{
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$info = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function get_freetype_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libjpeg_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libpng_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libxpm_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that an in-memory image equals a PNG file.
|
||||
*
|
||||
* 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 images are equal."
|
||||
*
|
||||
* 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
|
||||
* .php test file with the extension .out.png, to be able to manually inspect
|
||||
* the result.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param resource $actual
|
||||
* @return void
|
||||
*/
|
||||
function test_image_equals_file($filename, $actual)
|
||||
{
|
||||
if (!file_exists($filename)) {
|
||||
echo "The expected image does not exist.\n";
|
||||
save_actual_image($actual);
|
||||
return;
|
||||
}
|
||||
$actual = test_to_truecolor($actual);
|
||||
$expected = imagecreatefrompng($filename);
|
||||
$expected = test_to_truecolor($expected);
|
||||
$exp_x = imagesx($expected);
|
||||
$exp_y = imagesy($expected);
|
||||
$act_x = imagesx($actual);
|
||||
$act_y = imagesy($actual);
|
||||
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";
|
||||
save_actual_image($actual);
|
||||
return;
|
||||
}
|
||||
$pixels_changed = 0;
|
||||
for ($y = 0; $y < $exp_y; $y++) {
|
||||
for ($x = 0; $x < $exp_x; $x ++) {
|
||||
$exp_c = imagecolorat($expected, $x, $y);
|
||||
$act_c = imagecolorat($actual, $x, $y);
|
||||
if ($exp_c != $act_c) {
|
||||
$pixels_changed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$pixels_changed) {
|
||||
echo "The images are equal.\n";
|
||||
} else {
|
||||
echo "The images differ in {$pixels_changed} pixels.\n";
|
||||
save_actual_image($actual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the truecolor version of an image.
|
||||
*
|
||||
* @param resource $image
|
||||
* @return resource
|
||||
*/
|
||||
function test_to_truecolor($image)
|
||||
{
|
||||
if (imageistruecolor($image)) {
|
||||
return $image;
|
||||
} else {
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$result = imagecreatetruecolor($width, $height);
|
||||
imagecopy($result, $image, 0,0, 0,0, $width, $height);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves an actual image to disk.
|
||||
*
|
||||
* The image is saved right beside the temporary .php test file with the
|
||||
* extension .out.png.
|
||||
*
|
||||
* @param resource $image
|
||||
* @return void
|
||||
*/
|
||||
function save_actual_image($image)
|
||||
{
|
||||
$pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
|
||||
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
|
||||
imagepng($image, $filename);
|
||||
}
|
||||
<?php
|
||||
|
||||
function get_gd_version()
|
||||
{
|
||||
return GD_VERSION;
|
||||
}
|
||||
|
||||
function get_php_info()
|
||||
{
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$info = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function get_freetype_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libjpeg_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libpng_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
function get_libxpm_version()
|
||||
{
|
||||
$version = 0;
|
||||
|
||||
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that an in-memory image equals a PNG file.
|
||||
*
|
||||
* 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 images are equal."
|
||||
*
|
||||
* 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
|
||||
* .php test file with the extension .out.png, to be able to manually inspect
|
||||
* the result.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param resource $actual
|
||||
* @return void
|
||||
*/
|
||||
function test_image_equals_file($filename, $actual)
|
||||
{
|
||||
if (!file_exists($filename)) {
|
||||
echo "The expected image does not exist.\n";
|
||||
save_actual_image($actual);
|
||||
return;
|
||||
}
|
||||
$actual = test_to_truecolor($actual);
|
||||
$expected = imagecreatefrompng($filename);
|
||||
$expected = test_to_truecolor($expected);
|
||||
$exp_x = imagesx($expected);
|
||||
$exp_y = imagesy($expected);
|
||||
$act_x = imagesx($actual);
|
||||
$act_y = imagesy($actual);
|
||||
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";
|
||||
save_actual_image($actual);
|
||||
return;
|
||||
}
|
||||
$pixels_changed = 0;
|
||||
for ($y = 0; $y < $exp_y; $y++) {
|
||||
for ($x = 0; $x < $exp_x; $x ++) {
|
||||
$exp_c = imagecolorat($expected, $x, $y);
|
||||
$act_c = imagecolorat($actual, $x, $y);
|
||||
if ($exp_c != $act_c) {
|
||||
$pixels_changed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$pixels_changed) {
|
||||
echo "The images are equal.\n";
|
||||
} else {
|
||||
echo "The images differ in {$pixels_changed} pixels.\n";
|
||||
save_actual_image($actual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the truecolor version of an image.
|
||||
*
|
||||
* @param resource $image
|
||||
* @return resource
|
||||
*/
|
||||
function test_to_truecolor($image)
|
||||
{
|
||||
if (imageistruecolor($image)) {
|
||||
return $image;
|
||||
} else {
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$result = imagecreatetruecolor($width, $height);
|
||||
imagecopy($result, $image, 0,0, 0,0, $width, $height);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves an actual image to disk.
|
||||
*
|
||||
* The image is saved right beside the temporary .php test file with the
|
||||
* extension .out.png.
|
||||
*
|
||||
* @param resource $image
|
||||
* @return void
|
||||
*/
|
||||
function save_actual_image($image)
|
||||
{
|
||||
$pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
|
||||
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
|
||||
imagepng($image, $filename);
|
||||
}
|
||||
|
@ -1,85 +1,85 @@
|
||||
--TEST--
|
||||
Testing imagecropauto()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||
if (GD_BUNDLED) die('skip requires external libgd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "TC IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_SIDES\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_SIDES\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_BLACK\n";
|
||||
$im = imagecreatetruecolor(50, 50);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_BLACK\n";
|
||||
$im = imagecreate(50, 50);
|
||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||
$b = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "IMG_CROP_THRESHOLD\n";
|
||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
@unlink(__DIR__ . "/crop_threshold.png");
|
||||
?>
|
||||
--EXPECT--
|
||||
TC IMG_CROP_DEFAULT
|
||||
int(99)
|
||||
int(99)
|
||||
Palette IMG_CROP_DEFAULT
|
||||
int(99)
|
||||
int(99)
|
||||
TC IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
IMG_CROP_THRESHOLD
|
||||
int(240)
|
||||
int(134)
|
||||
--TEST--
|
||||
Testing imagecropauto()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||
if (GD_BUNDLED) die('skip requires external libgd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "TC IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_SIDES\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_SIDES\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_BLACK\n";
|
||||
$im = imagecreatetruecolor(50, 50);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_BLACK\n";
|
||||
$im = imagecreate(50, 50);
|
||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||
$b = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "IMG_CROP_THRESHOLD\n";
|
||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
@unlink(__DIR__ . "/crop_threshold.png");
|
||||
?>
|
||||
--EXPECT--
|
||||
TC IMG_CROP_DEFAULT
|
||||
int(99)
|
||||
int(99)
|
||||
Palette IMG_CROP_DEFAULT
|
||||
int(99)
|
||||
int(99)
|
||||
TC IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
IMG_CROP_THRESHOLD
|
||||
int(240)
|
||||
int(134)
|
||||
|
@ -1,85 +1,85 @@
|
||||
--TEST--
|
||||
Testing imagecropauto()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||
if (!GD_BUNDLED) die('skip requires bundled libgd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "TC IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_SIDES\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_SIDES\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_BLACK\n";
|
||||
$im = imagecreatetruecolor(50, 50);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_BLACK\n";
|
||||
$im = imagecreate(50, 50);
|
||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||
$b = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "IMG_CROP_THRESHOLD\n";
|
||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
@unlink(__DIR__ . "/crop_threshold.png");
|
||||
?>
|
||||
--EXPECT--
|
||||
TC IMG_CROP_DEFAULT
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_DEFAULT
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
IMG_CROP_THRESHOLD
|
||||
int(240)
|
||||
int(134)
|
||||
--TEST--
|
||||
Testing imagecropauto()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||
if (!GD_BUNDLED) die('skip requires bundled libgd');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
echo "TC IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_DEFAULT\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_SIDES\n";
|
||||
$im = imagecreatetruecolor(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_SIDES\n";
|
||||
$im = imagecreate(99, 99);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "TC IMG_CROP_BLACK\n";
|
||||
$im = imagecreatetruecolor(50, 50);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "Palette IMG_CROP_BLACK\n";
|
||||
$im = imagecreate(50, 50);
|
||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||
$b = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
echo "IMG_CROP_THRESHOLD\n";
|
||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||
var_dump(imagesx($im_crop));
|
||||
var_dump(imagesy($im_crop));
|
||||
|
||||
@unlink(__DIR__ . "/crop_threshold.png");
|
||||
?>
|
||||
--EXPECT--
|
||||
TC IMG_CROP_DEFAULT
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_DEFAULT
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_SIDES
|
||||
int(11)
|
||||
int(11)
|
||||
TC IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
Palette IMG_CROP_BLACK
|
||||
int(11)
|
||||
int(11)
|
||||
IMG_CROP_THRESHOLD
|
||||
int(240)
|
||||
int(134)
|
||||
|
@ -1,21 +1,21 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imageellipse() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 400, 300 );
|
||||
|
||||
// try to draw a white ellipse
|
||||
imageellipse( $image, 200, 150, 300, 200 );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imageellipse() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 400, 300 );
|
||||
|
||||
// try to draw a white ellipse
|
||||
imageellipse( $image, 200, 150, 300, 200 );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
|
||||
|
@ -1,26 +1,26 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagefilltoborder() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
|
||||
|
||||
// Draw an ellipse to fill with a black border
|
||||
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
|
||||
|
||||
// Try to fill border
|
||||
imagefilltoborder( $image, 50, 50 );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagefilltoborder() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
|
||||
|
||||
// Draw an ellipse to fill with a black border
|
||||
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
|
||||
|
||||
// Try to fill border
|
||||
imagefilltoborder( $image, 50, 50 );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
|
||||
|
@ -1,30 +1,30 @@
|
||||
--TEST--
|
||||
Testing imageflip() of GD library
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$im = imagecreatetruecolor( 99, 99 );
|
||||
|
||||
imagesetpixel($im, 0, 0, 0xFF);
|
||||
imagesetpixel($im, 0, 98, 0x00FF00);
|
||||
imagesetpixel($im, 98, 0, 0xFF0000);
|
||||
imagesetpixel($im, 98, 98, 0x0000FF);
|
||||
|
||||
imageflip($im, IMG_FLIP_HORIZONTAL);
|
||||
imageflip($im, IMG_FLIP_VERTICAL);
|
||||
imageflip($im, IMG_FLIP_BOTH);
|
||||
|
||||
var_dump(dechex(imagecolorat($im, 0, 0)));
|
||||
var_dump(dechex(imagecolorat($im, 0, 98)));
|
||||
var_dump(dechex(imagecolorat($im, 98, 0)));
|
||||
var_dump(dechex(imagecolorat($im, 98, 98)));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "ff"
|
||||
string(4) "ff00"
|
||||
string(6) "ff0000"
|
||||
--TEST--
|
||||
Testing imageflip() of GD library
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$im = imagecreatetruecolor( 99, 99 );
|
||||
|
||||
imagesetpixel($im, 0, 0, 0xFF);
|
||||
imagesetpixel($im, 0, 98, 0x00FF00);
|
||||
imagesetpixel($im, 98, 0, 0xFF0000);
|
||||
imagesetpixel($im, 98, 98, 0x0000FF);
|
||||
|
||||
imageflip($im, IMG_FLIP_HORIZONTAL);
|
||||
imageflip($im, IMG_FLIP_VERTICAL);
|
||||
imageflip($im, IMG_FLIP_BOTH);
|
||||
|
||||
var_dump(dechex(imagecolorat($im, 0, 0)));
|
||||
var_dump(dechex(imagecolorat($im, 0, 98)));
|
||||
var_dump(dechex(imagecolorat($im, 98, 0)));
|
||||
var_dump(dechex(imagecolorat($im, 98, 98)));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "ff"
|
||||
string(4) "ff00"
|
||||
string(6) "ff0000"
|
||||
string(2) "ff"
|
@ -1,72 +1,72 @@
|
||||
--TEST--
|
||||
Apply imagegammacorrect() to a step wedge
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
test_gamma_both(1, 2);
|
||||
test_gamma_both(1, 1);
|
||||
test_gamma_both(2, 1);
|
||||
|
||||
function test_gamma_both($in, $out)
|
||||
{
|
||||
test_gamma($in, $out, 'imagecreate');
|
||||
test_gamma($in, $out, 'imagecreatetruecolor');
|
||||
}
|
||||
|
||||
function test_gamma($in, $out, $constructor)
|
||||
{
|
||||
$im = $constructor(640, 480);
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
draw_cell($im, $i, $j);
|
||||
}
|
||||
}
|
||||
|
||||
imagegammacorrect($im, $in, $out);
|
||||
|
||||
$filename = __DIR__ . DIRECTORY_SEPARATOR
|
||||
. "imagegammacorrect_variation2_{$in}_{$out}.png";
|
||||
$kind = $constructor === 'imagecreate' ? 'palette' : 'truecolor';
|
||||
echo "$kind gamma ($in, $out): ";
|
||||
test_image_equals_file($filename, $im);
|
||||
}
|
||||
|
||||
function draw_cell($im, $x, $y)
|
||||
{
|
||||
$x1 = 20 * $x;
|
||||
$y1 = 120 * $y;
|
||||
$x2 = $x1 + 19;
|
||||
$y2 = $y1 + 119;
|
||||
$color = cell_color($im, $x, $y);
|
||||
imagefilledrectangle($im, $x1,$y1, $x2,$y2, $color);
|
||||
}
|
||||
|
||||
function cell_color($im, $x, $y)
|
||||
{
|
||||
$channel = 8 * $x + 4;
|
||||
switch ($y) {
|
||||
case 0:
|
||||
return imagecolorallocate($im, $channel, $channel, $channel);
|
||||
case 1:
|
||||
return imagecolorallocate($im, $channel, 0, 0);
|
||||
case 2:
|
||||
return imagecolorallocate($im, 0, $channel, 0);
|
||||
case 3:
|
||||
return imagecolorallocate($im, 0, 0, $channel);
|
||||
}
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
palette gamma (1, 2): The images are equal.
|
||||
truecolor gamma (1, 2): The images are equal.
|
||||
palette gamma (1, 1): The images are equal.
|
||||
truecolor gamma (1, 1): The images are equal.
|
||||
palette gamma (2, 1): The images are equal.
|
||||
truecolor gamma (2, 1): The images are equal.
|
||||
===DONE===
|
||||
--TEST--
|
||||
Apply imagegammacorrect() to a step wedge
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
test_gamma_both(1, 2);
|
||||
test_gamma_both(1, 1);
|
||||
test_gamma_both(2, 1);
|
||||
|
||||
function test_gamma_both($in, $out)
|
||||
{
|
||||
test_gamma($in, $out, 'imagecreate');
|
||||
test_gamma($in, $out, 'imagecreatetruecolor');
|
||||
}
|
||||
|
||||
function test_gamma($in, $out, $constructor)
|
||||
{
|
||||
$im = $constructor(640, 480);
|
||||
for ($j = 0; $j < 4; $j++) {
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
draw_cell($im, $i, $j);
|
||||
}
|
||||
}
|
||||
|
||||
imagegammacorrect($im, $in, $out);
|
||||
|
||||
$filename = __DIR__ . DIRECTORY_SEPARATOR
|
||||
. "imagegammacorrect_variation2_{$in}_{$out}.png";
|
||||
$kind = $constructor === 'imagecreate' ? 'palette' : 'truecolor';
|
||||
echo "$kind gamma ($in, $out): ";
|
||||
test_image_equals_file($filename, $im);
|
||||
}
|
||||
|
||||
function draw_cell($im, $x, $y)
|
||||
{
|
||||
$x1 = 20 * $x;
|
||||
$y1 = 120 * $y;
|
||||
$x2 = $x1 + 19;
|
||||
$y2 = $y1 + 119;
|
||||
$color = cell_color($im, $x, $y);
|
||||
imagefilledrectangle($im, $x1,$y1, $x2,$y2, $color);
|
||||
}
|
||||
|
||||
function cell_color($im, $x, $y)
|
||||
{
|
||||
$channel = 8 * $x + 4;
|
||||
switch ($y) {
|
||||
case 0:
|
||||
return imagecolorallocate($im, $channel, $channel, $channel);
|
||||
case 1:
|
||||
return imagecolorallocate($im, $channel, 0, 0);
|
||||
case 2:
|
||||
return imagecolorallocate($im, 0, $channel, 0);
|
||||
case 3:
|
||||
return imagecolorallocate($im, 0, 0, $channel);
|
||||
}
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
palette gamma (1, 2): The images are equal.
|
||||
truecolor gamma (1, 2): The images are equal.
|
||||
palette gamma (1, 1): The images are equal.
|
||||
truecolor gamma (1, 1): The images are equal.
|
||||
palette gamma (2, 1): The images are equal.
|
||||
truecolor gamma (2, 1): The images are equal.
|
||||
===DONE===
|
||||
|
@ -1,34 +1,34 @@
|
||||
--TEST--
|
||||
imagegd() writes truecolor images without palette conversion
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 0,0, 9,9, $white);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 3,3, 6,6, $blue);
|
||||
|
||||
ob_start();
|
||||
imagegd($im);
|
||||
$buffer = ob_get_clean();
|
||||
|
||||
$header = unpack('nsignature/nwidth/nheight/Ctruecolor', $buffer);
|
||||
printf("signature: %d\n", $header['signature']);
|
||||
printf("truecolor: %d\n", $header['truecolor']);
|
||||
printf("size: %d\n", strlen($buffer));
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
signature: 65534
|
||||
truecolor: 1
|
||||
size: 411
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--TEST--
|
||||
imagegd() writes truecolor images without palette conversion
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 0,0, 9,9, $white);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 3,3, 6,6, $blue);
|
||||
|
||||
ob_start();
|
||||
imagegd($im);
|
||||
$buffer = ob_get_clean();
|
||||
|
||||
$header = unpack('nsignature/nwidth/nheight/Ctruecolor', $buffer);
|
||||
printf("signature: %d\n", $header['signature']);
|
||||
printf("truecolor: %d\n", $header['truecolor']);
|
||||
printf("size: %d\n", strlen($buffer));
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
signature: 65534
|
||||
truecolor: 1
|
||||
size: 411
|
||||
The images are equal.
|
||||
===DONE===
|
||||
|
@ -1,29 +1,29 @@
|
||||
--TEST--
|
||||
imageopenpolygon(): basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
$green = imagecolorallocate($im, 0, 128, 0);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 0,0, 99,99, $white);
|
||||
|
||||
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,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);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--TEST--
|
||||
imageopenpolygon(): basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
$green = imagecolorallocate($im, 0, 128, 0);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 0,0, 99,99, $white);
|
||||
|
||||
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,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);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
|
@ -1,24 +1,24 @@
|
||||
--TEST--
|
||||
antialiased imagepolygon()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
imagefilledrectangle($im, 0,0, 99,99, $white);
|
||||
imageantialias($im, true);
|
||||
|
||||
imagepolygon($im, [10,10, 49,89, 89,49], 3, $black);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--TEST--
|
||||
antialiased imagepolygon()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
$white = imagecolorallocate($im, 255, 255, 255);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
imagefilledrectangle($im, 0,0, 99,99, $white);
|
||||
imageantialias($im, true);
|
||||
|
||||
imagepolygon($im, [10,10, 49,89, 89,49], 3, $black);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Testing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
|
||||
include_once __DIR__ . '/func.inc';
|
||||
test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
|
||||
?>
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
--TEST--
|
||||
Testing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
|
||||
include_once __DIR__ . '/func.inc';
|
||||
test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
|
||||
?>
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a resource
|
||||
$image = tmpfile();
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, 2 );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a resource
|
||||
$image = tmpfile();
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, 2 );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50 );
|
||||
?>
|
||||
--EXPECTF--
|
||||
--TEST--
|
||||
Testing wrong param passing imagerectangle() of GD library
|
||||
--CREDITS--
|
||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||
#testfest PHPSP on 2009-06-30
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
// Create a image
|
||||
$image = imagecreatetruecolor( 100, 100 );
|
||||
|
||||
// Draw a rectangle
|
||||
imagerectangle( $image, 0, 0, 50, 50 );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
|
||||
|
@ -1,42 +1,42 @@
|
||||
--TEST--
|
||||
test_image_equals_file(): comparing palette images
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
|
||||
imagepng($im, $filename);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $blue);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
imagecolorallocate($im, 0, 0, 0);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images differ in 25 pixels.
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
|
||||
?>
|
||||
--TEST--
|
||||
test_image_equals_file(): comparing palette images
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
|
||||
imagepng($im, $filename);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $blue);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
|
||||
$im = imagecreate(10, 10);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
imagecolorallocate($im, 0, 0, 0);
|
||||
$red = imagecolorallocate($im, 255, 0, 0);
|
||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||
|
||||
test_image_equals_file($filename, $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images differ in 25 pixels.
|
||||
The images are equal.
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
|
||||
?>
|
||||
|
@ -1,38 +1,38 @@
|
||||
--TEST--
|
||||
imagewebp() and imagecreatefromwebp() - basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
|
||||
die("skip test requires GD 2.2.0 or higher");
|
||||
}
|
||||
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
||||
die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/similarity.inc';
|
||||
|
||||
$filename = __DIR__ . '/webp_basic.webp';
|
||||
|
||||
$im1 = imagecreatetruecolor(75, 75);
|
||||
$white = imagecolorallocate($im1, 255, 255, 255);
|
||||
$red = imagecolorallocate($im1, 255, 0, 0);
|
||||
$green = imagecolorallocate($im1, 0, 255, 0);
|
||||
$blue = imagecolorallocate($im1, 0, 0, 255);
|
||||
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
||||
imageline($im1, 3, 3, 71, 71, $red);
|
||||
imageellipse($im1, 18, 54, 36, 36, $green);
|
||||
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
||||
imagewebp($im1, $filename);
|
||||
|
||||
$im2 = imagecreatefromwebp($filename);
|
||||
imagewebp($im2, $filename);
|
||||
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/webp_basic.webp');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
--TEST--
|
||||
imagewebp() and imagecreatefromwebp() - basic test
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
|
||||
die("skip test requires GD 2.2.0 or higher");
|
||||
}
|
||||
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
||||
die('skip WebP support not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/similarity.inc';
|
||||
|
||||
$filename = __DIR__ . '/webp_basic.webp';
|
||||
|
||||
$im1 = imagecreatetruecolor(75, 75);
|
||||
$white = imagecolorallocate($im1, 255, 255, 255);
|
||||
$red = imagecolorallocate($im1, 255, 0, 0);
|
||||
$green = imagecolorallocate($im1, 0, 255, 0);
|
||||
$blue = imagecolorallocate($im1, 0, 0, 255);
|
||||
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
||||
imageline($im1, 3, 3, 71, 71, $red);
|
||||
imageellipse($im1, 18, 54, 36, 36, $green);
|
||||
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
||||
imagewebp($im1, $filename);
|
||||
|
||||
$im2 = imagecreatefromwebp($filename);
|
||||
imagewebp($im2, $filename);
|
||||
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/webp_basic.webp');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
|
@ -1887,7 +1887,7 @@ PHP_FUNCTION(ibase_num_fields)
|
||||
|
||||
if (type == le_query) {
|
||||
ibase_query *ib_query;
|
||||
|
||||
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(result, LE_QUERY, le_query);
|
||||
sqlda = ib_query->out_sqlda;
|
||||
} else {
|
||||
|
@ -31,4 +31,4 @@ int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
int(1)
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000);
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -23,4 +23,4 @@ bool(true)
|
||||
int(6)
|
||||
bool(true)
|
||||
int(5)
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -1,41 +1,41 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\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, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
|
||||
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
|
||||
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012 12:00:00 AM
|
||||
1/1/12 12:00:00 AM Western European %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||
06/02/1433 00:00:00
|
||||
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
|
||||
==DONE==
|
||||
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\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, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
|
||||
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
|
||||
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
|
||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012 12:00:00 AM
|
||||
1/1/12 12:00:00 AM Western European %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||
06/02/1433 00:00:00
|
||||
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
|
||||
==DONE==
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
@ -27,8 +27,8 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012, 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012, 12:00:00 AM
|
||||
|
@ -1,34 +1,34 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($dt), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\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, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$dt = new DateTime('2012-01-01 05:00:00+03:00');
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012 12:00:00 AM
|
||||
1/1/12 12:00:00 AM Western European %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||
==DONE==
|
||||
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
ini_set("date.timezone", "Europe/Lisbon");
|
||||
|
||||
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||
echo IntlDateFormatter::formatObject($dt), "\n";
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\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, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||
|
||||
$dt = new DateTime('2012-01-01 05:00:00+03:00');
|
||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012 12:00:00 AM
|
||||
1/1/12 12:00:00 AM Western European %STime
|
||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||
==DONE==
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): DateTime tests
|
||||
--SKIPIF--
|
||||
<?php
|
||||
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'); ?>
|
||||
--FILE--
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
@ -22,8 +22,8 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
--EXPECTF--
|
||||
01/01/2012, 00:00:00
|
||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||
Jan 1, 2012, 12:00:00 AM
|
||||
|
@ -1,10 +1,10 @@
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
--TEST--
|
||||
IntlDateFormatter::formatObject(): error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('intl'))
|
||||
die('skip intl extension not enabled');
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set("intl.error_level", E_WARNING);
|
||||
ini_set("intl.default_locale", "pt_PT");
|
||||
@ -30,8 +30,8 @@ var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
@ -71,4 +71,4 @@ bool(false)
|
||||
Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
|
||||
bool(false)
|
||||
==DONE==
|
||||
|
||||
|
||||
|
@ -28,4 +28,4 @@ IntlTimeZone Object
|
||||
[rawOffset] => %i
|
||||
[currentOffset] => %i
|
||||
)
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -20,4 +20,4 @@ string(13) "Europe/Lisbon"
|
||||
bool(true)
|
||||
string(0) ""
|
||||
bool(false)
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -32,4 +32,4 @@ string(5) "+0000"
|
||||
string(3) "GMT"
|
||||
string(3) "GMT"
|
||||
string(13) "Portugal Time"
|
||||
==DONE==
|
||||
==DONE==
|
||||
|
@ -1,23 +1,23 @@
|
||||
--TEST--
|
||||
Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function test($str)
|
||||
{
|
||||
$upper = mb_strtoupper($str, 'UTF-8');
|
||||
$len = strlen($upper);
|
||||
for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// OK
|
||||
test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
|
||||
// not OK
|
||||
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)
|
||||
--EXPECTF--
|
||||
f0 90 90 90
|
||||
e2 b0 80
|
||||
d4 a4
|
||||
--TEST--
|
||||
Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function test($str)
|
||||
{
|
||||
$upper = mb_strtoupper($str, 'UTF-8');
|
||||
$len = strlen($upper);
|
||||
for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// OK
|
||||
test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
|
||||
// not OK
|
||||
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)
|
||||
--EXPECTF--
|
||||
f0 90 90 90
|
||||
e2 b0 80
|
||||
d4 a4
|
||||
|
@ -1,58 +1,58 @@
|
||||
--TEST--
|
||||
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
|
||||
--CREDIT--
|
||||
Ryan Biesemeyer <ryan@yaauie.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
for( $i=1; $i<=64; $i = $i*2 ){
|
||||
echo 'Input: '. $i . PHP_EOL;
|
||||
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
|
||||
echo ' Length: ' . strlen( $random ) . PHP_EOL;
|
||||
echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Input: 1
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 1
|
||||
Hex: %x
|
||||
|
||||
Input: 2
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 2
|
||||
Hex: %x
|
||||
|
||||
Input: 4
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 4
|
||||
Hex: %x
|
||||
|
||||
Input: 8
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 8
|
||||
Hex: %x
|
||||
|
||||
Input: 16
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 16
|
||||
Hex: %x
|
||||
|
||||
Input: 32
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 32
|
||||
Hex: %x
|
||||
|
||||
Input: 64
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 64
|
||||
Hex: %x
|
||||
--TEST--
|
||||
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
|
||||
--CREDIT--
|
||||
Ryan Biesemeyer <ryan@yaauie.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
for( $i=1; $i<=64; $i = $i*2 ){
|
||||
echo 'Input: '. $i . PHP_EOL;
|
||||
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
|
||||
echo ' Length: ' . strlen( $random ) . PHP_EOL;
|
||||
echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Input: 1
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 1
|
||||
Hex: %x
|
||||
|
||||
Input: 2
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 2
|
||||
Hex: %x
|
||||
|
||||
Input: 4
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 4
|
||||
Hex: %x
|
||||
|
||||
Input: 8
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 8
|
||||
Hex: %x
|
||||
|
||||
Input: 16
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 16
|
||||
Hex: %x
|
||||
|
||||
Input: 32
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 32
|
||||
Hex: %x
|
||||
|
||||
Input: 64
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 64
|
||||
Hex: %x
|
||||
|
@ -1,66 +1,66 @@
|
||||
--TEST--
|
||||
Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
die("skip Cannot connect to MySQL");
|
||||
|
||||
include_once("local_infile_tools.inc");
|
||||
if ($msg = check_local_infile_support($link, $engine))
|
||||
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
|
||||
if (!$link->query("DROP TABLE IF EXISTS test")) {
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
|
||||
printf("[004] Failed to create CVS file\n");
|
||||
|
||||
if (!$link->query("SELECT 1 FROM DUAL"))
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
|
||||
if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
|
||||
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
||||
echo "bug";
|
||||
} else {
|
||||
echo "done";
|
||||
}
|
||||
$link->close();
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once('connect.inc');
|
||||
|
||||
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",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
$link->close();
|
||||
|
||||
unlink('bug53503.data');
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||
die("skip Cannot connect to MySQL");
|
||||
|
||||
include_once("local_infile_tools.inc");
|
||||
if ($msg = check_local_infile_support($link, $engine))
|
||||
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
|
||||
if (!$link->query("DROP TABLE IF EXISTS test")) {
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
|
||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||
}
|
||||
|
||||
if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
|
||||
printf("[004] Failed to create CVS file\n");
|
||||
|
||||
if (!$link->query("SELECT 1 FROM DUAL"))
|
||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||
|
||||
if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
|
||||
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
||||
echo "bug";
|
||||
} else {
|
||||
echo "done";
|
||||
}
|
||||
$link->close();
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once('connect.inc');
|
||||
|
||||
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",
|
||||
$host, $user, $db, $port, $socket);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
$link->close();
|
||||
|
||||
unlink('bug53503.data');
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
Bug #55653 PS crash with libmysql when binding same variable as param and out
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
|
||||
$in_and_out = "a";
|
||||
|
||||
if (!($stmt = $link->stmt_init()))
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
|
||||
if (!($stmt->prepare("SELECT ?")) ||
|
||||
!($stmt->bind_param("s", $in_and_out)) ||
|
||||
!($stmt->execute()) ||
|
||||
!($stmt->bind_result($in_and_out)))
|
||||
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||
|
||||
if (!$stmt->fetch())
|
||||
printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||
|
||||
if ("a" !== $in_and_out)
|
||||
printf("[005] Wrong result: '%s'\n", $in_and_out);
|
||||
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
--TEST--
|
||||
Bug #55653 PS crash with libmysql when binding same variable as param and out
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
|
||||
$in_and_out = "a";
|
||||
|
||||
if (!($stmt = $link->stmt_init()))
|
||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||
|
||||
if (!($stmt->prepare("SELECT ?")) ||
|
||||
!($stmt->bind_param("s", $in_and_out)) ||
|
||||
!($stmt->execute()) ||
|
||||
!($stmt->bind_result($in_and_out)))
|
||||
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||
|
||||
if (!$stmt->fetch())
|
||||
printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||
|
||||
if ("a" !== $in_and_out)
|
||||
printf("[005] Wrong result: '%s'\n", $in_and_out);
|
||||
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
done!
|
@ -1,20 +1,20 @@
|
||||
--TEST--
|
||||
Bug #55859 mysqli->stat property access gives error
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
done!
|
||||
--TEST--
|
||||
Bug #55859 mysqli->stat property access gives error
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
done!
|
||||
|
@ -1,40 +1,40 @@
|
||||
--TEST--
|
||||
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
|
||||
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (FALSE === $stmt->execute()) {
|
||||
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
if (FALSE === $stmt->store_result()) {
|
||||
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
$one = NULL;
|
||||
if (FALSE === $stmt->bind_result($one)) {
|
||||
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
if (FALSE === $stmt->reset()) {
|
||||
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($one);
|
||||
}
|
||||
$stmt->close();
|
||||
$link->close();
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
||||
--TEST--
|
||||
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
|
||||
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||
}
|
||||
if (FALSE === $stmt->execute()) {
|
||||
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
if (FALSE === $stmt->store_result()) {
|
||||
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
$one = NULL;
|
||||
if (FALSE === $stmt->bind_result($one)) {
|
||||
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
if (FALSE === $stmt->reset()) {
|
||||
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||
}
|
||||
while ($stmt->fetch()) {
|
||||
var_dump($one);
|
||||
}
|
||||
$stmt->close();
|
||||
$link->close();
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
||||
done!
|
@ -1,26 +1,26 @@
|
||||
--TEST--
|
||||
Bug #62885 (mysqli_poll - Segmentation fault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once("connect.inc");
|
||||
if (!$IS_MYSQLND) {
|
||||
die("skip mysqlnd only test");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
$tablica = array();
|
||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||
|
||||
$test2 = array();
|
||||
$test2 = array();
|
||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||
echo "okey";
|
||||
?>
|
||||
--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
|
||||
okey
|
||||
--TEST--
|
||||
Bug #62885 (mysqli_poll - Segmentation fault)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once("connect.inc");
|
||||
if (!$IS_MYSQLND) {
|
||||
die("skip mysqlnd only test");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
$tablica = array();
|
||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||
|
||||
$test2 = array();
|
||||
$test2 = array();
|
||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||
echo "okey";
|
||||
?>
|
||||
--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
|
||||
okey
|
||||
|
@ -1,96 +1,96 @@
|
||||
--TEST--
|
||||
Bug #72524 (Binding null values triggers ORA-24816 error)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialize
|
||||
|
||||
$stmtarray = array(
|
||||
"CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run test
|
||||
|
||||
$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";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
|
||||
|
||||
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";
|
||||
|
||||
$clob = '';
|
||||
$varchar2 = '';
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
|
||||
|
||||
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";
|
||||
$clob = 'abc';
|
||||
$varchar2 = 'abc';
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, 0);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
|
||||
|
||||
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";
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
|
||||
|
||||
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";
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
|
||||
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP TABLE mytable"
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
|
||||
bool(true)
|
||||
Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
|
||||
bool(true)
|
||||
Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
|
||||
bool(true)
|
||||
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
|
||||
bool(false)
|
||||
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
|
||||
bool(false)
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #72524 (Binding null values triggers ORA-24816 error)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
|
||||
require(dirname(__FILE__).'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
|
||||
<?php
|
||||
|
||||
require(dirname(__FILE__).'/connect.inc');
|
||||
|
||||
// Initialize
|
||||
|
||||
$stmtarray = array(
|
||||
"CREATE TABLE mytable (clob_col CLOB DEFAULT NULL, varchar2_col VARCHAR2(255) DEFAULT NULL)"
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
// Run test
|
||||
|
||||
$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";
|
||||
$stmt = oci_parse($c, $sql);
|
||||
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
|
||||
|
||||
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";
|
||||
|
||||
$clob = '';
|
||||
$varchar2 = '';
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);
|
||||
|
||||
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";
|
||||
$clob = 'abc';
|
||||
$varchar2 = 'abc';
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, 0);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0);
|
||||
|
||||
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";
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, -1, SQLT_LNG);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, -1, SQLT_LNG);
|
||||
|
||||
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";
|
||||
$clob = NULL;
|
||||
$varchar2 = NULL;
|
||||
oci_bind_by_name($stmt, ':clob_col', $clob, 0, SQLT_LNG);
|
||||
oci_bind_by_name($stmt, ':varchar2_col', $varchar2, 0, SQLT_LNG);
|
||||
|
||||
|
||||
var_dump(oci_execute($stmt));
|
||||
|
||||
// Cleanup
|
||||
|
||||
$stmtarray = array(
|
||||
"DROP TABLE mytable"
|
||||
);
|
||||
|
||||
oci8_test_sql_execute($c, $stmtarray);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
|
||||
bool(true)
|
||||
Test 2 - P1 Value: '' P1 Length: Default P1 Type: Default P2 Value: '' P2 Length: Default P2 Type: Default
|
||||
bool(true)
|
||||
Test 3 - P1 Value: 'abc' P1 Length: 0 P1 Type: Default P2 Value: '' P2 Length: 0 P2 Type: Default
|
||||
bool(true)
|
||||
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
|
||||
bool(false)
|
||||
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
|
||||
bool(false)
|
||||
===DONE===
|
||||
|
@ -1,12 +1,12 @@
|
||||
--TEST--
|
||||
Bug #61124: Segmentation fault with openssl_decrypt
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(openssl_decrypt('kzo w2RMExUTYQXW2Xzxmg==', 'aes-128-cbc', 'pass', false, 'pass'));
|
||||
|
||||
--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
|
||||
bool(false)
|
||||
--TEST--
|
||||
Bug #61124: Segmentation fault with openssl_decrypt
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(openssl_decrypt('kzo w2RMExUTYQXW2Xzxmg==', 'aes-128-cbc', 'pass', false, 'pass'));
|
||||
|
||||
--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
|
||||
bool(false)
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Bug #66501: EC private key support in openssl_sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
|
||||
AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
|
||||
sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
|
||||
-----END EC PRIVATE KEY-----';
|
||||
$key = openssl_pkey_get_private($pkey);
|
||||
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
|
||||
var_dump($res);
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
--TEST--
|
||||
Bug #66501: EC private key support in openssl_sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
|
||||
AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
|
||||
sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
|
||||
-----END EC PRIVATE KEY-----';
|
||||
$key = openssl_pkey_get_private($pkey);
|
||||
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
|
||||
var_dump($res);
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
@ -1,42 +1,42 @@
|
||||
--TEST--
|
||||
Bug #69864 (Segfault in preg_replace_callback)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* 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
|
||||
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
--TEST--
|
||||
Bug #69864 (Segfault in preg_replace_callback)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* 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
|
||||
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
var_dump(preg_replace_callback('/a/', function($m) {
|
||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
|
||||
}
|
||||
return 'b';
|
||||
}, 'aa'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
string(2) "bb"
|
||||
|
@ -1,33 +1,33 @@
|
||||
--TEST--
|
||||
PDO_MYSQL: Defining a connection charset in the DSN
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
|
||||
/* Connect to mysql to determine the current charset so we can diffinate it */
|
||||
$link = MySQLPDOTest::factory();
|
||||
$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 */
|
||||
$new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
|
||||
|
||||
/* Done with the original connection, create a second link to test the character set being defined */
|
||||
unset($link);
|
||||
|
||||
$link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
|
||||
$conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
||||
|
||||
if ($charset !== $conn_charset) {
|
||||
echo "done!\n";
|
||||
} else {
|
||||
echo "failed!\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
--TEST--
|
||||
PDO_MYSQL: Defining a connection charset in the DSN
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
MySQLPDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||
|
||||
/* Connect to mysql to determine the current charset so we can diffinate it */
|
||||
$link = MySQLPDOTest::factory();
|
||||
$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 */
|
||||
$new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
|
||||
|
||||
/* Done with the original connection, create a second link to test the character set being defined */
|
||||
unset($link);
|
||||
|
||||
$link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
|
||||
$conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
||||
|
||||
if ($charset !== $conn_charset) {
|
||||
echo "done!\n";
|
||||
} else {
|
||||
echo "failed!\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
done!
|
||||
|
@ -1,78 +1,78 @@
|
||||
--TEST--
|
||||
PostgreSQL non-blocking async query params
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include("skipif.inc");
|
||||
if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
include('nonblocking.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
|
||||
$version = pg_version($db);
|
||||
if ($version['protocol'] < 3) {
|
||||
echo "OK";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$db_socket = pg_socket($db);
|
||||
stream_set_blocking($db_socket, false);
|
||||
|
||||
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
|
||||
if ($sent === FALSE) {
|
||||
echo "pg_send_query_params() error\n";
|
||||
} elseif ($sent === 0) {
|
||||
nb_flush($db, $db_socket);
|
||||
}
|
||||
|
||||
nb_consume($db, $db_socket);
|
||||
|
||||
if (!($result = pg_get_result($db))) {
|
||||
echo "pg_get_result() error\n";
|
||||
}
|
||||
if (!($rows = pg_num_rows($result))) {
|
||||
echo "pg_num_rows() error\n";
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_array($result, $i, PGSQL_NUM);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_object($result);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_row($result, $i);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_result($result, $i, 0);
|
||||
}
|
||||
|
||||
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_field_name($result, 0);
|
||||
pg_field_num($result, $field_name);
|
||||
pg_field_size($result, 0);
|
||||
pg_field_type($result, 0);
|
||||
pg_field_prtlen($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"));
|
||||
|
||||
if ($sent === FALSE) {
|
||||
echo "pg_send_query_params() error\n";
|
||||
} elseif ($sent === 0) {
|
||||
nb_flush($db, $db_socket);
|
||||
}
|
||||
|
||||
pg_last_oid($result);
|
||||
pg_free_result($result);
|
||||
|
||||
pg_close($db);
|
||||
|
||||
echo "OK";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
--TEST--
|
||||
PostgreSQL non-blocking async query params
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include("skipif.inc");
|
||||
if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
include('nonblocking.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
|
||||
$version = pg_version($db);
|
||||
if ($version['protocol'] < 3) {
|
||||
echo "OK";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$db_socket = pg_socket($db);
|
||||
stream_set_blocking($db_socket, false);
|
||||
|
||||
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
|
||||
if ($sent === FALSE) {
|
||||
echo "pg_send_query_params() error\n";
|
||||
} elseif ($sent === 0) {
|
||||
nb_flush($db, $db_socket);
|
||||
}
|
||||
|
||||
nb_consume($db, $db_socket);
|
||||
|
||||
if (!($result = pg_get_result($db))) {
|
||||
echo "pg_get_result() error\n";
|
||||
}
|
||||
if (!($rows = pg_num_rows($result))) {
|
||||
echo "pg_num_rows() error\n";
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_array($result, $i, PGSQL_NUM);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_object($result);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_row($result, $i);
|
||||
}
|
||||
for ($i=0; $i < $rows; $i++) {
|
||||
pg_fetch_result($result, $i, 0);
|
||||
}
|
||||
|
||||
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_field_name($result, 0);
|
||||
pg_field_num($result, $field_name);
|
||||
pg_field_size($result, 0);
|
||||
pg_field_type($result, 0);
|
||||
pg_field_prtlen($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"));
|
||||
|
||||
if ($sent === FALSE) {
|
||||
echo "pg_send_query_params() error\n";
|
||||
} elseif ($sent === 0) {
|
||||
nb_flush($db, $db_socket);
|
||||
}
|
||||
|
||||
pg_last_oid($result);
|
||||
pg_free_result($result);
|
||||
|
||||
pg_close($db);
|
||||
|
||||
echo "OK";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
|
@ -1,28 +1,28 @@
|
||||
--TEST--
|
||||
bug#53872 (internal corruption of phar)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("phar")) die("skip");
|
||||
if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
$p=new Phar('bug53872-phar.phar');
|
||||
$p->buildFromDirectory(__DIR__ . "/bug53872/");
|
||||
$p->setStub('<?php __HALT_COMPILER();?\>');
|
||||
$p->compressFiles(Phar::GZ);
|
||||
|
||||
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/third.txt'));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink("bug53872-phar.phar");
|
||||
?>
|
||||
--EXPECT--
|
||||
content of first.txt
|
||||
content of third.txt
|
||||
|
||||
--TEST--
|
||||
bug#53872 (internal corruption of phar)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("phar")) die("skip");
|
||||
if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
$p=new Phar('bug53872-phar.phar');
|
||||
$p->buildFromDirectory(__DIR__ . "/bug53872/");
|
||||
$p->setStub('<?php __HALT_COMPILER();?\>');
|
||||
$p->compressFiles(Phar::GZ);
|
||||
|
||||
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/third.txt'));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink("bug53872-phar.phar");
|
||||
?>
|
||||
--EXPECT--
|
||||
content of first.txt
|
||||
content of third.txt
|
||||
|
||||
|
@ -1,48 +1,48 @@
|
||||
--TEST--
|
||||
Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip");
|
||||
if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
Phar::interceptFileFuncs();
|
||||
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
||||
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
|
||||
$pname = 'phar://' . $fname;
|
||||
file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
|
||||
file_put_contents($pname . '/foo/hi', '<?php
|
||||
include "' . addslashes($fname2) . '";
|
||||
readfile("foo/hi");
|
||||
fopen("foo/hi", "r");
|
||||
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"));
|
||||
opendir("foo/hi");
|
||||
?>
|
||||
');
|
||||
include $pname . '/foo/hi';
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
|
||||
--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: 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: 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)
|
||||
|
||||
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
|
||||
===DONE===
|
||||
--TEST--
|
||||
Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip");
|
||||
if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
|
||||
?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
Phar::interceptFileFuncs();
|
||||
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
||||
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
|
||||
$pname = 'phar://' . $fname;
|
||||
file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
|
||||
file_put_contents($pname . '/foo/hi', '<?php
|
||||
include "' . addslashes($fname2) . '";
|
||||
readfile("foo/hi");
|
||||
fopen("foo/hi", "r");
|
||||
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"));
|
||||
opendir("foo/hi");
|
||||
?>
|
||||
');
|
||||
include $pname . '/foo/hi';
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
|
||||
--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: 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: 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)
|
||||
|
||||
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
|
||||
===DONE===
|
||||
|
@ -1,76 +1,76 @@
|
||||
--TEST--
|
||||
ReflectionParameter class - canBePassedByValue() method.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function aux($fun) {
|
||||
|
||||
$func = new ReflectionFunction($fun);
|
||||
$parameters = $func->getParameters();
|
||||
foreach($parameters as $parameter) {
|
||||
echo "Name: ", $parameter->getName(), "\n";
|
||||
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
|
||||
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "=> array_multisort:\n\n";
|
||||
|
||||
aux('array_multisort');
|
||||
|
||||
|
||||
echo "=> sort:\n\n";
|
||||
|
||||
aux('sort');
|
||||
|
||||
echo "=> user function:\n\n";
|
||||
|
||||
function ufunc(&$arg1, $arg2) {}
|
||||
|
||||
aux('ufunc');
|
||||
|
||||
echo "Done.\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
=> array_multisort:
|
||||
|
||||
Name: arr1
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: sort_order
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: sort_flags
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: arr2
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
=> sort:
|
||||
|
||||
Name: arg
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: no
|
||||
|
||||
Name: sort_flags
|
||||
Is passed by reference: no
|
||||
Can be passed by value: yes
|
||||
|
||||
=> user function:
|
||||
|
||||
Name: arg1
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: no
|
||||
|
||||
Name: arg2
|
||||
Is passed by reference: no
|
||||
Can be passed by value: yes
|
||||
|
||||
Done.
|
||||
--TEST--
|
||||
ReflectionParameter class - canBePassedByValue() method.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function aux($fun) {
|
||||
|
||||
$func = new ReflectionFunction($fun);
|
||||
$parameters = $func->getParameters();
|
||||
foreach($parameters as $parameter) {
|
||||
echo "Name: ", $parameter->getName(), "\n";
|
||||
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
|
||||
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "=> array_multisort:\n\n";
|
||||
|
||||
aux('array_multisort');
|
||||
|
||||
|
||||
echo "=> sort:\n\n";
|
||||
|
||||
aux('sort');
|
||||
|
||||
echo "=> user function:\n\n";
|
||||
|
||||
function ufunc(&$arg1, $arg2) {}
|
||||
|
||||
aux('ufunc');
|
||||
|
||||
echo "Done.\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
=> array_multisort:
|
||||
|
||||
Name: arr1
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: sort_order
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: sort_flags
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
Name: arr2
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: yes
|
||||
|
||||
=> sort:
|
||||
|
||||
Name: arg
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: no
|
||||
|
||||
Name: sort_flags
|
||||
Is passed by reference: no
|
||||
Can be passed by value: yes
|
||||
|
||||
=> user function:
|
||||
|
||||
Name: arg1
|
||||
Is passed by reference: yes
|
||||
Can be passed by value: no
|
||||
|
||||
Name: arg2
|
||||
Is passed by reference: no
|
||||
Can be passed by value: yes
|
||||
|
||||
Done.
|
||||
|
@ -1,34 +1,34 @@
|
||||
--TEST--
|
||||
ReflectionParameter::isDefault()
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $defprop;
|
||||
}
|
||||
$a = new A;
|
||||
$a->myprop = null;
|
||||
|
||||
$ro = new ReflectionObject($a);
|
||||
$props = $ro->getProperties();
|
||||
$prop1 = $props[0];
|
||||
var_dump($prop1->isDefault());
|
||||
$prop2 = $props[1];
|
||||
var_dump($prop2->isDefault());
|
||||
|
||||
var_dump($ro->getProperty('defprop')->isDefault());
|
||||
var_dump($ro->getProperty('myprop')->isDefault());
|
||||
|
||||
$prop1 = new ReflectionProperty($a, 'defprop');
|
||||
$prop2 = new ReflectionProperty($a, 'myprop');
|
||||
var_dump($prop1->isDefault());
|
||||
var_dump($prop2->isDefault());
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
==DONE==
|
||||
--TEST--
|
||||
ReflectionParameter::isDefault()
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public $defprop;
|
||||
}
|
||||
$a = new A;
|
||||
$a->myprop = null;
|
||||
|
||||
$ro = new ReflectionObject($a);
|
||||
$props = $ro->getProperties();
|
||||
$prop1 = $props[0];
|
||||
var_dump($prop1->isDefault());
|
||||
$prop2 = $props[1];
|
||||
var_dump($prop2->isDefault());
|
||||
|
||||
var_dump($ro->getProperty('defprop')->isDefault());
|
||||
var_dump($ro->getProperty('myprop')->isDefault());
|
||||
|
||||
$prop1 = new ReflectionProperty($a, 'defprop');
|
||||
$prop2 = new ReflectionProperty($a, 'myprop');
|
||||
var_dump($prop1->isDefault());
|
||||
var_dump($prop2->isDefault());
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
==DONE==
|
||||
|
@ -1,42 +1,42 @@
|
||||
--TEST--
|
||||
Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
session.use_trans_sid=1
|
||||
session.use_cookies=0
|
||||
session.use_only_cookies=0
|
||||
session.name=sid
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
session_start();
|
||||
|
||||
# Do not remove \r from this tests, they are essential!
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>See source html code</p>
|
||||
<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 />
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
--EXPECTF--
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>See source html code</p>
|
||||
<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 />
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
--TEST--
|
||||
Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
session.use_trans_sid=1
|
||||
session.use_cookies=0
|
||||
session.use_only_cookies=0
|
||||
session.name=sid
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
session_start();
|
||||
|
||||
# Do not remove \r from this tests, they are essential!
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>See source html code</p>
|
||||
<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 />
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
--EXPECTF--
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>See source html code</p>
|
||||
<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 />
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,22 +1,22 @@
|
||||
--TEST--
|
||||
Bug #51958: socket_accept() fails on IPv6 server sockets
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
if (PHP_OS != "WINNT")
|
||||
die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
|
||||
--FILE--
|
||||
<?php
|
||||
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
|
||||
socket_bind($listenfd, "::1", 13579);
|
||||
socket_listen($listenfd);
|
||||
socket_set_nonblock($listenfd);
|
||||
$connfd = @socket_accept($listenfd);
|
||||
echo socket_last_error();
|
||||
--EXPECT--
|
||||
10035
|
||||
--TEST--
|
||||
Bug #51958: socket_accept() fails on IPv6 server sockets
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
if (PHP_OS != "WINNT")
|
||||
die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
|
||||
--FILE--
|
||||
<?php
|
||||
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
|
||||
socket_bind($listenfd, "::1", 13579);
|
||||
socket_listen($listenfd);
|
||||
socket_set_nonblock($listenfd);
|
||||
$connfd = @socket_accept($listenfd);
|
||||
echo socket_last_error();
|
||||
--EXPECT--
|
||||
10035
|
||||
|
@ -1,197 +1,197 @@
|
||||
--TEST--
|
||||
Multicast support: IPv4 receive options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||
$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
|
||||
"group" => '224.0.0.23',
|
||||
"interface" => 'lo',
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip interface \'lo\' is unavailable.');
|
||||
}
|
||||
if (!defined("MCAST_BLOCK_SOURCE")) {
|
||||
die('skip source operations are unavailable');
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET;
|
||||
$level = IPPROTO_IP;
|
||||
$interface = "lo";
|
||||
$mcastaddr = '224.0.0.23';
|
||||
$sblock = "127.0.0.1";
|
||||
|
||||
echo "creating send socket bound to 127.0.0.1\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($sends1, '127.0.0.1');
|
||||
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";
|
||||
$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
var_dump($br);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "blocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 4) {
|
||||
echo "unblocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 5) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 6) {
|
||||
echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 7) {
|
||||
echo "leaving source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 8) {
|
||||
/* echo "rjsg\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket bound to 127.0.0.1
|
||||
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
|
||||
bool(true)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(42)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
blocking source
|
||||
bool(true)
|
||||
int(31)
|
||||
int(14)
|
||||
4> unicast packet
|
||||
unblocking source
|
||||
bool(true)
|
||||
int(27)
|
||||
5> mcast packet from 127.0.0.1
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
6> unicast packet
|
||||
joining source group
|
||||
bool(true)
|
||||
int(27)
|
||||
7> mcast packet from 127.0.0.1
|
||||
leaving source group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
8> unicast packet
|
||||
--TEST--
|
||||
Multicast support: IPv4 receive options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||
$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
|
||||
"group" => '224.0.0.23',
|
||||
"interface" => 'lo',
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip interface \'lo\' is unavailable.');
|
||||
}
|
||||
if (!defined("MCAST_BLOCK_SOURCE")) {
|
||||
die('skip source operations are unavailable');
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET;
|
||||
$level = IPPROTO_IP;
|
||||
$interface = "lo";
|
||||
$mcastaddr = '224.0.0.23';
|
||||
$sblock = "127.0.0.1";
|
||||
|
||||
echo "creating send socket bound to 127.0.0.1\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($sends1, '127.0.0.1');
|
||||
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";
|
||||
$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
var_dump($br);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "blocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 4) {
|
||||
echo "unblocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 5) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 6) {
|
||||
echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 7) {
|
||||
echo "leaving source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 8) {
|
||||
/* echo "rjsg\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket bound to 127.0.0.1
|
||||
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
|
||||
bool(true)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(42)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
blocking source
|
||||
bool(true)
|
||||
int(31)
|
||||
int(14)
|
||||
4> unicast packet
|
||||
unblocking source
|
||||
bool(true)
|
||||
int(27)
|
||||
5> mcast packet from 127.0.0.1
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
6> unicast packet
|
||||
joining source group
|
||||
bool(true)
|
||||
int(27)
|
||||
7> mcast packet from 127.0.0.1
|
||||
leaving source group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
8> unicast packet
|
||||
|
@ -1,226 +1,226 @@
|
||||
--TEST--
|
||||
Multicast support: IPv6 receive options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||
if ($s === false) {
|
||||
die("skip unable to create socket");
|
||||
}
|
||||
$br = socket_bind($s, '::', 3000);
|
||||
/* 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
|
||||
* we're dealing with interface-local traffic... */
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip unable to join multicast group on any interface.');
|
||||
}
|
||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||
if ($r === false) {
|
||||
die('skip unable to send multicast packet.');
|
||||
}
|
||||
|
||||
if (!defined("MCAST_JOIN_SOURCE_GROUP"))
|
||||
die('skip source operations are unavailable');
|
||||
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
"source" => '2001::dead:beef',
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip protocol independent multicast API is unavailable.');
|
||||
}
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$interface = 0;
|
||||
$mcastaddr = 'ff01::114';
|
||||
$sblock = "?";
|
||||
|
||||
echo "creating send socket\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($sends1);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
)) or die("err");
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
checktimeout($s, 500);
|
||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||
var_dump($r, $str, $from);
|
||||
$sblock = $from;
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "blocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 4) {
|
||||
echo "unblocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 5) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 6) {
|
||||
echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 7) {
|
||||
echo "leaving source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 8) {
|
||||
/*echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket
|
||||
resource(%d) of type (Socket)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
int(14)
|
||||
string(14) "testing packet"
|
||||
string(%d) "%s"
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
blocking source
|
||||
bool(true)
|
||||
int(31)
|
||||
int(14)
|
||||
4> unicast packet
|
||||
unblocking source
|
||||
bool(true)
|
||||
int(12)
|
||||
5> mcast packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
6> unicast packet
|
||||
joining source group
|
||||
bool(true)
|
||||
int(32)
|
||||
7> mcast packet from desired source
|
||||
leaving source group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
8> unicast packet
|
||||
--TEST--
|
||||
Multicast support: IPv6 receive options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||
if ($s === false) {
|
||||
die("skip unable to create socket");
|
||||
}
|
||||
$br = socket_bind($s, '::', 3000);
|
||||
/* 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
|
||||
* we're dealing with interface-local traffic... */
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip unable to join multicast group on any interface.');
|
||||
}
|
||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||
if ($r === false) {
|
||||
die('skip unable to send multicast packet.');
|
||||
}
|
||||
|
||||
if (!defined("MCAST_JOIN_SOURCE_GROUP"))
|
||||
die('skip source operations are unavailable');
|
||||
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
"source" => '2001::dead:beef',
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip protocol independent multicast API is unavailable.');
|
||||
}
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$interface = 0;
|
||||
$mcastaddr = 'ff01::114';
|
||||
$sblock = "?";
|
||||
|
||||
echo "creating send socket\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($sends1);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
)) or die("err");
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
checktimeout($s, 500);
|
||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||
var_dump($r, $str, $from);
|
||||
$sblock = $from;
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "blocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 4) {
|
||||
echo "unblocking source\n";
|
||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 5) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 6) {
|
||||
echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 7) {
|
||||
echo "leaving source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 8) {
|
||||
/*echo "joining source group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
"source" => $sblock,
|
||||
));
|
||||
var_dump($so);*/
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket
|
||||
resource(%d) of type (Socket)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
int(14)
|
||||
string(14) "testing packet"
|
||||
string(%d) "%s"
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
blocking source
|
||||
bool(true)
|
||||
int(31)
|
||||
int(14)
|
||||
4> unicast packet
|
||||
unblocking source
|
||||
bool(true)
|
||||
int(12)
|
||||
5> mcast packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
6> unicast packet
|
||||
joining source group
|
||||
bool(true)
|
||||
int(32)
|
||||
7> mcast packet from desired source
|
||||
leaving source group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
8> unicast packet
|
||||
|
@ -1,131 +1,131 @@
|
||||
--TEST--
|
||||
Multicast support: IPv6 receive options (limited)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($s, '::', 3000);
|
||||
/* 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
|
||||
* we're dealing with interface-local traffic... */
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip unable to join multicast group on any interface.');
|
||||
}
|
||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||
if ($r === false) {
|
||||
die('skip unable to send multicast packet.');
|
||||
}
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if (defined("MCAST_JOIN_SOURCE_GROUP")) {
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
"source" => '2001::dead:beef',
|
||||
));
|
||||
if ($so !== false) {
|
||||
die('skip protocol independent multicast API is available.');
|
||||
}
|
||||
}
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$interface = 0;
|
||||
$mcastaddr = 'ff01::114';
|
||||
$sblock = "?";
|
||||
|
||||
echo "creating send socket\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($sends1);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
)) or die("err");
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
checktimeout($s, 500);
|
||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||
var_dump($r, $str, $from);
|
||||
$sblock = $from;
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000, 500)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket
|
||||
resource(%d) of type (Socket)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
int(14)
|
||||
string(14) "testing packet"
|
||||
string(%d) "%s"
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
--TEST--
|
||||
Multicast support: IPv6 receive options (limited)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||
$br = socket_bind($s, '::', 3000);
|
||||
/* 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
|
||||
* we're dealing with interface-local traffic... */
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if ($so === false) {
|
||||
die('skip unable to join multicast group on any interface.');
|
||||
}
|
||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||
if ($r === false) {
|
||||
die('skip unable to send multicast packet.');
|
||||
}
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
));
|
||||
if (defined("MCAST_JOIN_SOURCE_GROUP")) {
|
||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||
"group" => 'ff01::114',
|
||||
"interface" => 0,
|
||||
"source" => '2001::dead:beef',
|
||||
));
|
||||
if ($so !== false) {
|
||||
die('skip protocol independent multicast API is available.');
|
||||
}
|
||||
}
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
include __DIR__."/mcast_helpers.php.inc";
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$interface = 0;
|
||||
$mcastaddr = 'ff01::114';
|
||||
$sblock = "?";
|
||||
|
||||
echo "creating send socket\n";
|
||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($sends1);
|
||||
|
||||
echo "creating receive socket\n";
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
var_dump($s);
|
||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||
var_dump($br);
|
||||
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
)) or die("err");
|
||||
var_dump($so);
|
||||
|
||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
checktimeout($s, 500);
|
||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||
var_dump($r, $str, $from);
|
||||
$sblock = $from;
|
||||
|
||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
|
||||
$i = 0;
|
||||
checktimeout($s, 500);
|
||||
while (($str = socket_read($s, 3000, 500)) !== FALSE) {
|
||||
$i++;
|
||||
echo "$i> ", $str, "\n";
|
||||
|
||||
if ($i == 1) {
|
||||
echo "leaving group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "re-joining group\n";
|
||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||
"group" => $mcastaddr,
|
||||
"interface" => $interface,
|
||||
));
|
||||
var_dump($so);
|
||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||
var_dump($r);
|
||||
}
|
||||
if ($i == 3) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
--EXPECTF--
|
||||
creating send socket
|
||||
resource(%d) of type (Socket)
|
||||
creating receive socket
|
||||
resource(%d) of type (Socket)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(14)
|
||||
int(14)
|
||||
string(14) "testing packet"
|
||||
string(%d) "%s"
|
||||
int(14)
|
||||
1> initial packet
|
||||
leaving group
|
||||
bool(true)
|
||||
int(20)
|
||||
int(14)
|
||||
2> unicast packet
|
||||
re-joining group
|
||||
bool(true)
|
||||
int(12)
|
||||
3> mcast packet
|
||||
|
@ -1,70 +1,70 @@
|
||||
--TEST--
|
||||
Multicast support: IPv6 send options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$level = IPPROTO_IPV6;
|
||||
$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) {
|
||||
die("skip interface 1 either doesn't exist or has no ipv6 address");
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
|
||||
echo "Setting IPV6_MULTICAST_TTL\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
echo "Setting IPV6_MULTICAST_LOOP\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||
var_dump($r);
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
echo "Setting IPV6_MULTICAST_IF\n";
|
||||
echo "interface 0:\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||
var_dump($r);
|
||||
echo "interface 1:\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
--EXPECT--
|
||||
Setting IPV6_MULTICAST_TTL
|
||||
bool(true)
|
||||
int(9)
|
||||
|
||||
Setting IPV6_MULTICAST_LOOP
|
||||
bool(true)
|
||||
int(0)
|
||||
bool(true)
|
||||
int(1)
|
||||
|
||||
Setting IPV6_MULTICAST_IF
|
||||
interface 0:
|
||||
bool(true)
|
||||
int(0)
|
||||
interface 1:
|
||||
bool(true)
|
||||
int(1)
|
||||
--TEST--
|
||||
Multicast support: IPv6 send options
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip sockets extension not available.');
|
||||
}
|
||||
if (!defined('IPPROTO_IPV6')) {
|
||||
die('skip IPv6 not available.');
|
||||
}
|
||||
$level = IPPROTO_IPV6;
|
||||
$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) {
|
||||
die("skip interface 1 either doesn't exist or has no ipv6 address");
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
$domain = AF_INET6;
|
||||
$level = IPPROTO_IPV6;
|
||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||
|
||||
echo "Setting IPV6_MULTICAST_TTL\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
echo "Setting IPV6_MULTICAST_LOOP\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||
var_dump($r);
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
echo "Setting IPV6_MULTICAST_IF\n";
|
||||
echo "interface 0:\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||
var_dump($r);
|
||||
echo "interface 1:\n";
|
||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
|
||||
var_dump($r);
|
||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||
var_dump($r);
|
||||
echo "\n";
|
||||
|
||||
--EXPECT--
|
||||
Setting IPV6_MULTICAST_TTL
|
||||
bool(true)
|
||||
int(9)
|
||||
|
||||
Setting IPV6_MULTICAST_LOOP
|
||||
bool(true)
|
||||
int(0)
|
||||
bool(true)
|
||||
int(1)
|
||||
|
||||
Setting IPV6_MULTICAST_IF
|
||||
interface 0:
|
||||
bool(true)
|
||||
int(0)
|
||||
interface 1:
|
||||
bool(true)
|
||||
int(1)
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
SPL: Spl Directory Iterator test getInode
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl Directory Iterator test getInode
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
mkdir('test_dir_ptfi');
|
||||
@ -24,6 +24,6 @@ var_dump(decoct($dirIterator->getInode()));
|
||||
--CLEAN--
|
||||
<?php
|
||||
rmdir('test_dir_ptfi');
|
||||
?>
|
||||
--EXPECTF--
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%d"
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getInode
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getInode
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getInode());
|
||||
?>
|
||||
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s
|
||||
Stack trace:
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getGroup
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getGroup
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getGroup());
|
||||
?>
|
||||
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s
|
||||
Stack trace:
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getInode
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getInode
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
touch ('SplFileInfo_getInode_basic.txt');
|
||||
@ -25,6 +25,6 @@ var_dump($fileInfo->getInode() == $result);
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('SplFileInfo_getInode_basic.txt');
|
||||
?>
|
||||
--EXPECTF--
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getInode());
|
||||
?>
|
||||
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s
|
||||
Stack trace:
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getOwner
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getOwner
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getOwner());
|
||||
?>
|
||||
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s
|
||||
Stack trace:
|
||||
|
@ -1,19 +1,19 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
touch ('SplFileInfo_getPerms_basic.txt');
|
||||
@ -25,6 +25,6 @@ var_dump($fileInfo->getPerms() == 0100557);
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('SplFileInfo_getPerms_basic.txt');
|
||||
?>
|
||||
--EXPECTF--
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
--TEST--
|
||||
SPL: Spl File Info test getPerms
|
||||
--CREDITS--
|
||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||
Andrea Giorgini <agiorg@gmail.com>
|
||||
Filippo De Santis <fd@ideato.it>
|
||||
Daniel Londero <daniel.londero@gmail.com>
|
||||
Francesco Trucchia <ft@ideato.it>
|
||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
#Test Fest Cesena (Italy) on 2009-06-20
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getPerms() == 0100557);
|
||||
?>
|
||||
|
||||
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s
|
||||
Stack trace:
|
||||
|
@ -1,17 +1,17 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2));
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||
|
||||
foreach ($recItIt as &$val) echo "$val\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2));
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||
|
||||
foreach ($recItIt as &$val) echo "$val\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
|
||||
|
@ -1,20 +1,20 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array();
|
||||
$recArrIt = new RecursiveArrayIterator($array);
|
||||
|
||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||
|
||||
var_dump($recItIt->beginIteration());
|
||||
var_dump($recItIt->endIteration());
|
||||
var_dump($recItIt->nextElement());
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
NULL
|
||||
NULL
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = array();
|
||||
$recArrIt = new RecursiveArrayIterator($array);
|
||||
|
||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||
|
||||
var_dump($recItIt->beginIteration());
|
||||
var_dump($recItIt->endIteration());
|
||||
var_dump($recItIt->nextElement());
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
@ -1,32 +1,32 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2),2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function nextelement() {
|
||||
echo __METHOD__."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
|
||||
foreach ($recItIt as $key => $val) echo "$key\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
0
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
1
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
0
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2),2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function nextelement() {
|
||||
echo __METHOD__."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
|
||||
foreach ($recItIt as $key => $val) echo "$key\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
0
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
1
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
0
|
||||
MyRecursiveIteratorIterator::nextelement
|
||||
1
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2),2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function beginchildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt2->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2),2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function beginchildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt2->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(1,2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function callHasChildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt2->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(1,2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function callHasChildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt2->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
@ -1,42 +1,42 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2));
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function endchildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
foreach ($recItIt as $val) echo "$val\n";
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
echo "===NEXT LOOP===\n";
|
||||
|
||||
foreach ($recItIt2 as $val) echo "$val\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
2
|
||||
===NEXT LOOP===
|
||||
1
|
||||
2
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(array(1,2));
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function endchildren() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
foreach ($recItIt as $val) echo "$val\n";
|
||||
|
||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
echo "===NEXT LOOP===\n";
|
||||
|
||||
foreach ($recItIt2 as $val) echo "$val\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
2
|
||||
===NEXT LOOP===
|
||||
1
|
||||
2
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
@ -1,36 +1,36 @@
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(1,2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function nextelement() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
--TEST--
|
||||
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$arr = array(1,2);
|
||||
$arrOb = new ArrayObject($arr);
|
||||
|
||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||
|
||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||
|
||||
function nextelement() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
var_dump($recItIt->next());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
||||
|
||||
Fatal error: Uncaught Exception in %s
|
||||
Stack trace:
|
||||
#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
|
||||
#1 %s: RecursiveIteratorIterator->next()
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
@ -1,26 +1,26 @@
|
||||
--TEST--
|
||||
Bug #73333 (2147483647 is fetched as string)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec('CREATE TABLE foo (bar INT)');
|
||||
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
|
||||
$db->exec("INSERT INTO foo VALUES ($value)");
|
||||
}
|
||||
|
||||
$res = $db->query('SELECT bar FROM foo');
|
||||
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
|
||||
echo gettype($row[0]), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
integer
|
||||
integer
|
||||
===DONE===
|
||||
--TEST--
|
||||
Bug #73333 (2147483647 is fetched as string)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
$db->exec('CREATE TABLE foo (bar INT)');
|
||||
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
|
||||
$db->exec("INSERT INTO foo VALUES ($value)");
|
||||
}
|
||||
|
||||
$res = $db->query('SELECT bar FROM foo');
|
||||
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
|
||||
echo gettype($row[0]), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
integer
|
||||
integer
|
||||
===DONE===
|
||||
|
@ -1,25 +1,25 @@
|
||||
--TEST--
|
||||
Bug #43353 wrong detection of 'data' wrapper
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||
die("skip Run only on Windows");
|
||||
?>
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(is_dir('file:///datafoo:test'));
|
||||
var_dump(is_dir('datafoo:test'));
|
||||
var_dump(file_get_contents('data:text/plain,foo'));
|
||||
var_dump(file_get_contents('datafoo:text/plain,foo'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(3) "foo"
|
||||
|
||||
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
|
||||
bool(false)
|
||||
--TEST--
|
||||
Bug #43353 wrong detection of 'data' wrapper
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||
die("skip Run only on Windows");
|
||||
?>
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(is_dir('file:///datafoo:test'));
|
||||
var_dump(is_dir('datafoo:test'));
|
||||
var_dump(file_get_contents('data:text/plain,foo'));
|
||||
var_dump(file_get_contents('datafoo:text/plain,foo'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(3) "foo"
|
||||
|
||||
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
|
||||
bool(false)
|
||||
|
@ -1,17 +1,17 @@
|
||||
--TEST--
|
||||
Test fopen() function : variation: interesting paths, no use include path
|
||||
--FILE--
|
||||
<?php
|
||||
// fopen with interesting windows paths.
|
||||
$testdir = __DIR__ . '/bug47177.tmpdir';
|
||||
mkdir($testdir);
|
||||
$t = time() - 3600;
|
||||
touch($testdir, $t);
|
||||
clearstatcache();
|
||||
$t2 = filemtime($testdir);
|
||||
if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
|
||||
rmdir($testdir);
|
||||
echo "Ok.";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Ok.
|
||||
--TEST--
|
||||
Test fopen() function : variation: interesting paths, no use include path
|
||||
--FILE--
|
||||
<?php
|
||||
// fopen with interesting windows paths.
|
||||
$testdir = __DIR__ . '/bug47177.tmpdir';
|
||||
mkdir($testdir);
|
||||
$t = time() - 3600;
|
||||
touch($testdir, $t);
|
||||
clearstatcache();
|
||||
$t2 = filemtime($testdir);
|
||||
if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
|
||||
rmdir($testdir);
|
||||
echo "Ok.";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Ok.
|
||||
|
@ -1,23 +1,23 @@
|
||||
--TEST--
|
||||
Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
/* unfortunately no standard function does a cast to FILE*, so we need
|
||||
* curl to test this */
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
--FILE--
|
||||
<?php
|
||||
$fn = __DIR__ . "/test.tmp";
|
||||
@unlink($fn);
|
||||
$fh = fopen($fn, 'xb');
|
||||
$ch = curl_init('http://www.yahoo.com/');
|
||||
var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
|
||||
echo "Done.\n";
|
||||
--CLEAN--
|
||||
<?php
|
||||
$fn = __DIR__ . "/test.tmp";
|
||||
@unlink($fn);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Done.
|
||||
--TEST--
|
||||
Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
/* unfortunately no standard function does a cast to FILE*, so we need
|
||||
* curl to test this */
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
--FILE--
|
||||
<?php
|
||||
$fn = __DIR__ . "/test.tmp";
|
||||
@unlink($fn);
|
||||
$fh = fopen($fn, 'xb');
|
||||
$ch = curl_init('http://www.yahoo.com/');
|
||||
var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
|
||||
echo "Done.\n";
|
||||
--CLEAN--
|
||||
<?php
|
||||
$fn = __DIR__ . "/test.tmp";
|
||||
@unlink($fn);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Done.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user