mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Convert CRLF line endings to LF
This patch simplifies line endings tracked in the Git repository and syncs them to all include the LF style instead of the CRLF files. Newline characters: - LF (\n) (*nix and Mac) - CRLF (\r\n) (Windows) - CR (\r) (old Mac, obsolete) To see which line endings are in the index and in the working copy the following command can be used: `git ls-files --eol` Git additionally provides `.gitattributes` file to specify if some files need to have specific line endings on all platforms (either CRLF or LF). Changed files shouldn't cause issues on modern Windows platforms because also Git can do output conversion is core.autocrlf=true is set on Windows and use CRLF newlines in all files in the working tree. Unless CRLF files are tracked specifically, Git by default tracks all files in the index using LF newlines.
This commit is contained in:
parent
2845f859c1
commit
3f72c77ce4
210 changed files with 12159 additions and 12159 deletions
|
@ -1,71 +1,71 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #55509 (segfault on x86_64 using more than 2G memory)
|
Bug #55509 (segfault on x86_64 using more than 2G memory)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (PHP_INT_SIZE == 4) {
|
if (PHP_INT_SIZE == 4) {
|
||||||
die('skip Not for 32-bits OS');
|
die('skip Not for 32-bits OS');
|
||||||
}
|
}
|
||||||
|
|
||||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||||
if ($zend_mm_enabled === "0") {
|
if ($zend_mm_enabled === "0") {
|
||||||
die("skip Zend MM disabled");
|
die("skip Zend MM disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||||
// check the available memory
|
// check the available memory
|
||||||
if (PHP_OS == 'Linux') {
|
if (PHP_OS == 'Linux') {
|
||||||
$lines = file('/proc/meminfo');
|
$lines = file('/proc/meminfo');
|
||||||
$infos = array();
|
$infos = array();
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
$tmp = explode(":", $line);
|
$tmp = explode(":", $line);
|
||||||
$index = strtolower($tmp[0]);
|
$index = strtolower($tmp[0]);
|
||||||
$value = (int)ltrim($tmp[1], " ")*1024;
|
$value = (int)ltrim($tmp[1], " ")*1024;
|
||||||
$infos[$index] = $value;
|
$infos[$index] = $value;
|
||||||
}
|
}
|
||||||
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
||||||
if ($freeMemory < 2100*1024*1024) {
|
if ($freeMemory < 2100*1024*1024) {
|
||||||
die('skip Not enough memory.');
|
die('skip Not enough memory.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (PHP_OS == 'FreeBSD') {
|
elseif (PHP_OS == 'FreeBSD') {
|
||||||
$lines = explode("\n",`sysctl -a`);
|
$lines = explode("\n",`sysctl -a`);
|
||||||
$infos = array();
|
$infos = array();
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
if(!$line){
|
if(!$line){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$tmp = explode(":", $line);
|
$tmp = explode(":", $line);
|
||||||
$index = strtolower($tmp[0]);
|
$index = strtolower($tmp[0]);
|
||||||
$value = trim($tmp[1], " ");
|
$value = trim($tmp[1], " ");
|
||||||
$infos[$index] = $value;
|
$infos[$index] = $value;
|
||||||
}
|
}
|
||||||
$freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
|
$freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
|
||||||
+($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
|
+($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
|
||||||
+($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
|
+($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
|
||||||
if ($freeMemory < 2100*1024*1024) {
|
if ($freeMemory < 2100*1024*1024) {
|
||||||
die('skip Not enough memory.');
|
die('skip Not enough memory.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--INI--
|
--INI--
|
||||||
memory_limit=2100M
|
memory_limit=2100M
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
|
$a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
|
||||||
echo "1\n";
|
echo "1\n";
|
||||||
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
|
$a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
|
||||||
echo "2\n";
|
echo "2\n";
|
||||||
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
|
$a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
|
||||||
echo "3\n";
|
echo "3\n";
|
||||||
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
|
$a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
|
||||||
echo "4\n";
|
echo "4\n";
|
||||||
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
|
$a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
|
||||||
echo "5\n";
|
echo "5\n";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
4
|
4
|
||||||
|
|
||||||
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
|
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #64979 (Wrong behavior of static variables in closure generators)
|
Bug #64979 (Wrong behavior of static variables in closure generators)
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function new_closure_gen() {
|
function new_closure_gen() {
|
||||||
return function() {
|
return function() {
|
||||||
static $foo = 0;
|
static $foo = 0;
|
||||||
yield ++$foo;
|
yield ++$foo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$closure1 = new_closure_gen();
|
$closure1 = new_closure_gen();
|
||||||
$closure2 = new_closure_gen();
|
$closure2 = new_closure_gen();
|
||||||
|
|
||||||
$gen1 = $closure1();
|
$gen1 = $closure1();
|
||||||
$gen2 = $closure1();
|
$gen2 = $closure1();
|
||||||
$gen3 = $closure2();
|
$gen3 = $closure2();
|
||||||
|
|
||||||
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
||||||
foreach ($gen as $val) {
|
foreach ($gen as $val) {
|
||||||
var_dump($val);
|
var_dump($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
int(1)
|
int(1)
|
||||||
int(2)
|
int(2)
|
||||||
int(1)
|
int(1)
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #71474: Crash because of VM stack corruption on Magento2
|
Bug #71474: Crash because of VM stack corruption on Magento2
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
class foo {
|
class foo {
|
||||||
function __call($name, $args) {
|
function __call($name, $args) {
|
||||||
$a = $b = $c = $d = $e = $f = 1;
|
$a = $b = $c = $d = $e = $f = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test($n, $x) {
|
function test($n, $x) {
|
||||||
// var_dump($n);
|
// var_dump($n);
|
||||||
if ($n > 0) {
|
if ($n > 0) {
|
||||||
$x->bug();
|
$x->bug();
|
||||||
test($n - 1, $x);
|
test($n - 1, $x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(3000, new foo());
|
test(3000, new foo());
|
||||||
echo "OK\n";
|
echo "OK\n";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
OK
|
OK
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #72918 (negative offset inside a quoted string leads to parse error)
|
Bug #72918 (negative offset inside a quoted string leads to parse error)
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$array = [-3 => 'foo'];
|
$array = [-3 => 'foo'];
|
||||||
$string = 'abcde';
|
$string = 'abcde';
|
||||||
|
|
||||||
echo "$array[-3]\n";
|
echo "$array[-3]\n";
|
||||||
echo "$string[-3]\n";
|
echo "$string[-3]\n";
|
||||||
echo <<<EOT
|
echo <<<EOT
|
||||||
$array[-3]
|
$array[-3]
|
||||||
$string[-3]
|
$string[-3]
|
||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
foo
|
foo
|
||||||
c
|
c
|
||||||
foo
|
foo
|
||||||
c
|
c
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
string offset 002
|
string offset 002
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$a = "aaa";
|
$a = "aaa";
|
||||||
$x = array(&$a[1]);
|
$x = array(&$a[1]);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
|
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sstr_offset_002.php:3
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 {main}
|
#0 {main}
|
||||||
thrown in %sstr_offset_002.php on line 3
|
thrown in %sstr_offset_002.php on line 3
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Check for problems with case sensitivity in compositions
|
Check for problems with case sensitivity in compositions
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
trait A {
|
trait A {
|
||||||
public function M1() {}
|
public function M1() {}
|
||||||
public function M2() {}
|
public function M2() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait B {
|
trait B {
|
||||||
public function M1() {}
|
public function M1() {}
|
||||||
public function M2() {}
|
public function M2() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
use A;
|
use A;
|
||||||
use B;
|
use B;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|
Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits with static methods.
|
Traits with static methods.
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return 'Test';
|
return 'Test';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo A::test();
|
echo A::test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Test
|
Test
|
|
@ -1,23 +1,23 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits with static methods referenced using variable.
|
Traits with static methods referenced using variable.
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return 'Test';
|
return 'Test';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = "A";
|
$class = "A";
|
||||||
echo $class::test();
|
echo $class::test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Test
|
Test
|
|
@ -1,27 +1,27 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits with late static bindings.
|
Traits with late static bindings.
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return static::$test;
|
return static::$test;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
protected static $test = "Test A";
|
protected static $test = "Test A";
|
||||||
}
|
}
|
||||||
|
|
||||||
class B extends A {
|
class B extends A {
|
||||||
protected static $test = "Test B";
|
protected static $test = "Test B";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo B::test();
|
echo B::test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Test B
|
Test B
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits with __callStatic magic method.
|
Traits with __callStatic magic method.
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function __callStatic($name, $arguments) {
|
public static function __callStatic($name, $arguments) {
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo A::Test();
|
echo A::Test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Test
|
Test
|
|
@ -1,28 +1,28 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits and forward_static_call().
|
Traits and forward_static_call().
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return 'Forwarded '.forward_static_call(array('A', 'test'));
|
return 'Forwarded '.forward_static_call(array('A', 'test'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return "Test A";
|
return "Test A";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B extends A {
|
class B extends A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo B::test();
|
echo B::test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Forwarded Test A
|
Forwarded Test A
|
|
@ -1,24 +1,24 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Traits and get_called_class().
|
Traits and get_called_class().
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Simas Toleikis simast@gmail.com
|
Simas Toleikis simast@gmail.com
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return get_called_class();
|
return get_called_class();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
class B extends A { }
|
class B extends A { }
|
||||||
|
|
||||||
echo B::test();
|
echo B::test();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
B
|
B
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
__TRAIT__: Basics, a constant denoiting the trait of definition.
|
__TRAIT__: Basics, a constant denoiting the trait of definition.
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
trait TestTrait {
|
trait TestTrait {
|
||||||
public static function test() {
|
public static function test() {
|
||||||
return __TRAIT__;
|
return __TRAIT__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Direct {
|
class Direct {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IndirectInheritance extends Direct {
|
class IndirectInheritance extends Direct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trait TestTraitIndirect {
|
trait TestTraitIndirect {
|
||||||
use TestTrait;
|
use TestTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Indirect {
|
class Indirect {
|
||||||
use TestTraitIndirect;
|
use TestTraitIndirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Direct::test()."\n";
|
echo Direct::test()."\n";
|
||||||
echo IndirectInheritance::test()."\n";
|
echo IndirectInheritance::test()."\n";
|
||||||
echo Indirect::test()."\n";
|
echo Indirect::test()."\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
TestTrait
|
TestTrait
|
||||||
TestTrait
|
TestTrait
|
||||||
TestTrait
|
TestTrait
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
__TRAIT__: Use outside of traits.
|
__TRAIT__: Use outside of traits.
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
static function test() {
|
static function test() {
|
||||||
return __TRAIT__;
|
return __TRAIT__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function someFun() {
|
function someFun() {
|
||||||
return __TRAIT__;
|
return __TRAIT__;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$t = __TRAIT__;
|
$t = __TRAIT__;
|
||||||
var_dump($t);
|
var_dump($t);
|
||||||
$t = MyClass::test();
|
$t = MyClass::test();
|
||||||
var_dump($t);
|
var_dump($t);
|
||||||
$t = someFun();
|
$t = someFun();
|
||||||
var_dump($t);
|
var_dump($t);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(0) ""
|
string(0) ""
|
||||||
string(0) ""
|
string(0) ""
|
||||||
string(0) ""
|
string(0) ""
|
|
@ -1,28 +1,28 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test curl_version() function : error conditions
|
Test curl_version() function : error conditions
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* Prototype : array curl_version ([ int $age ] )
|
/* Prototype : array curl_version ([ int $age ] )
|
||||||
* Description: Returns information about the cURL version.
|
* Description: Returns information about the cURL version.
|
||||||
* Source code: ext/curl/interface.c
|
* Source code: ext/curl/interface.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo "*** Testing curl_version() : error conditions ***\n";
|
echo "*** Testing curl_version() : error conditions ***\n";
|
||||||
|
|
||||||
echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
|
echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
|
||||||
$extra_arg = 10;
|
$extra_arg = 10;
|
||||||
var_dump( curl_version(1, $extra_arg) );
|
var_dump( curl_version(1, $extra_arg) );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
===Done===
|
===Done===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
*** Testing curl_version() : error conditions ***
|
*** Testing curl_version() : error conditions ***
|
||||||
|
|
||||||
-- Testing curl_version() function with more than expected no. of arguments --
|
-- Testing curl_version() function with more than expected no. of arguments --
|
||||||
|
|
||||||
Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
|
Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
|
||||||
NULL
|
NULL
|
||||||
===Done===
|
===Done===
|
||||||
|
|
|
@ -1,159 +1,159 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test curl_version() function : usage variations - test values for $ascii argument
|
Test curl_version() function : usage variations - test values for $ascii argument
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||||
if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
|
if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* Prototype : array curl_version ([ int $age ] )
|
/* Prototype : array curl_version ([ int $age ] )
|
||||||
* Description: Returns information about the cURL version.
|
* Description: Returns information about the cURL version.
|
||||||
* Source code: ext/curl/interface.c
|
* Source code: ext/curl/interface.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
|
echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
|
||||||
|
|
||||||
//get an unset variable
|
//get an unset variable
|
||||||
$unset_var = 'string_val';
|
$unset_var = 'string_val';
|
||||||
unset($unset_var);
|
unset($unset_var);
|
||||||
|
|
||||||
//defining a class
|
//defining a class
|
||||||
class sample {
|
class sample {
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
return "sample object";
|
return "sample object";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting the resource
|
//getting the resource
|
||||||
$file_handle = fopen(__FILE__, "r");
|
$file_handle = fopen(__FILE__, "r");
|
||||||
|
|
||||||
// array with different values for $input
|
// array with different values for $input
|
||||||
$inputs = array (
|
$inputs = array (
|
||||||
|
|
||||||
// integer values
|
// integer values
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
255,
|
255,
|
||||||
256,
|
256,
|
||||||
PHP_INT_MAX,
|
PHP_INT_MAX,
|
||||||
-PHP_INT_MAX,
|
-PHP_INT_MAX,
|
||||||
|
|
||||||
// float values
|
// float values
|
||||||
10.5,
|
10.5,
|
||||||
-20.5,
|
-20.5,
|
||||||
10.1234567e10,
|
10.1234567e10,
|
||||||
|
|
||||||
// array values
|
// array values
|
||||||
array(),
|
array(),
|
||||||
array(0),
|
array(0),
|
||||||
array(1, 2),
|
array(1, 2),
|
||||||
|
|
||||||
//string values
|
//string values
|
||||||
"ABC",
|
"ABC",
|
||||||
'abc',
|
'abc',
|
||||||
"2abc",
|
"2abc",
|
||||||
|
|
||||||
// boolean values
|
// boolean values
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
||||||
// null values
|
// null values
|
||||||
NULL,
|
NULL,
|
||||||
null,
|
null,
|
||||||
|
|
||||||
// objects
|
// objects
|
||||||
new sample(),
|
new sample(),
|
||||||
|
|
||||||
// resource
|
// resource
|
||||||
$file_handle,
|
$file_handle,
|
||||||
|
|
||||||
// undefined variable
|
// undefined variable
|
||||||
@$undefined_var,
|
@$undefined_var,
|
||||||
|
|
||||||
// unset variable
|
// unset variable
|
||||||
@$unset_var
|
@$unset_var
|
||||||
);
|
);
|
||||||
|
|
||||||
// loop through with each element of the $inputs array to test curl_version() function
|
// loop through with each element of the $inputs array to test curl_version() function
|
||||||
$count = 1;
|
$count = 1;
|
||||||
foreach($inputs as $input) {
|
foreach($inputs as $input) {
|
||||||
echo "-- Iteration $count --\n";
|
echo "-- Iteration $count --\n";
|
||||||
var_dump( is_array(curl_version($input)) );
|
var_dump( is_array(curl_version($input)) );
|
||||||
$count ++;
|
$count ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($file_handle); //closing the file handle
|
fclose($file_handle); //closing the file handle
|
||||||
|
|
||||||
?>
|
?>
|
||||||
===Done===
|
===Done===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
|
*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
|
||||||
-- Iteration 1 --
|
-- Iteration 1 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 2 --
|
-- Iteration 2 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 3 --
|
-- Iteration 3 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 4 --
|
-- Iteration 4 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 5 --
|
-- Iteration 5 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 6 --
|
-- Iteration 6 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 7 --
|
-- Iteration 7 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 8 --
|
-- Iteration 8 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 9 --
|
-- Iteration 9 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 10 --
|
-- Iteration 10 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 11 --
|
-- Iteration 11 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 15 --
|
-- Iteration 15 --
|
||||||
|
|
||||||
Notice: A non well formed numeric value encountered in %s on line %d
|
Notice: A non well formed numeric value encountered in %s on line %d
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 16 --
|
-- Iteration 16 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 17 --
|
-- Iteration 17 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 18 --
|
-- Iteration 18 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 19 --
|
-- Iteration 19 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 20 --
|
-- Iteration 20 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 21 --
|
-- Iteration 21 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 22 --
|
-- Iteration 22 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 23 --
|
-- Iteration 23 --
|
||||||
|
|
||||||
Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
|
Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Iteration 24 --
|
-- Iteration 24 --
|
||||||
bool(true)
|
bool(true)
|
||||||
-- Iteration 25 --
|
-- Iteration 25 --
|
||||||
bool(true)
|
bool(true)
|
||||||
===Done===
|
===Done===
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
|
Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
|
var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
|
||||||
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||||
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(7) "FC00::1"
|
string(7) "FC00::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(2) "::"
|
string(2) "::"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(3) "::1"
|
string(3) "::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(10) "fe8:5:6::1"
|
string(10) "fe8:5:6::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(12) "2001:0db8::1"
|
string(12) "2001:0db8::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(5) "5f::1"
|
string(5) "5f::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
string(7) "3ff3::1"
|
string(7) "3ff3::1"
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
#49274, fatal error when an object does not implement toString
|
#49274, fatal error when an object does not implement toString
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
|
var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #42434 (ImageLine w/ antialias = 1px shorter)
|
Bug #42434 (ImageLine w/ antialias = 1px shorter)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) {
|
if (!extension_loaded('gd')) {
|
||||||
die('skip gd extension not available');
|
die('skip gd extension not available');
|
||||||
}
|
}
|
||||||
if (!GD_BUNDLED) die("skip requires bundled GD library\n");
|
if (!GD_BUNDLED) die("skip requires bundled GD library\n");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$im = imagecreatetruecolor(10, 2);
|
$im = imagecreatetruecolor(10, 2);
|
||||||
imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
|
imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
|
||||||
|
|
||||||
imageantialias($im, true);
|
imageantialias($im, true);
|
||||||
imageline($im, 0, 0, 10, 0, 0x000000);
|
imageline($im, 0, 0, 10, 0, 0x000000);
|
||||||
|
|
||||||
if (imagecolorat($im, 9, 0) == 0x000000) {
|
if (imagecolorat($im, 9, 0) == 0x000000) {
|
||||||
echo 'DONE';
|
echo 'DONE';
|
||||||
} else {
|
} else {
|
||||||
echo 'Bugged';
|
echo 'Bugged';
|
||||||
}
|
}
|
||||||
|
|
||||||
imagedestroy($im);
|
imagedestroy($im);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
DONE
|
DONE
|
|
@ -1,51 +1,51 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #47946 (ImageConvolution overwrites background)
|
Bug #47946 (ImageConvolution overwrites background)
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
The expected image has black pixel artifacts, what is another issue, though
|
The expected image has black pixel artifacts, what is another issue, though
|
||||||
(perhaps #40158).
|
(perhaps #40158).
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
function array_flatten($array)
|
function array_flatten($array)
|
||||||
{
|
{
|
||||||
$tempArray = array();
|
$tempArray = array();
|
||||||
|
|
||||||
foreach ($array as $value) {
|
foreach ($array as $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$tempArray = array_merge($tempArray, array_flatten($value));
|
$tempArray = array_merge($tempArray, array_flatten($value));
|
||||||
} else {
|
} else {
|
||||||
$tempArray[] = $value;
|
$tempArray[] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tempArray;
|
return $tempArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeFilter($resource, $matrix, $offset = 1.0)
|
function makeFilter($resource, $matrix, $offset = 1.0)
|
||||||
{
|
{
|
||||||
$divisor = array_sum(array_flatten($matrix));
|
$divisor = array_sum(array_flatten($matrix));
|
||||||
if ($divisor == 0) {
|
if ($divisor == 0) {
|
||||||
$divisor = .01;
|
$divisor = .01;
|
||||||
}
|
}
|
||||||
return imageconvolution($resource, $matrix, $divisor, $offset);
|
return imageconvolution($resource, $matrix, $divisor, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
|
$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
|
||||||
|
|
||||||
$im = imagecreatetruecolor(40, 40);
|
$im = imagecreatetruecolor(40, 40);
|
||||||
imagealphablending($im, false);
|
imagealphablending($im, false);
|
||||||
imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
|
imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
|
||||||
imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
|
imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
|
||||||
imagesavealpha($im, true);
|
imagesavealpha($im, true);
|
||||||
makeFilter($im, $edgeMatrix);
|
makeFilter($im, $edgeMatrix);
|
||||||
|
|
||||||
require_once __DIR__ . '/func.inc';
|
require_once __DIR__ . '/func.inc';
|
||||||
test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
|
test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
The images are equal.
|
The images are equal.
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
|
Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$im = imagecreate(1200, 800);
|
$im = imagecreate(1200, 800);
|
||||||
$background_color = imagecolorallocate($im, 40, 40, 40);
|
$background_color = imagecolorallocate($im, 40, 40, 40);
|
||||||
$color = imagecolorallocate($im, 255, 255, 255);
|
$color = imagecolorallocate($im, 255, 255, 255);
|
||||||
imagedashedline($im, 800, 400, 300, 400, $color);
|
imagedashedline($im, 800, 400, 300, 400, $color);
|
||||||
imagedashedline($im, 800, 400, 300, 800, $color);
|
imagedashedline($im, 800, 400, 300, 800, $color);
|
||||||
imagedashedline($im, 800, 400, 400, 800, $color);
|
imagedashedline($im, 800, 400, 400, 800, $color);
|
||||||
imagedashedline($im, 800, 400, 500, 800, $color);
|
imagedashedline($im, 800, 400, 500, 800, $color);
|
||||||
imagedashedline($im, 800, 400, 600, 800, $color);
|
imagedashedline($im, 800, 400, 600, 800, $color);
|
||||||
imagedashedline($im, 800, 400, 700, 800, $color);
|
imagedashedline($im, 800, 400, 700, 800, $color);
|
||||||
imagedashedline($im, 800, 400, 800, 800, $color);
|
imagedashedline($im, 800, 400, 800, 800, $color);
|
||||||
include_once __DIR__ . '/func.inc';
|
include_once __DIR__ . '/func.inc';
|
||||||
test_image_equals_file(__DIR__ . '/bug52070.png', $im);
|
test_image_equals_file(__DIR__ . '/bug52070.png', $im);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
The images are equal.
|
The images are equal.
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #53156 (imagerectangle problem with point ordering)
|
Bug #53156 (imagerectangle problem with point ordering)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
|
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
|
||||||
die("skip test requires GD 2.3 or newer");
|
die("skip test requires GD 2.3 or newer");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
function draw_and_check_pixel($x, $y)
|
function draw_and_check_pixel($x, $y)
|
||||||
{
|
{
|
||||||
global $img, $black, $red;
|
global $img, $black, $red;
|
||||||
|
|
||||||
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
|
echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
|
||||||
imagesetpixel($img, $x, $y, $red);
|
imagesetpixel($img, $x, $y, $red);
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw_and_check_rectangle($x1, $y1, $x2, $y2)
|
function draw_and_check_rectangle($x1, $y1, $x2, $y2)
|
||||||
{
|
{
|
||||||
global $img, $black;
|
global $img, $black;
|
||||||
|
|
||||||
echo 'Rectangle: ';
|
echo 'Rectangle: ';
|
||||||
imagerectangle($img, $x1, $y1, $x2, $y2, $black);
|
imagerectangle($img, $x1, $y1, $x2, $y2, $black);
|
||||||
$x = ($x1 + $x2) / 2;
|
$x = ($x1 + $x2) / 2;
|
||||||
$y = ($y1 + $y2) / 2;
|
$y = ($y1 + $y2) / 2;
|
||||||
draw_and_check_pixel($x, $y1);
|
draw_and_check_pixel($x, $y1);
|
||||||
draw_and_check_pixel($x1, $y);
|
draw_and_check_pixel($x1, $y);
|
||||||
draw_and_check_pixel($x, $y2);
|
draw_and_check_pixel($x, $y2);
|
||||||
draw_and_check_pixel($x2, $y);
|
draw_and_check_pixel($x2, $y);
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$img = imagecreate(110, 210);
|
$img = imagecreate(110, 210);
|
||||||
$bgnd = imagecolorallocate($img, 255, 255, 255);
|
$bgnd = imagecolorallocate($img, 255, 255, 255);
|
||||||
$black = imagecolorallocate($img, 0, 0, 0);
|
$black = imagecolorallocate($img, 0, 0, 0);
|
||||||
$red = imagecolorallocate($img, 255, 0, 0);
|
$red = imagecolorallocate($img, 255, 0, 0);
|
||||||
|
|
||||||
draw_and_check_rectangle( 10, 10, 50, 50);
|
draw_and_check_rectangle( 10, 10, 50, 50);
|
||||||
draw_and_check_rectangle( 50, 60, 10, 100);
|
draw_and_check_rectangle( 50, 60, 10, 100);
|
||||||
draw_and_check_rectangle( 50, 150, 10, 110);
|
draw_and_check_rectangle( 50, 150, 10, 110);
|
||||||
draw_and_check_rectangle( 10, 200, 50, 160);
|
draw_and_check_rectangle( 10, 200, 50, 160);
|
||||||
imagesetthickness($img, 4);
|
imagesetthickness($img, 4);
|
||||||
draw_and_check_rectangle( 60, 10, 100, 50);
|
draw_and_check_rectangle( 60, 10, 100, 50);
|
||||||
draw_and_check_rectangle(100, 60, 60, 100);
|
draw_and_check_rectangle(100, 60, 60, 100);
|
||||||
draw_and_check_rectangle(100, 150, 60, 110);
|
draw_and_check_rectangle(100, 150, 60, 110);
|
||||||
draw_and_check_rectangle( 60, 200, 100, 160);
|
draw_and_check_rectangle( 60, 200, 100, 160);
|
||||||
|
|
||||||
//imagepng($img, __DIR__ . '/bug53156.png'); // debug
|
//imagepng($img, __DIR__ . '/bug53156.png'); // debug
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
Rectangle: ++++
|
Rectangle: ++++
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #72494 (imagecropauto out-of-bounds access)
|
Bug #72494 (imagecropauto out-of-bounds access)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$im = imagecreate(10,10);
|
$im = imagecreate(10,10);
|
||||||
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
|
imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
|
Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||||
|
|
||||||
$src = imagecreatetruecolor(100, 100);
|
$src = imagecreatetruecolor(100, 100);
|
||||||
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
||||||
imageellipse($src, 49,49, 40,40, 0x000000);
|
imageellipse($src, 49,49, 40,40, 0x000000);
|
||||||
|
|
||||||
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
||||||
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||||
$dst = imagerotate($src, 60, 0xFFFFFF);
|
$dst = imagerotate($src, 60, 0xFFFFFF);
|
||||||
|
|
||||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
The images are equal.
|
The images are equal.
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
|
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
|
||||||
die('skip only for bundled libgd or external libgd >= 2.2.4');
|
die('skip only for bundled libgd or external libgd >= 2.2.4');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$src = imagecreate(100, 100);
|
$src = imagecreate(100, 100);
|
||||||
imagecolorallocate($src, 255, 255, 255);
|
imagecolorallocate($src, 255, 255, 255);
|
||||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
color: ffffff
|
color: ffffff
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
|
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
|
||||||
die('skip only for external libgd < 2.2.4');
|
die('skip only for external libgd < 2.2.4');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$src = imagecreate(100, 100);
|
$src = imagecreate(100, 100);
|
||||||
imagecolorallocate($src, 255, 255, 255);
|
imagecolorallocate($src, 255, 255, 255);
|
||||||
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||||
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
printf("color: %x\n", imagecolorat($dst, 99, 99));
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--XFAIL--
|
--XFAIL--
|
||||||
Bug #330 has not yet been fixed
|
Bug #330 has not yet been fixed
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
color: ffffff
|
color: ffffff
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73968 (Premature failing of XBM reading)
|
Bug #73968 (Premature failing of XBM reading)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
|
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
|
||||||
var_dump($im);
|
var_dump($im);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
resource(%d) of type (gd)
|
resource(%d) of type (gd)
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,148 +1,148 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function get_gd_version()
|
function get_gd_version()
|
||||||
{
|
{
|
||||||
return GD_VERSION;
|
return GD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_php_info()
|
function get_php_info()
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
phpinfo();
|
phpinfo();
|
||||||
$info = ob_get_contents();
|
$info = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_freetype_version()
|
function get_freetype_version()
|
||||||
{
|
{
|
||||||
$version = 0;
|
$version = 0;
|
||||||
|
|
||||||
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||||
$version = $match[1];
|
$version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_libjpeg_version()
|
function get_libjpeg_version()
|
||||||
{
|
{
|
||||||
$version = 0;
|
$version = 0;
|
||||||
|
|
||||||
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
|
if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
|
||||||
$version = $match[1];
|
$version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_libpng_version()
|
function get_libpng_version()
|
||||||
{
|
{
|
||||||
$version = 0;
|
$version = 0;
|
||||||
|
|
||||||
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
|
||||||
$version = $match[1];
|
$version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_libxpm_version()
|
function get_libxpm_version()
|
||||||
{
|
{
|
||||||
$version = 0;
|
$version = 0;
|
||||||
|
|
||||||
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
|
if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
|
||||||
$version = $match[1];
|
$version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that an in-memory image equals a PNG file.
|
* Tests that an in-memory image equals a PNG file.
|
||||||
*
|
*
|
||||||
* It checks for equal image sizes, and whether any pixels are different.
|
* It checks for equal image sizes, and whether any pixels are different.
|
||||||
* The textual result is printed, so the EXPECT section should contain the line
|
* The textual result is printed, so the EXPECT section should contain the line
|
||||||
* "The images are equal."
|
* "The images are equal."
|
||||||
*
|
*
|
||||||
* If the PNG file does not exists, or the images are not equal, a diagnostic
|
* If the PNG file does not exists, or the images are not equal, a diagnostic
|
||||||
* message is printed, and the actual file is stored right beside the temporary
|
* message is printed, and the actual file is stored right beside the temporary
|
||||||
* .php test file with the extension .out.png, to be able to manually inspect
|
* .php test file with the extension .out.png, to be able to manually inspect
|
||||||
* the result.
|
* the result.
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
* @param resource $actual
|
* @param resource $actual
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function test_image_equals_file($filename, $actual)
|
function test_image_equals_file($filename, $actual)
|
||||||
{
|
{
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
echo "The expected image does not exist.\n";
|
echo "The expected image does not exist.\n";
|
||||||
save_actual_image($actual);
|
save_actual_image($actual);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$actual = test_to_truecolor($actual);
|
$actual = test_to_truecolor($actual);
|
||||||
$expected = imagecreatefrompng($filename);
|
$expected = imagecreatefrompng($filename);
|
||||||
$expected = test_to_truecolor($expected);
|
$expected = test_to_truecolor($expected);
|
||||||
$exp_x = imagesx($expected);
|
$exp_x = imagesx($expected);
|
||||||
$exp_y = imagesy($expected);
|
$exp_y = imagesy($expected);
|
||||||
$act_x = imagesx($actual);
|
$act_x = imagesx($actual);
|
||||||
$act_y = imagesy($actual);
|
$act_y = imagesy($actual);
|
||||||
if ($exp_x != $act_x || $exp_y != $act_y) {
|
if ($exp_x != $act_x || $exp_y != $act_y) {
|
||||||
echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
|
echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
|
||||||
save_actual_image($actual);
|
save_actual_image($actual);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$pixels_changed = 0;
|
$pixels_changed = 0;
|
||||||
for ($y = 0; $y < $exp_y; $y++) {
|
for ($y = 0; $y < $exp_y; $y++) {
|
||||||
for ($x = 0; $x < $exp_x; $x ++) {
|
for ($x = 0; $x < $exp_x; $x ++) {
|
||||||
$exp_c = imagecolorat($expected, $x, $y);
|
$exp_c = imagecolorat($expected, $x, $y);
|
||||||
$act_c = imagecolorat($actual, $x, $y);
|
$act_c = imagecolorat($actual, $x, $y);
|
||||||
if ($exp_c != $act_c) {
|
if ($exp_c != $act_c) {
|
||||||
$pixels_changed++;
|
$pixels_changed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$pixels_changed) {
|
if (!$pixels_changed) {
|
||||||
echo "The images are equal.\n";
|
echo "The images are equal.\n";
|
||||||
} else {
|
} else {
|
||||||
echo "The images differ in {$pixels_changed} pixels.\n";
|
echo "The images differ in {$pixels_changed} pixels.\n";
|
||||||
save_actual_image($actual);
|
save_actual_image($actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the truecolor version of an image.
|
* Returns the truecolor version of an image.
|
||||||
*
|
*
|
||||||
* @param resource $image
|
* @param resource $image
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
function test_to_truecolor($image)
|
function test_to_truecolor($image)
|
||||||
{
|
{
|
||||||
if (imageistruecolor($image)) {
|
if (imageistruecolor($image)) {
|
||||||
return $image;
|
return $image;
|
||||||
} else {
|
} else {
|
||||||
$width = imagesx($image);
|
$width = imagesx($image);
|
||||||
$height = imagesy($image);
|
$height = imagesy($image);
|
||||||
$result = imagecreatetruecolor($width, $height);
|
$result = imagecreatetruecolor($width, $height);
|
||||||
imagecopy($result, $image, 0,0, 0,0, $width, $height);
|
imagecopy($result, $image, 0,0, 0,0, $width, $height);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves an actual image to disk.
|
* Saves an actual image to disk.
|
||||||
*
|
*
|
||||||
* The image is saved right beside the temporary .php test file with the
|
* The image is saved right beside the temporary .php test file with the
|
||||||
* extension .out.png.
|
* extension .out.png.
|
||||||
*
|
*
|
||||||
* @param resource $image
|
* @param resource $image
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function save_actual_image($image)
|
function save_actual_image($image)
|
||||||
{
|
{
|
||||||
$pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
|
$pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
|
||||||
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
|
$filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
|
||||||
imagepng($image, $filename);
|
imagepng($image, $filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing imagecropauto()
|
Testing imagecropauto()
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||||
if (GD_BUNDLED) die('skip requires external libgd');
|
if (GD_BUNDLED) die('skip requires external libgd');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo "TC IMG_CROP_DEFAULT\n";
|
echo "TC IMG_CROP_DEFAULT\n";
|
||||||
$im = imagecreatetruecolor(99, 99);
|
$im = imagecreatetruecolor(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_DEFAULT\n";
|
echo "Palette IMG_CROP_DEFAULT\n";
|
||||||
$im = imagecreate(99, 99);
|
$im = imagecreate(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "TC IMG_CROP_SIDES\n";
|
echo "TC IMG_CROP_SIDES\n";
|
||||||
$im = imagecreatetruecolor(99, 99);
|
$im = imagecreatetruecolor(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_SIDES\n";
|
echo "Palette IMG_CROP_SIDES\n";
|
||||||
$im = imagecreate(99, 99);
|
$im = imagecreate(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "TC IMG_CROP_BLACK\n";
|
echo "TC IMG_CROP_BLACK\n";
|
||||||
$im = imagecreatetruecolor(50, 50);
|
$im = imagecreatetruecolor(50, 50);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_BLACK\n";
|
echo "Palette IMG_CROP_BLACK\n";
|
||||||
$im = imagecreate(50, 50);
|
$im = imagecreate(50, 50);
|
||||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||||
$b = imagecolorallocate($im, 0, 0, 255);
|
$b = imagecolorallocate($im, 0, 0, 255);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "IMG_CROP_THRESHOLD\n";
|
echo "IMG_CROP_THRESHOLD\n";
|
||||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
@unlink(__DIR__ . "/crop_threshold.png");
|
@unlink(__DIR__ . "/crop_threshold.png");
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
TC IMG_CROP_DEFAULT
|
TC IMG_CROP_DEFAULT
|
||||||
int(99)
|
int(99)
|
||||||
int(99)
|
int(99)
|
||||||
Palette IMG_CROP_DEFAULT
|
Palette IMG_CROP_DEFAULT
|
||||||
int(99)
|
int(99)
|
||||||
int(99)
|
int(99)
|
||||||
TC IMG_CROP_SIDES
|
TC IMG_CROP_SIDES
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
Palette IMG_CROP_SIDES
|
Palette IMG_CROP_SIDES
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
TC IMG_CROP_BLACK
|
TC IMG_CROP_BLACK
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
Palette IMG_CROP_BLACK
|
Palette IMG_CROP_BLACK
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
IMG_CROP_THRESHOLD
|
IMG_CROP_THRESHOLD
|
||||||
int(240)
|
int(240)
|
||||||
int(134)
|
int(134)
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing imagecropauto()
|
Testing imagecropauto()
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
|
||||||
if (!GD_BUNDLED) die('skip requires bundled libgd');
|
if (!GD_BUNDLED) die('skip requires bundled libgd');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo "TC IMG_CROP_DEFAULT\n";
|
echo "TC IMG_CROP_DEFAULT\n";
|
||||||
$im = imagecreatetruecolor(99, 99);
|
$im = imagecreatetruecolor(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_DEFAULT\n";
|
echo "Palette IMG_CROP_DEFAULT\n";
|
||||||
$im = imagecreate(99, 99);
|
$im = imagecreate(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "TC IMG_CROP_SIDES\n";
|
echo "TC IMG_CROP_SIDES\n";
|
||||||
$im = imagecreatetruecolor(99, 99);
|
$im = imagecreatetruecolor(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_SIDES\n";
|
echo "Palette IMG_CROP_SIDES\n";
|
||||||
$im = imagecreate(99, 99);
|
$im = imagecreate(99, 99);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
$im_crop = imagecropauto($im, IMG_CROP_SIDES);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "TC IMG_CROP_BLACK\n";
|
echo "TC IMG_CROP_BLACK\n";
|
||||||
$im = imagecreatetruecolor(50, 50);
|
$im = imagecreatetruecolor(50, 50);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "Palette IMG_CROP_BLACK\n";
|
echo "Palette IMG_CROP_BLACK\n";
|
||||||
$im = imagecreate(50, 50);
|
$im = imagecreate(50, 50);
|
||||||
$bgd = imagecolorallocate($im, 0, 0, 0);
|
$bgd = imagecolorallocate($im, 0, 0, 0);
|
||||||
$b = imagecolorallocate($im, 0, 0, 255);
|
$b = imagecolorallocate($im, 0, 0, 255);
|
||||||
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
$im_crop = imagecropauto($im, IMG_CROP_BLACK);
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
echo "IMG_CROP_THRESHOLD\n";
|
echo "IMG_CROP_THRESHOLD\n";
|
||||||
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
|
||||||
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
|
||||||
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
|
||||||
var_dump(imagesx($im_crop));
|
var_dump(imagesx($im_crop));
|
||||||
var_dump(imagesy($im_crop));
|
var_dump(imagesy($im_crop));
|
||||||
|
|
||||||
@unlink(__DIR__ . "/crop_threshold.png");
|
@unlink(__DIR__ . "/crop_threshold.png");
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
TC IMG_CROP_DEFAULT
|
TC IMG_CROP_DEFAULT
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
Palette IMG_CROP_DEFAULT
|
Palette IMG_CROP_DEFAULT
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
TC IMG_CROP_SIDES
|
TC IMG_CROP_SIDES
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
Palette IMG_CROP_SIDES
|
Palette IMG_CROP_SIDES
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
TC IMG_CROP_BLACK
|
TC IMG_CROP_BLACK
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
Palette IMG_CROP_BLACK
|
Palette IMG_CROP_BLACK
|
||||||
int(11)
|
int(11)
|
||||||
int(11)
|
int(11)
|
||||||
IMG_CROP_THRESHOLD
|
IMG_CROP_THRESHOLD
|
||||||
int(240)
|
int(240)
|
||||||
int(134)
|
int(134)
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imageellipse() of GD library
|
Testing wrong param passing imageellipse() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-20
|
#testfest PHPSP on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 400, 300 );
|
$image = imagecreatetruecolor( 400, 300 );
|
||||||
|
|
||||||
// try to draw a white ellipse
|
// try to draw a white ellipse
|
||||||
imageellipse( $image, 200, 150, 300, 200 );
|
imageellipse( $image, 200, 150, 300, 200 );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
|
Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagefilltoborder() of GD library
|
Testing wrong param passing imagefilltoborder() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
|
if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
|
imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
|
||||||
|
|
||||||
// Draw an ellipse to fill with a black border
|
// Draw an ellipse to fill with a black border
|
||||||
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
|
imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
|
||||||
|
|
||||||
// Try to fill border
|
// Try to fill border
|
||||||
imagefilltoborder( $image, 50, 50 );
|
imagefilltoborder( $image, 50, 50 );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
|
Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing imageflip() of GD library
|
Testing imageflip() of GD library
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$im = imagecreatetruecolor( 99, 99 );
|
$im = imagecreatetruecolor( 99, 99 );
|
||||||
|
|
||||||
imagesetpixel($im, 0, 0, 0xFF);
|
imagesetpixel($im, 0, 0, 0xFF);
|
||||||
imagesetpixel($im, 0, 98, 0x00FF00);
|
imagesetpixel($im, 0, 98, 0x00FF00);
|
||||||
imagesetpixel($im, 98, 0, 0xFF0000);
|
imagesetpixel($im, 98, 0, 0xFF0000);
|
||||||
imagesetpixel($im, 98, 98, 0x0000FF);
|
imagesetpixel($im, 98, 98, 0x0000FF);
|
||||||
|
|
||||||
imageflip($im, IMG_FLIP_HORIZONTAL);
|
imageflip($im, IMG_FLIP_HORIZONTAL);
|
||||||
imageflip($im, IMG_FLIP_VERTICAL);
|
imageflip($im, IMG_FLIP_VERTICAL);
|
||||||
imageflip($im, IMG_FLIP_BOTH);
|
imageflip($im, IMG_FLIP_BOTH);
|
||||||
|
|
||||||
var_dump(dechex(imagecolorat($im, 0, 0)));
|
var_dump(dechex(imagecolorat($im, 0, 0)));
|
||||||
var_dump(dechex(imagecolorat($im, 0, 98)));
|
var_dump(dechex(imagecolorat($im, 0, 98)));
|
||||||
var_dump(dechex(imagecolorat($im, 98, 0)));
|
var_dump(dechex(imagecolorat($im, 98, 0)));
|
||||||
var_dump(dechex(imagecolorat($im, 98, 98)));
|
var_dump(dechex(imagecolorat($im, 98, 98)));
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(2) "ff"
|
string(2) "ff"
|
||||||
string(4) "ff00"
|
string(4) "ff00"
|
||||||
string(6) "ff0000"
|
string(6) "ff0000"
|
||||||
string(2) "ff"
|
string(2) "ff"
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing imagerectangle() of GD library
|
Testing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||||
|
|
||||||
include_once __DIR__ . '/func.inc';
|
include_once __DIR__ . '/func.inc';
|
||||||
test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
|
test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
The images are equal.
|
The images are equal.
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a resource
|
// Create a resource
|
||||||
$image = tmpfile();
|
$image = tmpfile();
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 50, 50, 2 );
|
imagerectangle( $image, 0, 0, 50, 50, 2 );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
|
Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
|
imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
|
imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d
|
Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Testing wrong param passing imagerectangle() of GD library
|
Testing wrong param passing imagerectangle() of GD library
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
Ivan Rosolen <contato [at] ivanrosolen [dot] com>
|
||||||
#testfest PHPSP on 2009-06-30
|
#testfest PHPSP on 2009-06-30
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// Create a image
|
// Create a image
|
||||||
$image = imagecreatetruecolor( 100, 100 );
|
$image = imagecreatetruecolor( 100, 100 );
|
||||||
|
|
||||||
// Draw a rectangle
|
// Draw a rectangle
|
||||||
imagerectangle( $image, 0, 0, 50, 50 );
|
imagerectangle( $image, 0, 0, 50, 50 );
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
|
Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
test_image_equals_file(): comparing palette images
|
test_image_equals_file(): comparing palette images
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||||
|
|
||||||
$im = imagecreate(10, 10);
|
$im = imagecreate(10, 10);
|
||||||
imagecolorallocate($im, 255, 255, 255);
|
imagecolorallocate($im, 255, 255, 255);
|
||||||
$red = imagecolorallocate($im, 255, 0, 0);
|
$red = imagecolorallocate($im, 255, 0, 0);
|
||||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||||
|
|
||||||
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
|
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
|
||||||
imagepng($im, $filename);
|
imagepng($im, $filename);
|
||||||
|
|
||||||
$im = imagecreate(10, 10);
|
$im = imagecreate(10, 10);
|
||||||
imagecolorallocate($im, 255, 255, 255);
|
imagecolorallocate($im, 255, 255, 255);
|
||||||
$blue = imagecolorallocate($im, 0, 0, 255);
|
$blue = imagecolorallocate($im, 0, 0, 255);
|
||||||
imagefilledrectangle($im, 3,3, 7,7, $blue);
|
imagefilledrectangle($im, 3,3, 7,7, $blue);
|
||||||
|
|
||||||
test_image_equals_file($filename, $im);
|
test_image_equals_file($filename, $im);
|
||||||
|
|
||||||
$im = imagecreate(10, 10);
|
$im = imagecreate(10, 10);
|
||||||
imagecolorallocate($im, 255, 255, 255);
|
imagecolorallocate($im, 255, 255, 255);
|
||||||
imagecolorallocate($im, 0, 0, 0);
|
imagecolorallocate($im, 0, 0, 0);
|
||||||
$red = imagecolorallocate($im, 255, 0, 0);
|
$red = imagecolorallocate($im, 255, 0, 0);
|
||||||
imagefilledrectangle($im, 3,3, 7,7, $red);
|
imagefilledrectangle($im, 3,3, 7,7, $red);
|
||||||
|
|
||||||
test_image_equals_file($filename, $im);
|
test_image_equals_file($filename, $im);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
The images differ in 25 pixels.
|
The images differ in 25 pixels.
|
||||||
The images are equal.
|
The images are equal.
|
||||||
===DONE===
|
===DONE===
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
|
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
imagewebp() and imagecreatefromwebp() - basic test
|
imagewebp() and imagecreatefromwebp() - basic test
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
|
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
|
||||||
die("skip test requires GD 2.2.0 or higher");
|
die("skip test requires GD 2.2.0 or higher");
|
||||||
}
|
}
|
||||||
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
||||||
die('skip WebP support not available');
|
die('skip WebP support not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/similarity.inc';
|
require_once __DIR__ . '/similarity.inc';
|
||||||
|
|
||||||
$filename = __DIR__ . '/webp_basic.webp';
|
$filename = __DIR__ . '/webp_basic.webp';
|
||||||
|
|
||||||
$im1 = imagecreatetruecolor(75, 75);
|
$im1 = imagecreatetruecolor(75, 75);
|
||||||
$white = imagecolorallocate($im1, 255, 255, 255);
|
$white = imagecolorallocate($im1, 255, 255, 255);
|
||||||
$red = imagecolorallocate($im1, 255, 0, 0);
|
$red = imagecolorallocate($im1, 255, 0, 0);
|
||||||
$green = imagecolorallocate($im1, 0, 255, 0);
|
$green = imagecolorallocate($im1, 0, 255, 0);
|
||||||
$blue = imagecolorallocate($im1, 0, 0, 255);
|
$blue = imagecolorallocate($im1, 0, 0, 255);
|
||||||
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
||||||
imageline($im1, 3, 3, 71, 71, $red);
|
imageline($im1, 3, 3, 71, 71, $red);
|
||||||
imageellipse($im1, 18, 54, 36, 36, $green);
|
imageellipse($im1, 18, 54, 36, 36, $green);
|
||||||
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
||||||
imagewebp($im1, $filename);
|
imagewebp($im1, $filename);
|
||||||
|
|
||||||
$im2 = imagecreatefromwebp($filename);
|
$im2 = imagecreatefromwebp($filename);
|
||||||
imagewebp($im2, $filename);
|
imagewebp($im2, $filename);
|
||||||
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
||||||
?>
|
?>
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
@unlink(__DIR__ . '/webp_basic.webp');
|
@unlink(__DIR__ . '/webp_basic.webp');
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -31,4 +31,4 @@ int(0)
|
||||||
int(0)
|
int(0)
|
||||||
int(0)
|
int(0)
|
||||||
int(1)
|
int(1)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000);
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -23,4 +23,4 @@ bool(true)
|
||||||
int(6)
|
int(6)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(5)
|
int(5)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
ini_set("intl.default_locale", "pt_PT");
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
ini_set("date.timezone", "Europe/Lisbon");
|
ini_set("date.timezone", "Europe/Lisbon");
|
||||||
|
|
||||||
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
|
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
|
||||||
echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
|
||||||
echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
||||||
echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||||
|
|
||||||
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
|
$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
|
||||||
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
|
echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
|
||||||
|
|
||||||
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
|
$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
|
||||||
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
|
$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
|
||||||
echo IntlDateFormatter::formatObject($cal), "\n";
|
echo IntlDateFormatter::formatObject($cal), "\n";
|
||||||
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
01/01/2012 00:00:00
|
01/01/2012 00:00:00
|
||||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||||
Jan 1, 2012 12:00:00 AM
|
Jan 1, 2012 12:00:00 AM
|
||||||
1/1/12 12:00:00 AM Western European %STime
|
1/1/12 12:00:00 AM Western European %STime
|
||||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||||
06/02/1433 00:00:00
|
06/02/1433 00:00:00
|
||||||
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
|
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlDateFormatter::formatObject(): IntlCalendar tests
|
IntlDateFormatter::formatObject(): IntlCalendar tests
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
ini_set("intl.default_locale", "pt_PT");
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
|
@ -27,8 +27,8 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\
|
||||||
|
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
01/01/2012, 00:00:00
|
01/01/2012, 00:00:00
|
||||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||||
Jan 1, 2012, 12:00:00 AM
|
Jan 1, 2012, 12:00:00 AM
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlDateFormatter::formatObject(): DateTime tests
|
IntlDateFormatter::formatObject(): DateTime tests
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
|
if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
ini_set("intl.default_locale", "pt_PT");
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
ini_set("date.timezone", "Europe/Lisbon");
|
ini_set("date.timezone", "Europe/Lisbon");
|
||||||
|
|
||||||
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
|
||||||
echo IntlDateFormatter::formatObject($dt), "\n";
|
echo IntlDateFormatter::formatObject($dt), "\n";
|
||||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||||
echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
|
||||||
echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
|
||||||
echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
|
||||||
|
|
||||||
$dt = new DateTime('2012-01-01 05:00:00+03:00');
|
$dt = new DateTime('2012-01-01 05:00:00+03:00');
|
||||||
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
01/01/2012 00:00:00
|
01/01/2012 00:00:00
|
||||||
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
|
||||||
Jan 1, 2012 12:00:00 AM
|
Jan 1, 2012 12:00:00 AM
|
||||||
1/1/12 12:00:00 AM Western European %STime
|
1/1/12 12:00:00 AM Western European %STime
|
||||||
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
|
||||||
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlDateFormatter::formatObject(): DateTime tests
|
IntlDateFormatter::formatObject(): DateTime tests
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
|
||||||
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
|
<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
ini_set("intl.default_locale", "pt_PT");
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
|
@ -22,8 +22,8 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
01/01/2012, 00:00:00
|
01/01/2012, 00:00:00
|
||||||
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
|
||||||
Jan 1, 2012, 12:00:00 AM
|
Jan 1, 2012, 12:00:00 AM
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
IntlDateFormatter::formatObject(): error conditions
|
IntlDateFormatter::formatObject(): error conditions
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('intl'))
|
if (!extension_loaded('intl'))
|
||||||
die('skip intl extension not enabled');
|
die('skip intl extension not enabled');
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
ini_set("intl.error_level", E_WARNING);
|
ini_set("intl.error_level", E_WARNING);
|
||||||
ini_set("intl.default_locale", "pt_PT");
|
ini_set("intl.default_locale", "pt_PT");
|
||||||
|
@ -30,8 +30,8 @@ var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
|
||||||
Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
|
Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
@ -71,4 +71,4 @@ bool(false)
|
||||||
Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
|
Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files
|
// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files
|
||||||
|
|
||||||
// DEFINE YOUR ICU TOOLS PATH HERE
|
// DEFINE YOUR ICU TOOLS PATH HERE
|
||||||
define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");
|
define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");
|
||||||
|
|
||||||
$here = dirname(__FILE__);
|
$here = dirname(__FILE__);
|
||||||
|
|
||||||
$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);
|
$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);
|
||||||
|
|
||||||
foreach($dir as $file) {
|
foreach($dir as $file) {
|
||||||
passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());
|
passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);
|
$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);
|
||||||
foreach($dir as $file) {
|
foreach($dir as $file) {
|
||||||
if($file->getFileName() == "res_index.res") continue;
|
if($file->getFileName() == "res_index.res") continue;
|
||||||
$list[] = str_replace(".res", "", $file->getFileName());
|
$list[] = str_replace(".res", "", $file->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
$filelist = join(" {\"\"}\n", $list);
|
$filelist = join(" {\"\"}\n", $list);
|
||||||
$res_index = <<<END
|
$res_index = <<<END
|
||||||
res_index:table(nofallback) {
|
res_index:table(nofallback) {
|
||||||
InstalledLocales {
|
InstalledLocales {
|
||||||
$filelist {""}
|
$filelist {""}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END;
|
END;
|
||||||
file_put_contents("$here/_files/res_index.txt", $res_index);
|
file_put_contents("$here/_files/res_index.txt", $res_index);
|
||||||
|
|
||||||
passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");
|
passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");
|
||||||
|
|
||||||
// passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");
|
// passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");
|
|
@ -28,4 +28,4 @@ IntlTimeZone Object
|
||||||
[rawOffset] => %i
|
[rawOffset] => %i
|
||||||
[currentOffset] => %i
|
[currentOffset] => %i
|
||||||
)
|
)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -20,4 +20,4 @@ string(13) "Europe/Lisbon"
|
||||||
bool(true)
|
bool(true)
|
||||||
string(0) ""
|
string(0) ""
|
||||||
bool(false)
|
bool(false)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -32,4 +32,4 @@ string(5) "+0000"
|
||||||
string(3) "GMT"
|
string(3) "GMT"
|
||||||
string(3) "GMT"
|
string(3) "GMT"
|
||||||
string(13) "Portugal Time"
|
string(13) "Portugal Time"
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
|
Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
function test($str)
|
function test($str)
|
||||||
{
|
{
|
||||||
$upper = mb_strtoupper($str, 'UTF-8');
|
$upper = mb_strtoupper($str, 'UTF-8');
|
||||||
$len = strlen($upper);
|
$len = strlen($upper);
|
||||||
for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
|
for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK
|
// OK
|
||||||
test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
|
test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
|
||||||
// not OK
|
// not OK
|
||||||
test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
|
test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
|
||||||
test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
|
test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
f0 90 90 90
|
f0 90 90 90
|
||||||
e2 b0 80
|
e2 b0 80
|
||||||
d4 a4
|
d4 a4
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
|
Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
|
var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
|
||||||
var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
|
var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(12) "Windows-1251"
|
string(12) "Windows-1251"
|
||||||
string(12) "Windows-1251"
|
string(12) "Windows-1251"
|
||||||
|
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
|
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
|
||||||
--CREDIT--
|
--CREDIT--
|
||||||
Ryan Biesemeyer <ryan@yaauie.com>
|
Ryan Biesemeyer <ryan@yaauie.com>
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
for( $i=1; $i<=64; $i = $i*2 ){
|
for( $i=1; $i<=64; $i = $i*2 ){
|
||||||
echo 'Input: '. $i . PHP_EOL;
|
echo 'Input: '. $i . PHP_EOL;
|
||||||
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
|
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
|
||||||
echo ' Length: ' . strlen( $random ) . PHP_EOL;
|
echo ' Length: ' . strlen( $random ) . PHP_EOL;
|
||||||
echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
|
echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Input: 1
|
Input: 1
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 1
|
Length: 1
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 2
|
Input: 2
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 2
|
Length: 2
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 4
|
Input: 4
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 4
|
Length: 4
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 8
|
Input: 8
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 8
|
Length: 8
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 16
|
Input: 16
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 16
|
Length: 16
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 32
|
Input: 32
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 32
|
Length: 32
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
||||||
Input: 64
|
Input: 64
|
||||||
|
|
||||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||||
Length: 64
|
Length: 64
|
||||||
Hex: %x
|
Hex: %x
|
||||||
|
|
|
@ -1,66 +1,66 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
|
Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
require_once('skipifconnectfailure.inc');
|
require_once('skipifconnectfailure.inc');
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||||
die("skip Cannot connect to MySQL");
|
die("skip Cannot connect to MySQL");
|
||||||
|
|
||||||
include_once("local_infile_tools.inc");
|
include_once("local_infile_tools.inc");
|
||||||
if ($msg = check_local_infile_support($link, $engine))
|
if ($msg = check_local_infile_support($link, $engine))
|
||||||
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
|
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$link->query("DROP TABLE IF EXISTS test")) {
|
if (!$link->query("DROP TABLE IF EXISTS test")) {
|
||||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
|
if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
|
||||||
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
printf("[003] [%d] %s\n", $link->errno, $link->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
|
if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
|
||||||
printf("[004] Failed to create CVS file\n");
|
printf("[004] Failed to create CVS file\n");
|
||||||
|
|
||||||
if (!$link->query("SELECT 1 FROM DUAL"))
|
if (!$link->query("SELECT 1 FROM DUAL"))
|
||||||
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
printf("[005] [%d] %s\n", $link->errno, $link->error);
|
||||||
|
|
||||||
if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
|
if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
|
||||||
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
printf("[006] [%d] %s\n", $link->errno, $link->error);
|
||||||
echo "bug";
|
echo "bug";
|
||||||
} else {
|
} else {
|
||||||
echo "done";
|
echo "done";
|
||||||
}
|
}
|
||||||
$link->close();
|
$link->close();
|
||||||
?>
|
?>
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
require_once('connect.inc');
|
require_once('connect.inc');
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||||
$host, $user, $db, $port, $socket);
|
$host, $user, $db, $port, $socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
|
if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
|
||||||
printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
$link->close();
|
$link->close();
|
||||||
|
|
||||||
unlink('bug53503.data');
|
unlink('bug53503.data');
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
done
|
done
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #55653 PS crash with libmysql when binding same variable as param and out
|
Bug #55653 PS crash with libmysql when binding same variable as param and out
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
require_once('skipifconnectfailure.inc');
|
require_once('skipifconnectfailure.inc');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
$in_and_out = "a";
|
$in_and_out = "a";
|
||||||
|
|
||||||
if (!($stmt = $link->stmt_init()))
|
if (!($stmt = $link->stmt_init()))
|
||||||
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
printf("[002] [%d] %s\n", $link->errno, $link->error);
|
||||||
|
|
||||||
if (!($stmt->prepare("SELECT ?")) ||
|
if (!($stmt->prepare("SELECT ?")) ||
|
||||||
!($stmt->bind_param("s", $in_and_out)) ||
|
!($stmt->bind_param("s", $in_and_out)) ||
|
||||||
!($stmt->execute()) ||
|
!($stmt->execute()) ||
|
||||||
!($stmt->bind_result($in_and_out)))
|
!($stmt->bind_result($in_and_out)))
|
||||||
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
|
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||||
|
|
||||||
if (!$stmt->fetch())
|
if (!$stmt->fetch())
|
||||||
printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
|
printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
|
||||||
|
|
||||||
if ("a" !== $in_and_out)
|
if ("a" !== $in_and_out)
|
||||||
printf("[005] Wrong result: '%s'\n", $in_and_out);
|
printf("[005] Wrong result: '%s'\n", $in_and_out);
|
||||||
|
|
||||||
echo "done!";
|
echo "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
done!
|
done!
|
|
@ -1,20 +1,20 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #55859 mysqli->stat property access gives error
|
Bug #55859 mysqli->stat property access gives error
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
require_once('skipifconnectfailure.inc');
|
require_once('skipifconnectfailure.inc');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||||
}
|
}
|
||||||
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
|
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
|
||||||
echo "done!";
|
echo "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
done!
|
done!
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
|
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
require_once('skipifconnectfailure.inc');
|
require_once('skipifconnectfailure.inc');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||||
}
|
}
|
||||||
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
|
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
|
||||||
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
}
|
}
|
||||||
if (FALSE === $stmt->execute()) {
|
if (FALSE === $stmt->execute()) {
|
||||||
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||||
}
|
}
|
||||||
if (FALSE === $stmt->store_result()) {
|
if (FALSE === $stmt->store_result()) {
|
||||||
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||||
}
|
}
|
||||||
$one = NULL;
|
$one = NULL;
|
||||||
if (FALSE === $stmt->bind_result($one)) {
|
if (FALSE === $stmt->bind_result($one)) {
|
||||||
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||||
}
|
}
|
||||||
if (FALSE === $stmt->reset()) {
|
if (FALSE === $stmt->reset()) {
|
||||||
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
||||||
}
|
}
|
||||||
while ($stmt->fetch()) {
|
while ($stmt->fetch()) {
|
||||||
var_dump($one);
|
var_dump($one);
|
||||||
}
|
}
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
$link->close();
|
$link->close();
|
||||||
echo "done!";
|
echo "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
int(42)
|
int(42)
|
||||||
done!
|
done!
|
|
@ -1,26 +1,26 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #62885 (mysqli_poll - Segmentation fault)
|
Bug #62885 (mysqli_poll - Segmentation fault)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
if (!$IS_MYSQLND) {
|
if (!$IS_MYSQLND) {
|
||||||
die("skip mysqlnd only test");
|
die("skip mysqlnd only test");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
$tablica = array();
|
$tablica = array();
|
||||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||||
|
|
||||||
$test2 = array();
|
$test2 = array();
|
||||||
$test2 = array();
|
$test2 = array();
|
||||||
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
$test1 = mysqli_poll($test2, $test3, $tablica, null);
|
||||||
echo "okey";
|
echo "okey";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
|
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
|
||||||
|
|
||||||
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
|
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
|
||||||
okey
|
okey
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #69864 (Segfault in preg_replace_callback)
|
Bug #69864 (Segfault in preg_replace_callback)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
|
/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
|
||||||
|
|
||||||
const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
|
const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
|
||||||
|
|
||||||
var_dump(preg_replace_callback('/a/', function($m) {
|
var_dump(preg_replace_callback('/a/', function($m) {
|
||||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||||
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||||
}
|
}
|
||||||
return 'b';
|
return 'b';
|
||||||
}, 'aa'));
|
}, 'aa'));
|
||||||
var_dump(preg_replace_callback('/a/', function($m) {
|
var_dump(preg_replace_callback('/a/', function($m) {
|
||||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||||
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
|
preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
|
||||||
}
|
}
|
||||||
return 'b';
|
return 'b';
|
||||||
}, 'aa'));
|
}, 'aa'));
|
||||||
var_dump(preg_replace_callback('/a/', function($m) {
|
var_dump(preg_replace_callback('/a/', function($m) {
|
||||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||||
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
|
||||||
}
|
}
|
||||||
return 'b';
|
return 'b';
|
||||||
}, 'aa'));
|
}, 'aa'));
|
||||||
var_dump(preg_replace_callback('/a/', function($m) {
|
var_dump(preg_replace_callback('/a/', function($m) {
|
||||||
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
|
||||||
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
|
preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
|
||||||
}
|
}
|
||||||
return 'b';
|
return 'b';
|
||||||
}, 'aa'));
|
}, 'aa'));
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(2) "bb"
|
string(2) "bb"
|
||||||
string(2) "bb"
|
string(2) "bb"
|
||||||
string(2) "bb"
|
string(2) "bb"
|
||||||
string(2) "bb"
|
string(2) "bb"
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73612 (preg_*() may leak memory)
|
Bug #73612 (preg_*() may leak memory)
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->obj = $obj;
|
$obj->obj = $obj;
|
||||||
preg_match('/./', 'x', $obj);
|
preg_match('/./', 'x', $obj);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->obj = $obj;
|
$obj->obj = $obj;
|
||||||
preg_replace('/./', '', 'x', -1, $obj);
|
preg_replace('/./', '', 'x', -1, $obj);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->obj = $obj;
|
$obj->obj = $obj;
|
||||||
preg_replace_callback('/./', 'count', 'x', -1, $obj);
|
preg_replace_callback('/./', 'count', 'x', -1, $obj);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->obj = $obj;
|
$obj->obj = $obj;
|
||||||
preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
|
preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->obj = $obj;
|
$obj->obj = $obj;
|
||||||
preg_filter('/./', '', 'x', -1, $obj);
|
preg_filter('/./', '', 'x', -1, $obj);
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
PDO_MYSQL: Defining a connection charset in the DSN
|
PDO_MYSQL: Defining a connection charset in the DSN
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||||
MySQLPDOTest::skip();
|
MySQLPDOTest::skip();
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
|
||||||
|
|
||||||
/* Connect to mysql to determine the current charset so we can diffinate it */
|
/* Connect to mysql to determine the current charset so we can diffinate it */
|
||||||
$link = MySQLPDOTest::factory();
|
$link = MySQLPDOTest::factory();
|
||||||
$charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
$charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
||||||
|
|
||||||
/* Make sure that we don't attempt to set the current character set to make this case useful */
|
/* Make sure that we don't attempt to set the current character set to make this case useful */
|
||||||
$new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
|
$new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
|
||||||
|
|
||||||
/* Done with the original connection, create a second link to test the character set being defined */
|
/* Done with the original connection, create a second link to test the character set being defined */
|
||||||
unset($link);
|
unset($link);
|
||||||
|
|
||||||
$link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
|
$link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
|
||||||
$conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
$conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
|
||||||
|
|
||||||
if ($charset !== $conn_charset) {
|
if ($charset !== $conn_charset) {
|
||||||
echo "done!\n";
|
echo "done!\n";
|
||||||
} else {
|
} else {
|
||||||
echo "failed!\n";
|
echo "failed!\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
done!
|
done!
|
||||||
|
|
|
@ -1,78 +1,78 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
PostgreSQL non-blocking async query params
|
PostgreSQL non-blocking async query params
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
include("skipif.inc");
|
include("skipif.inc");
|
||||||
if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
|
if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include('config.inc');
|
include('config.inc');
|
||||||
include('nonblocking.inc');
|
include('nonblocking.inc');
|
||||||
|
|
||||||
$db = pg_connect($conn_str);
|
$db = pg_connect($conn_str);
|
||||||
|
|
||||||
$version = pg_version($db);
|
$version = pg_version($db);
|
||||||
if ($version['protocol'] < 3) {
|
if ($version['protocol'] < 3) {
|
||||||
echo "OK";
|
echo "OK";
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_socket = pg_socket($db);
|
$db_socket = pg_socket($db);
|
||||||
stream_set_blocking($db_socket, false);
|
stream_set_blocking($db_socket, false);
|
||||||
|
|
||||||
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
|
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
|
||||||
if ($sent === FALSE) {
|
if ($sent === FALSE) {
|
||||||
echo "pg_send_query_params() error\n";
|
echo "pg_send_query_params() error\n";
|
||||||
} elseif ($sent === 0) {
|
} elseif ($sent === 0) {
|
||||||
nb_flush($db, $db_socket);
|
nb_flush($db, $db_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
nb_consume($db, $db_socket);
|
nb_consume($db, $db_socket);
|
||||||
|
|
||||||
if (!($result = pg_get_result($db))) {
|
if (!($result = pg_get_result($db))) {
|
||||||
echo "pg_get_result() error\n";
|
echo "pg_get_result() error\n";
|
||||||
}
|
}
|
||||||
if (!($rows = pg_num_rows($result))) {
|
if (!($rows = pg_num_rows($result))) {
|
||||||
echo "pg_num_rows() error\n";
|
echo "pg_num_rows() error\n";
|
||||||
}
|
}
|
||||||
for ($i=0; $i < $rows; $i++) {
|
for ($i=0; $i < $rows; $i++) {
|
||||||
pg_fetch_array($result, $i, PGSQL_NUM);
|
pg_fetch_array($result, $i, PGSQL_NUM);
|
||||||
}
|
}
|
||||||
for ($i=0; $i < $rows; $i++) {
|
for ($i=0; $i < $rows; $i++) {
|
||||||
pg_fetch_object($result);
|
pg_fetch_object($result);
|
||||||
}
|
}
|
||||||
for ($i=0; $i < $rows; $i++) {
|
for ($i=0; $i < $rows; $i++) {
|
||||||
pg_fetch_row($result, $i);
|
pg_fetch_row($result, $i);
|
||||||
}
|
}
|
||||||
for ($i=0; $i < $rows; $i++) {
|
for ($i=0; $i < $rows; $i++) {
|
||||||
pg_fetch_result($result, $i, 0);
|
pg_fetch_result($result, $i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
|
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
|
||||||
pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
|
pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
|
||||||
pg_field_name($result, 0);
|
pg_field_name($result, 0);
|
||||||
pg_field_num($result, $field_name);
|
pg_field_num($result, $field_name);
|
||||||
pg_field_size($result, 0);
|
pg_field_size($result, 0);
|
||||||
pg_field_type($result, 0);
|
pg_field_type($result, 0);
|
||||||
pg_field_prtlen($result, 0);
|
pg_field_prtlen($result, 0);
|
||||||
pg_field_is_null($result, 0);
|
pg_field_is_null($result, 0);
|
||||||
|
|
||||||
$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
|
$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
|
||||||
|
|
||||||
if ($sent === FALSE) {
|
if ($sent === FALSE) {
|
||||||
echo "pg_send_query_params() error\n";
|
echo "pg_send_query_params() error\n";
|
||||||
} elseif ($sent === 0) {
|
} elseif ($sent === 0) {
|
||||||
nb_flush($db, $db_socket);
|
nb_flush($db, $db_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
pg_last_oid($result);
|
pg_last_oid($result);
|
||||||
pg_free_result($result);
|
pg_free_result($result);
|
||||||
|
|
||||||
pg_close($db);
|
pg_close($db);
|
||||||
|
|
||||||
echo "OK";
|
echo "OK";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
OK
|
OK
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
bug#53872 (internal corruption of phar)
|
bug#53872 (internal corruption of phar)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded("phar")) die("skip");
|
if (!extension_loaded("phar")) die("skip");
|
||||||
if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
|
if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
|
||||||
?>
|
?>
|
||||||
--INI--
|
--INI--
|
||||||
phar.readonly=0
|
phar.readonly=0
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$p=new Phar('bug53872-phar.phar');
|
$p=new Phar('bug53872-phar.phar');
|
||||||
$p->buildFromDirectory(__DIR__ . "/bug53872/");
|
$p->buildFromDirectory(__DIR__ . "/bug53872/");
|
||||||
$p->setStub('<?php __HALT_COMPILER();?\>');
|
$p->setStub('<?php __HALT_COMPILER();?\>');
|
||||||
$p->compressFiles(Phar::GZ);
|
$p->compressFiles(Phar::GZ);
|
||||||
|
|
||||||
print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
|
print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
|
||||||
print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
|
print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
|
||||||
print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
|
print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
|
||||||
?>
|
?>
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink("bug53872-phar.phar");
|
unlink("bug53872-phar.phar");
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
content of first.txt
|
content of first.txt
|
||||||
content of third.txt
|
content of third.txt
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
|
Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php if (!extension_loaded("phar")) die("skip");
|
<?php if (!extension_loaded("phar")) die("skip");
|
||||||
if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
|
if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
|
||||||
?>
|
?>
|
||||||
--INI--
|
--INI--
|
||||||
phar.readonly=0
|
phar.readonly=0
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
Phar::interceptFileFuncs();
|
Phar::interceptFileFuncs();
|
||||||
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
|
||||||
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
|
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
|
||||||
$pname = 'phar://' . $fname;
|
$pname = 'phar://' . $fname;
|
||||||
file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
|
file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
|
||||||
file_put_contents($pname . '/foo/hi', '<?php
|
file_put_contents($pname . '/foo/hi', '<?php
|
||||||
include "' . addslashes($fname2) . '";
|
include "' . addslashes($fname2) . '";
|
||||||
readfile("foo/hi");
|
readfile("foo/hi");
|
||||||
fopen("foo/hi", "r");
|
fopen("foo/hi", "r");
|
||||||
echo file_get_contents("foo/hi");
|
echo file_get_contents("foo/hi");
|
||||||
var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
|
var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
|
||||||
opendir("foo/hi");
|
opendir("foo/hi");
|
||||||
?>
|
?>
|
||||||
');
|
');
|
||||||
include $pname . '/foo/hi';
|
include $pname . '/foo/hi';
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
||||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
|
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
|
|
||||||
Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
|
|
||||||
Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
|
|
||||||
Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
|
|
||||||
Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,76 +1,76 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
ReflectionParameter class - canBePassedByValue() method.
|
ReflectionParameter class - canBePassedByValue() method.
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function aux($fun) {
|
function aux($fun) {
|
||||||
|
|
||||||
$func = new ReflectionFunction($fun);
|
$func = new ReflectionFunction($fun);
|
||||||
$parameters = $func->getParameters();
|
$parameters = $func->getParameters();
|
||||||
foreach($parameters as $parameter) {
|
foreach($parameters as $parameter) {
|
||||||
echo "Name: ", $parameter->getName(), "\n";
|
echo "Name: ", $parameter->getName(), "\n";
|
||||||
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
|
echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
|
||||||
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
|
echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "=> array_multisort:\n\n";
|
echo "=> array_multisort:\n\n";
|
||||||
|
|
||||||
aux('array_multisort');
|
aux('array_multisort');
|
||||||
|
|
||||||
|
|
||||||
echo "=> sort:\n\n";
|
echo "=> sort:\n\n";
|
||||||
|
|
||||||
aux('sort');
|
aux('sort');
|
||||||
|
|
||||||
echo "=> user function:\n\n";
|
echo "=> user function:\n\n";
|
||||||
|
|
||||||
function ufunc(&$arg1, $arg2) {}
|
function ufunc(&$arg1, $arg2) {}
|
||||||
|
|
||||||
aux('ufunc');
|
aux('ufunc');
|
||||||
|
|
||||||
echo "Done.\n";
|
echo "Done.\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
=> array_multisort:
|
=> array_multisort:
|
||||||
|
|
||||||
Name: arr1
|
Name: arr1
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
Name: sort_order
|
Name: sort_order
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
Name: sort_flags
|
Name: sort_flags
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
Name: arr2
|
Name: arr2
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
=> sort:
|
=> sort:
|
||||||
|
|
||||||
Name: arg
|
Name: arg
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: no
|
Can be passed by value: no
|
||||||
|
|
||||||
Name: sort_flags
|
Name: sort_flags
|
||||||
Is passed by reference: no
|
Is passed by reference: no
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
=> user function:
|
=> user function:
|
||||||
|
|
||||||
Name: arg1
|
Name: arg1
|
||||||
Is passed by reference: yes
|
Is passed by reference: yes
|
||||||
Can be passed by value: no
|
Can be passed by value: no
|
||||||
|
|
||||||
Name: arg2
|
Name: arg2
|
||||||
Is passed by reference: no
|
Is passed by reference: no
|
||||||
Can be passed by value: yes
|
Can be passed by value: yes
|
||||||
|
|
||||||
Done.
|
Done.
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
ReflectionParameter::isDefault()
|
ReflectionParameter::isDefault()
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
class A {
|
class A {
|
||||||
public $defprop;
|
public $defprop;
|
||||||
}
|
}
|
||||||
$a = new A;
|
$a = new A;
|
||||||
$a->myprop = null;
|
$a->myprop = null;
|
||||||
|
|
||||||
$ro = new ReflectionObject($a);
|
$ro = new ReflectionObject($a);
|
||||||
$props = $ro->getProperties();
|
$props = $ro->getProperties();
|
||||||
$prop1 = $props[0];
|
$prop1 = $props[0];
|
||||||
var_dump($prop1->isDefault());
|
var_dump($prop1->isDefault());
|
||||||
$prop2 = $props[1];
|
$prop2 = $props[1];
|
||||||
var_dump($prop2->isDefault());
|
var_dump($prop2->isDefault());
|
||||||
|
|
||||||
var_dump($ro->getProperty('defprop')->isDefault());
|
var_dump($ro->getProperty('defprop')->isDefault());
|
||||||
var_dump($ro->getProperty('myprop')->isDefault());
|
var_dump($ro->getProperty('myprop')->isDefault());
|
||||||
|
|
||||||
$prop1 = new ReflectionProperty($a, 'defprop');
|
$prop1 = new ReflectionProperty($a, 'defprop');
|
||||||
$prop2 = new ReflectionProperty($a, 'myprop');
|
$prop2 = new ReflectionProperty($a, 'myprop');
|
||||||
var_dump($prop1->isDefault());
|
var_dump($prop1->isDefault());
|
||||||
var_dump($prop2->isDefault());
|
var_dump($prop2->isDefault());
|
||||||
?>
|
?>
|
||||||
==DONE==
|
==DONE==
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(false)
|
bool(false)
|
||||||
==DONE==
|
==DONE==
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
IF _%1_==_AUTO_ (
|
IF _%1_==_AUTO_ (
|
||||||
GOTO MakeDirs
|
GOTO MakeDirs
|
||||||
)
|
)
|
||||||
|
|
||||||
IF _%2_==__ (
|
IF _%2_==__ (
|
||||||
ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]
|
ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Where ^<basedir^> is the session directory
|
ECHO Where ^<basedir^> is the session directory
|
||||||
ECHO ^<depth^> is the number of levels defined in session.save_path
|
ECHO ^<depth^> is the number of levels defined in session.save_path
|
||||||
ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character
|
ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character
|
||||||
EXIT /B 1
|
EXIT /B 1
|
||||||
)
|
)
|
||||||
|
|
||||||
SET /A Depth=%2 + 0 2>NUL
|
SET /A Depth=%2 + 0 2>NUL
|
||||||
IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError
|
IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError
|
||||||
IF _%Depth%_==__ GOTO DepthError
|
IF _%Depth%_==__ GOTO DepthError
|
||||||
IF /I %Depth% LEQ 0 GOTO DepthError
|
IF /I %Depth% LEQ 0 GOTO DepthError
|
||||||
|
|
||||||
IF _%3_==__ GOTO DefaultBits
|
IF _%3_==__ GOTO DefaultBits
|
||||||
|
|
||||||
SET /A Bits=%3 + 0 2>NUL
|
SET /A Bits=%3 + 0 2>NUL
|
||||||
IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError
|
IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError
|
||||||
IF _%Bits%_==__ GOTO BitsError
|
IF _%Bits%_==__ GOTO BitsError
|
||||||
IF /I %Bits% LSS 4 GOTO BitsError
|
IF /I %Bits% LSS 4 GOTO BitsError
|
||||||
IF /I %Bits% GTR 6 GOTO BitsError
|
IF /I %Bits% GTR 6 GOTO BitsError
|
||||||
GOTO BitsSet
|
GOTO BitsSet
|
||||||
|
|
||||||
:DefaultBits
|
:DefaultBits
|
||||||
SET Bits=4
|
SET Bits=4
|
||||||
:BitsSet
|
:BitsSet
|
||||||
|
|
||||||
SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F
|
SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||||
IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V
|
IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V
|
||||||
IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,
|
IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,
|
||||||
|
|
||||||
FOR %%A IN (%HashChars%) DO (
|
FOR %%A IN (%HashChars%) DO (
|
||||||
ECHO Making %%A
|
ECHO Making %%A
|
||||||
CALL "%~0" AUTO "%~1\%%~A" %Depth%
|
CALL "%~0" AUTO "%~1\%%~A" %Depth%
|
||||||
)
|
)
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
|
|
||||||
:MakeDirs
|
:MakeDirs
|
||||||
MKDIR "%~2"
|
MKDIR "%~2"
|
||||||
SET /A ThisDepth=%3 - 1
|
SET /A ThisDepth=%3 - 1
|
||||||
IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%
|
IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
|
|
||||||
:DepthError
|
:DepthError
|
||||||
ECHO ERROR: Invalid depth : %2
|
ECHO ERROR: Invalid depth : %2
|
||||||
EXIT /B 0
|
EXIT /B 0
|
||||||
|
|
||||||
:BitsError
|
:BitsError
|
||||||
ECHO ERROR: Invalid hash_bits : %3
|
ECHO ERROR: Invalid hash_bits : %3
|
||||||
EXIT /B 0
|
EXIT /B 0
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
|
Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php include('skipif.inc'); ?>
|
<?php include('skipif.inc'); ?>
|
||||||
--INI--
|
--INI--
|
||||||
session.use_trans_sid=1
|
session.use_trans_sid=1
|
||||||
session.use_cookies=0
|
session.use_cookies=0
|
||||||
session.use_only_cookies=0
|
session.use_only_cookies=0
|
||||||
session.name=sid
|
session.name=sid
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
# Do not remove \r from this tests, they are essential!
|
# Do not remove \r from this tests, they are essential!
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>See source html code</p>
|
<p>See source html code</p>
|
||||||
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
|
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
|
||||||
style="font: normal 11pt Times New Roman">incorrect link</a><br />
|
style="font: normal 11pt Times New Roman">incorrect link</a><br />
|
||||||
<br />
|
<br />
|
||||||
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
|
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>See source html code</p>
|
<p>See source html code</p>
|
||||||
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
|
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
|
||||||
style="font: normal 11pt Times New Roman">incorrect link</a><br />
|
style="font: normal 11pt Times New Roman">incorrect link</a><br />
|
||||||
<br />
|
<br />
|
||||||
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
|
<a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #51958: socket_accept() fails on IPv6 server sockets
|
Bug #51958: socket_accept() fails on IPv6 server sockets
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sockets')) {
|
if (!extension_loaded('sockets')) {
|
||||||
die('skip sockets extension not available.');
|
die('skip sockets extension not available.');
|
||||||
}
|
}
|
||||||
if (!defined('IPPROTO_IPV6')) {
|
if (!defined('IPPROTO_IPV6')) {
|
||||||
die('skip IPv6 not available.');
|
die('skip IPv6 not available.');
|
||||||
}
|
}
|
||||||
if (PHP_OS != "WINNT")
|
if (PHP_OS != "WINNT")
|
||||||
die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
|
die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
|
$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
|
||||||
socket_bind($listenfd, "::1", 13579);
|
socket_bind($listenfd, "::1", 13579);
|
||||||
socket_listen($listenfd);
|
socket_listen($listenfd);
|
||||||
socket_set_nonblock($listenfd);
|
socket_set_nonblock($listenfd);
|
||||||
$connfd = @socket_accept($listenfd);
|
$connfd = @socket_accept($listenfd);
|
||||||
echo socket_last_error();
|
echo socket_last_error();
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
10035
|
10035
|
||||||
|
|
|
@ -1,197 +1,197 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Multicast support: IPv4 receive options
|
Multicast support: IPv4 receive options
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sockets')) {
|
if (!extension_loaded('sockets')) {
|
||||||
die('skip sockets extension not available.');
|
die('skip sockets extension not available.');
|
||||||
}
|
}
|
||||||
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||||
$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
|
||||||
"group" => '224.0.0.23',
|
"group" => '224.0.0.23',
|
||||||
"interface" => 'lo',
|
"interface" => 'lo',
|
||||||
));
|
));
|
||||||
if ($so === false) {
|
if ($so === false) {
|
||||||
die('skip interface \'lo\' is unavailable.');
|
die('skip interface \'lo\' is unavailable.');
|
||||||
}
|
}
|
||||||
if (!defined("MCAST_BLOCK_SOURCE")) {
|
if (!defined("MCAST_BLOCK_SOURCE")) {
|
||||||
die('skip source operations are unavailable');
|
die('skip source operations are unavailable');
|
||||||
}
|
}
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include __DIR__."/mcast_helpers.php.inc";
|
include __DIR__."/mcast_helpers.php.inc";
|
||||||
$domain = AF_INET;
|
$domain = AF_INET;
|
||||||
$level = IPPROTO_IP;
|
$level = IPPROTO_IP;
|
||||||
$interface = "lo";
|
$interface = "lo";
|
||||||
$mcastaddr = '224.0.0.23';
|
$mcastaddr = '224.0.0.23';
|
||||||
$sblock = "127.0.0.1";
|
$sblock = "127.0.0.1";
|
||||||
|
|
||||||
echo "creating send socket bound to 127.0.0.1\n";
|
echo "creating send socket bound to 127.0.0.1\n";
|
||||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||||
$br = socket_bind($sends1, '127.0.0.1');
|
$br = socket_bind($sends1, '127.0.0.1');
|
||||||
var_dump($br);
|
var_dump($br);
|
||||||
|
|
||||||
echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
|
echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
|
||||||
$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||||
var_dump($br);
|
var_dump($br);
|
||||||
|
|
||||||
echo "creating receive socket\n";
|
echo "creating receive socket\n";
|
||||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
|
||||||
var_dump($s);
|
var_dump($s);
|
||||||
$br = socket_bind($s, '0.0.0.0', 3000);
|
$br = socket_bind($s, '0.0.0.0', 3000);
|
||||||
var_dump($br);
|
var_dump($br);
|
||||||
|
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
|
|
||||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
checktimeout($s, 500);
|
checktimeout($s, 500);
|
||||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||||
$i++;
|
$i++;
|
||||||
echo "$i> ", $str, "\n";
|
echo "$i> ", $str, "\n";
|
||||||
|
|
||||||
if ($i == 1) {
|
if ($i == 1) {
|
||||||
echo "leaving group\n";
|
echo "leaving group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 2) {
|
if ($i == 2) {
|
||||||
echo "re-joining group\n";
|
echo "re-joining group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 3) {
|
if ($i == 3) {
|
||||||
echo "blocking source\n";
|
echo "blocking source\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 4) {
|
if ($i == 4) {
|
||||||
echo "unblocking source\n";
|
echo "unblocking source\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 5) {
|
if ($i == 5) {
|
||||||
echo "leaving group\n";
|
echo "leaving group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 6) {
|
if ($i == 6) {
|
||||||
echo "joining source group\n";
|
echo "joining source group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 7) {
|
if ($i == 7) {
|
||||||
echo "leaving source group\n";
|
echo "leaving source group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 8) {
|
if ($i == 8) {
|
||||||
/* echo "rjsg\n";
|
/* echo "rjsg\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);*/
|
var_dump($so);*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
creating send socket bound to 127.0.0.1
|
creating send socket bound to 127.0.0.1
|
||||||
bool(true)
|
bool(true)
|
||||||
creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
|
creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
|
||||||
bool(true)
|
bool(true)
|
||||||
creating receive socket
|
creating receive socket
|
||||||
resource(%d) of type (Socket)
|
resource(%d) of type (Socket)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(14)
|
int(14)
|
||||||
1> initial packet
|
1> initial packet
|
||||||
leaving group
|
leaving group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
2> unicast packet
|
2> unicast packet
|
||||||
re-joining group
|
re-joining group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(42)
|
int(42)
|
||||||
int(12)
|
int(12)
|
||||||
3> mcast packet
|
3> mcast packet
|
||||||
blocking source
|
blocking source
|
||||||
bool(true)
|
bool(true)
|
||||||
int(31)
|
int(31)
|
||||||
int(14)
|
int(14)
|
||||||
4> unicast packet
|
4> unicast packet
|
||||||
unblocking source
|
unblocking source
|
||||||
bool(true)
|
bool(true)
|
||||||
int(27)
|
int(27)
|
||||||
5> mcast packet from 127.0.0.1
|
5> mcast packet from 127.0.0.1
|
||||||
leaving group
|
leaving group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
6> unicast packet
|
6> unicast packet
|
||||||
joining source group
|
joining source group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(27)
|
int(27)
|
||||||
7> mcast packet from 127.0.0.1
|
7> mcast packet from 127.0.0.1
|
||||||
leaving source group
|
leaving source group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
8> unicast packet
|
8> unicast packet
|
||||||
|
|
|
@ -1,226 +1,226 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Multicast support: IPv6 receive options
|
Multicast support: IPv6 receive options
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sockets')) {
|
if (!extension_loaded('sockets')) {
|
||||||
die('skip sockets extension not available.');
|
die('skip sockets extension not available.');
|
||||||
}
|
}
|
||||||
if (!defined('IPPROTO_IPV6')) {
|
if (!defined('IPPROTO_IPV6')) {
|
||||||
die('skip IPv6 not available.');
|
die('skip IPv6 not available.');
|
||||||
}
|
}
|
||||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||||
if ($s === false) {
|
if ($s === false) {
|
||||||
die("skip unable to create socket");
|
die("skip unable to create socket");
|
||||||
}
|
}
|
||||||
$br = socket_bind($s, '::', 3000);
|
$br = socket_bind($s, '::', 3000);
|
||||||
/* On Linux, there is no route ff00::/8 by default on lo, which makes it
|
/* On Linux, there is no route ff00::/8 by default on lo, which makes it
|
||||||
* troublesome to send multicast traffic from lo, which we must since
|
* troublesome to send multicast traffic from lo, which we must since
|
||||||
* we're dealing with interface-local traffic... */
|
* we're dealing with interface-local traffic... */
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
));
|
));
|
||||||
if ($so === false) {
|
if ($so === false) {
|
||||||
die('skip unable to join multicast group on any interface.');
|
die('skip unable to join multicast group on any interface.');
|
||||||
}
|
}
|
||||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
die('skip unable to send multicast packet.');
|
die('skip unable to send multicast packet.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined("MCAST_JOIN_SOURCE_GROUP"))
|
if (!defined("MCAST_JOIN_SOURCE_GROUP"))
|
||||||
die('skip source operations are unavailable');
|
die('skip source operations are unavailable');
|
||||||
|
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
));
|
));
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
"source" => '2001::dead:beef',
|
"source" => '2001::dead:beef',
|
||||||
));
|
));
|
||||||
if ($so === false) {
|
if ($so === false) {
|
||||||
die('skip protocol independent multicast API is unavailable.');
|
die('skip protocol independent multicast API is unavailable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include __DIR__."/mcast_helpers.php.inc";
|
include __DIR__."/mcast_helpers.php.inc";
|
||||||
$domain = AF_INET6;
|
$domain = AF_INET6;
|
||||||
$level = IPPROTO_IPV6;
|
$level = IPPROTO_IPV6;
|
||||||
$interface = 0;
|
$interface = 0;
|
||||||
$mcastaddr = 'ff01::114';
|
$mcastaddr = 'ff01::114';
|
||||||
$sblock = "?";
|
$sblock = "?";
|
||||||
|
|
||||||
echo "creating send socket\n";
|
echo "creating send socket\n";
|
||||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||||
var_dump($sends1);
|
var_dump($sends1);
|
||||||
|
|
||||||
echo "creating receive socket\n";
|
echo "creating receive socket\n";
|
||||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||||
var_dump($s);
|
var_dump($s);
|
||||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||||
var_dump($br);
|
var_dump($br);
|
||||||
|
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
)) or die("err");
|
)) or die("err");
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
|
|
||||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
checktimeout($s, 500);
|
checktimeout($s, 500);
|
||||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||||
var_dump($r, $str, $from);
|
var_dump($r, $str, $from);
|
||||||
$sblock = $from;
|
$sblock = $from;
|
||||||
|
|
||||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
checktimeout($s, 500);
|
checktimeout($s, 500);
|
||||||
while (($str = socket_read($s, 3000)) !== FALSE) {
|
while (($str = socket_read($s, 3000)) !== FALSE) {
|
||||||
$i++;
|
$i++;
|
||||||
echo "$i> ", $str, "\n";
|
echo "$i> ", $str, "\n";
|
||||||
|
|
||||||
if ($i == 1) {
|
if ($i == 1) {
|
||||||
echo "leaving group\n";
|
echo "leaving group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 2) {
|
if ($i == 2) {
|
||||||
echo "re-joining group\n";
|
echo "re-joining group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 3) {
|
if ($i == 3) {
|
||||||
echo "blocking source\n";
|
echo "blocking source\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
$so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 4) {
|
if ($i == 4) {
|
||||||
echo "unblocking source\n";
|
echo "unblocking source\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
$so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 5) {
|
if ($i == 5) {
|
||||||
echo "leaving group\n";
|
echo "leaving group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 6) {
|
if ($i == 6) {
|
||||||
echo "joining source group\n";
|
echo "joining source group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 7) {
|
if ($i == 7) {
|
||||||
echo "leaving source group\n";
|
echo "leaving source group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 8) {
|
if ($i == 8) {
|
||||||
/*echo "joining source group\n";
|
/*echo "joining source group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
"source" => $sblock,
|
"source" => $sblock,
|
||||||
));
|
));
|
||||||
var_dump($so);*/
|
var_dump($so);*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
creating send socket
|
creating send socket
|
||||||
resource(%d) of type (Socket)
|
resource(%d) of type (Socket)
|
||||||
creating receive socket
|
creating receive socket
|
||||||
resource(%d) of type (Socket)
|
resource(%d) of type (Socket)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(14)
|
int(14)
|
||||||
int(14)
|
int(14)
|
||||||
string(14) "testing packet"
|
string(14) "testing packet"
|
||||||
string(%d) "%s"
|
string(%d) "%s"
|
||||||
int(14)
|
int(14)
|
||||||
1> initial packet
|
1> initial packet
|
||||||
leaving group
|
leaving group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
2> unicast packet
|
2> unicast packet
|
||||||
re-joining group
|
re-joining group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(12)
|
int(12)
|
||||||
3> mcast packet
|
3> mcast packet
|
||||||
blocking source
|
blocking source
|
||||||
bool(true)
|
bool(true)
|
||||||
int(31)
|
int(31)
|
||||||
int(14)
|
int(14)
|
||||||
4> unicast packet
|
4> unicast packet
|
||||||
unblocking source
|
unblocking source
|
||||||
bool(true)
|
bool(true)
|
||||||
int(12)
|
int(12)
|
||||||
5> mcast packet
|
5> mcast packet
|
||||||
leaving group
|
leaving group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
6> unicast packet
|
6> unicast packet
|
||||||
joining source group
|
joining source group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(32)
|
int(32)
|
||||||
7> mcast packet from desired source
|
7> mcast packet from desired source
|
||||||
leaving source group
|
leaving source group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
8> unicast packet
|
8> unicast packet
|
||||||
|
|
|
@ -1,131 +1,131 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Multicast support: IPv6 receive options (limited)
|
Multicast support: IPv6 receive options (limited)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sockets')) {
|
if (!extension_loaded('sockets')) {
|
||||||
die('skip sockets extension not available.');
|
die('skip sockets extension not available.');
|
||||||
}
|
}
|
||||||
if (!defined('IPPROTO_IPV6')) {
|
if (!defined('IPPROTO_IPV6')) {
|
||||||
die('skip IPv6 not available.');
|
die('skip IPv6 not available.');
|
||||||
}
|
}
|
||||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
|
||||||
$br = socket_bind($s, '::', 3000);
|
$br = socket_bind($s, '::', 3000);
|
||||||
/* On Linux, there is no route ff00::/8 by default on lo, which makes it
|
/* On Linux, there is no route ff00::/8 by default on lo, which makes it
|
||||||
* troublesome to send multicast traffic from lo, which we must since
|
* troublesome to send multicast traffic from lo, which we must since
|
||||||
* we're dealing with interface-local traffic... */
|
* we're dealing with interface-local traffic... */
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
));
|
));
|
||||||
if ($so === false) {
|
if ($so === false) {
|
||||||
die('skip unable to join multicast group on any interface.');
|
die('skip unable to join multicast group on any interface.');
|
||||||
}
|
}
|
||||||
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
die('skip unable to send multicast packet.');
|
die('skip unable to send multicast packet.');
|
||||||
}
|
}
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
));
|
));
|
||||||
if (defined("MCAST_JOIN_SOURCE_GROUP")) {
|
if (defined("MCAST_JOIN_SOURCE_GROUP")) {
|
||||||
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
|
||||||
"group" => 'ff01::114',
|
"group" => 'ff01::114',
|
||||||
"interface" => 0,
|
"interface" => 0,
|
||||||
"source" => '2001::dead:beef',
|
"source" => '2001::dead:beef',
|
||||||
));
|
));
|
||||||
if ($so !== false) {
|
if ($so !== false) {
|
||||||
die('skip protocol independent multicast API is available.');
|
die('skip protocol independent multicast API is available.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include __DIR__."/mcast_helpers.php.inc";
|
include __DIR__."/mcast_helpers.php.inc";
|
||||||
$domain = AF_INET6;
|
$domain = AF_INET6;
|
||||||
$level = IPPROTO_IPV6;
|
$level = IPPROTO_IPV6;
|
||||||
$interface = 0;
|
$interface = 0;
|
||||||
$mcastaddr = 'ff01::114';
|
$mcastaddr = 'ff01::114';
|
||||||
$sblock = "?";
|
$sblock = "?";
|
||||||
|
|
||||||
echo "creating send socket\n";
|
echo "creating send socket\n";
|
||||||
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||||
var_dump($sends1);
|
var_dump($sends1);
|
||||||
|
|
||||||
echo "creating receive socket\n";
|
echo "creating receive socket\n";
|
||||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||||
var_dump($s);
|
var_dump($s);
|
||||||
$br = socket_bind($s, '::0', 3000) or die("err");
|
$br = socket_bind($s, '::0', 3000) or die("err");
|
||||||
var_dump($br);
|
var_dump($br);
|
||||||
|
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
)) or die("err");
|
)) or die("err");
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
|
|
||||||
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
checktimeout($s, 500);
|
checktimeout($s, 500);
|
||||||
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
|
||||||
var_dump($r, $str, $from);
|
var_dump($r, $str, $from);
|
||||||
$sblock = $from;
|
$sblock = $from;
|
||||||
|
|
||||||
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
checktimeout($s, 500);
|
checktimeout($s, 500);
|
||||||
while (($str = socket_read($s, 3000, 500)) !== FALSE) {
|
while (($str = socket_read($s, 3000, 500)) !== FALSE) {
|
||||||
$i++;
|
$i++;
|
||||||
echo "$i> ", $str, "\n";
|
echo "$i> ", $str, "\n";
|
||||||
|
|
||||||
if ($i == 1) {
|
if ($i == 1) {
|
||||||
echo "leaving group\n";
|
echo "leaving group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
$r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 2) {
|
if ($i == 2) {
|
||||||
echo "re-joining group\n";
|
echo "re-joining group\n";
|
||||||
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
|
||||||
"group" => $mcastaddr,
|
"group" => $mcastaddr,
|
||||||
"interface" => $interface,
|
"interface" => $interface,
|
||||||
));
|
));
|
||||||
var_dump($so);
|
var_dump($so);
|
||||||
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
$r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
}
|
}
|
||||||
if ($i == 3) {
|
if ($i == 3) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
creating send socket
|
creating send socket
|
||||||
resource(%d) of type (Socket)
|
resource(%d) of type (Socket)
|
||||||
creating receive socket
|
creating receive socket
|
||||||
resource(%d) of type (Socket)
|
resource(%d) of type (Socket)
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(14)
|
int(14)
|
||||||
int(14)
|
int(14)
|
||||||
string(14) "testing packet"
|
string(14) "testing packet"
|
||||||
string(%d) "%s"
|
string(%d) "%s"
|
||||||
int(14)
|
int(14)
|
||||||
1> initial packet
|
1> initial packet
|
||||||
leaving group
|
leaving group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(20)
|
int(20)
|
||||||
int(14)
|
int(14)
|
||||||
2> unicast packet
|
2> unicast packet
|
||||||
re-joining group
|
re-joining group
|
||||||
bool(true)
|
bool(true)
|
||||||
int(12)
|
int(12)
|
||||||
3> mcast packet
|
3> mcast packet
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Multicast support: IPv6 send options
|
Multicast support: IPv6 send options
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sockets')) {
|
if (!extension_loaded('sockets')) {
|
||||||
die('skip sockets extension not available.');
|
die('skip sockets extension not available.');
|
||||||
}
|
}
|
||||||
if (!defined('IPPROTO_IPV6')) {
|
if (!defined('IPPROTO_IPV6')) {
|
||||||
die('skip IPv6 not available.');
|
die('skip IPv6 not available.');
|
||||||
}
|
}
|
||||||
$level = IPPROTO_IPV6;
|
$level = IPPROTO_IPV6;
|
||||||
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
|
$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
|
||||||
if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
|
if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
|
||||||
die("skip interface 1 either doesn't exist or has no ipv6 address");
|
die("skip interface 1 either doesn't exist or has no ipv6 address");
|
||||||
}
|
}
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$domain = AF_INET6;
|
$domain = AF_INET6;
|
||||||
$level = IPPROTO_IPV6;
|
$level = IPPROTO_IPV6;
|
||||||
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
|
||||||
|
|
||||||
echo "Setting IPV6_MULTICAST_TTL\n";
|
echo "Setting IPV6_MULTICAST_TTL\n";
|
||||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
|
$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
|
$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
echo "Setting IPV6_MULTICAST_LOOP\n";
|
echo "Setting IPV6_MULTICAST_LOOP\n";
|
||||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
|
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
|
$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
echo "Setting IPV6_MULTICAST_IF\n";
|
echo "Setting IPV6_MULTICAST_IF\n";
|
||||||
echo "interface 0:\n";
|
echo "interface 0:\n";
|
||||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
|
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
echo "interface 1:\n";
|
echo "interface 1:\n";
|
||||||
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
|
$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
|
||||||
var_dump($r);
|
var_dump($r);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Setting IPV6_MULTICAST_TTL
|
Setting IPV6_MULTICAST_TTL
|
||||||
bool(true)
|
bool(true)
|
||||||
int(9)
|
int(9)
|
||||||
|
|
||||||
Setting IPV6_MULTICAST_LOOP
|
Setting IPV6_MULTICAST_LOOP
|
||||||
bool(true)
|
bool(true)
|
||||||
int(0)
|
int(0)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(1)
|
int(1)
|
||||||
|
|
||||||
Setting IPV6_MULTICAST_IF
|
Setting IPV6_MULTICAST_IF
|
||||||
interface 0:
|
interface 0:
|
||||||
bool(true)
|
bool(true)
|
||||||
int(0)
|
int(0)
|
||||||
interface 1:
|
interface 1:
|
||||||
bool(true)
|
bool(true)
|
||||||
int(1)
|
int(1)
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl Directory Iterator test getInode
|
SPL: Spl Directory Iterator test getInode
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
mkdir('test_dir_ptfi');
|
mkdir('test_dir_ptfi');
|
||||||
|
@ -24,6 +24,6 @@ var_dump(decoct($dirIterator->getInode()));
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
rmdir('test_dir_ptfi');
|
rmdir('test_dir_ptfi');
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
string(%d) "%d"
|
string(%d) "%d"
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getInode
|
SPL: Spl File Info test getInode
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
$fileInfo = new SplFileInfo('not_existing');
|
$fileInfo = new SplFileInfo('not_existing');
|
||||||
var_dump($fileInfo->getInode());
|
var_dump($fileInfo->getInode());
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s
|
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getGroup
|
SPL: Spl File Info test getGroup
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
$fileInfo = new SplFileInfo('not_existing');
|
$fileInfo = new SplFileInfo('not_existing');
|
||||||
var_dump($fileInfo->getGroup());
|
var_dump($fileInfo->getGroup());
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s
|
Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getInode
|
SPL: Spl File Info test getInode
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
touch ('SplFileInfo_getInode_basic.txt');
|
touch ('SplFileInfo_getInode_basic.txt');
|
||||||
|
@ -25,6 +25,6 @@ var_dump($fileInfo->getInode() == $result);
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink('SplFileInfo_getInode_basic.txt');
|
unlink('SplFileInfo_getInode_basic.txt');
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getPerms
|
SPL: Spl File Info test getPerms
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
$fileInfo = new SplFileInfo('not_existing');
|
$fileInfo = new SplFileInfo('not_existing');
|
||||||
var_dump($fileInfo->getInode());
|
var_dump($fileInfo->getInode());
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s
|
Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getOwner
|
SPL: Spl File Info test getOwner
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
$fileInfo = new SplFileInfo('not_existing');
|
$fileInfo = new SplFileInfo('not_existing');
|
||||||
var_dump($fileInfo->getOwner());
|
var_dump($fileInfo->getOwner());
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s
|
Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getPerms
|
SPL: Spl File Info test getPerms
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
touch ('SplFileInfo_getPerms_basic.txt');
|
touch ('SplFileInfo_getPerms_basic.txt');
|
||||||
|
@ -25,6 +25,6 @@ var_dump($fileInfo->getPerms() == 0100557);
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
unlink('SplFileInfo_getPerms_basic.txt');
|
unlink('SplFileInfo_getPerms_basic.txt');
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: Spl File Info test getPerms
|
SPL: Spl File Info test getPerms
|
||||||
--CREDITS--
|
--CREDITS--
|
||||||
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
Cesare D'Amico <cesare.damico@gruppovolta.it>
|
||||||
Andrea Giorgini <agiorg@gmail.com>
|
Andrea Giorgini <agiorg@gmail.com>
|
||||||
Filippo De Santis <fd@ideato.it>
|
Filippo De Santis <fd@ideato.it>
|
||||||
Daniel Londero <daniel.londero@gmail.com>
|
Daniel Londero <daniel.londero@gmail.com>
|
||||||
Francesco Trucchia <ft@ideato.it>
|
Francesco Trucchia <ft@ideato.it>
|
||||||
Jacopo Romei <jacopo@sviluppoagile.it>
|
Jacopo Romei <jacopo@sviluppoagile.it>
|
||||||
#Test Fest Cesena (Italy) on 2009-06-20
|
#Test Fest Cesena (Italy) on 2009-06-20
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//file
|
//file
|
||||||
$fileInfo = new SplFileInfo('not_existing');
|
$fileInfo = new SplFileInfo('not_existing');
|
||||||
var_dump($fileInfo->getPerms() == 0100557);
|
var_dump($fileInfo->getPerms() == 0100557);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s
|
Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
|
Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$q = new SplQueue();
|
$q = new SplQueue();
|
||||||
try {
|
try {
|
||||||
$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
|
$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo 'unexpected exception: ' . $e->getMessage() . "\n";
|
echo 'unexpected exception: ' . $e->getMessage() . "\n";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
|
$q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo 'expected exception: ' . $e->getMessage() . "\n";
|
echo 'expected exception: ' . $e->getMessage() . "\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
|
expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #74478: null coalescing operator failing with SplFixedArray
|
Bug #74478: null coalescing operator failing with SplFixedArray
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class MyFixedArray extends \SplFixedArray
|
class MyFixedArray extends \SplFixedArray
|
||||||
{
|
{
|
||||||
public function offsetExists($name) {
|
public function offsetExists($name) {
|
||||||
echo "offsetExists($name)\n";
|
echo "offsetExists($name)\n";
|
||||||
return parent::offsetExists($name);
|
return parent::offsetExists($name);
|
||||||
}
|
}
|
||||||
public function offsetGet($name) {
|
public function offsetGet($name) {
|
||||||
echo "offsetGet($name)\n";
|
echo "offsetGet($name)\n";
|
||||||
return parent::offsetGet($name);
|
return parent::offsetGet($name);
|
||||||
}
|
}
|
||||||
public function offsetSet($name, $value) {
|
public function offsetSet($name, $value) {
|
||||||
echo "offsetSet($name)\n";
|
echo "offsetSet($name)\n";
|
||||||
return parent::offsetSet($name, $value);
|
return parent::offsetSet($name, $value);
|
||||||
}
|
}
|
||||||
public function offsetUnset($name) {
|
public function offsetUnset($name) {
|
||||||
echo "offsetUnset($name)\n";
|
echo "offsetUnset($name)\n";
|
||||||
return parent::offsetUnset($name);
|
return parent::offsetUnset($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$fixedData = new MyFixedArray(10);
|
$fixedData = new MyFixedArray(10);
|
||||||
var_dump(isset($fixedData[0][1][2]));
|
var_dump(isset($fixedData[0][1][2]));
|
||||||
var_dump(isset($fixedData[0]->foo));
|
var_dump(isset($fixedData[0]->foo));
|
||||||
var_dump($fixedData[0] ?? 42);
|
var_dump($fixedData[0] ?? 42);
|
||||||
var_dump($fixedData[0][1][2] ?? 42);
|
var_dump($fixedData[0][1][2] ?? 42);
|
||||||
|
|
||||||
$fixedData[0] = new MyFixedArray(10);
|
$fixedData[0] = new MyFixedArray(10);
|
||||||
$fixedData[0][1] = new MyFixedArray(10);
|
$fixedData[0][1] = new MyFixedArray(10);
|
||||||
var_dump(isset($fixedData[0][1][2]));
|
var_dump(isset($fixedData[0][1][2]));
|
||||||
var_dump($fixedData[0][1][2] ?? 42);
|
var_dump($fixedData[0][1][2] ?? 42);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
bool(false)
|
bool(false)
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
bool(false)
|
bool(false)
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
int(42)
|
int(42)
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
int(42)
|
int(42)
|
||||||
offsetSet(0)
|
offsetSet(0)
|
||||||
offsetGet(0)
|
offsetGet(0)
|
||||||
offsetSet(1)
|
offsetSet(1)
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
offsetGet(0)
|
offsetGet(0)
|
||||||
offsetExists(1)
|
offsetExists(1)
|
||||||
offsetGet(1)
|
offsetGet(1)
|
||||||
offsetExists(2)
|
offsetExists(2)
|
||||||
bool(false)
|
bool(false)
|
||||||
offsetExists(0)
|
offsetExists(0)
|
||||||
offsetGet(0)
|
offsetGet(0)
|
||||||
offsetExists(1)
|
offsetExists(1)
|
||||||
offsetGet(1)
|
offsetGet(1)
|
||||||
offsetExists(2)
|
offsetExists(2)
|
||||||
int(42)
|
int(42)
|
|
@ -1,17 +1,17 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
|
SPL: RecursiveIteratorIterator cannot be used with foreach by reference
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(array(1,2));
|
$arr = array(array(1,2));
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||||
|
|
||||||
foreach ($recItIt as &$val) echo "$val\n";
|
foreach ($recItIt as &$val) echo "$val\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
|
Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
|
SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$array = array();
|
$array = array();
|
||||||
$recArrIt = new RecursiveArrayIterator($array);
|
$recArrIt = new RecursiveArrayIterator($array);
|
||||||
|
|
||||||
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
$recItIt = new RecursiveIteratorIterator($recArrIt);
|
||||||
|
|
||||||
var_dump($recItIt->beginIteration());
|
var_dump($recItIt->beginIteration());
|
||||||
var_dump($recItIt->endIteration());
|
var_dump($recItIt->endIteration());
|
||||||
var_dump($recItIt->nextElement());
|
var_dump($recItIt->nextElement());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
NULL
|
NULL
|
||||||
NULL
|
NULL
|
||||||
NULL
|
NULL
|
|
@ -1,32 +1,32 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
|
SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(array(1,2),2);
|
$arr = array(array(1,2),2);
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||||
|
|
||||||
function nextelement() {
|
function nextelement() {
|
||||||
echo __METHOD__."\n";
|
echo __METHOD__."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
|
|
||||||
foreach ($recItIt as $key => $val) echo "$key\n";
|
foreach ($recItIt as $key => $val) echo "$key\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
MyRecursiveIteratorIterator::nextelement
|
MyRecursiveIteratorIterator::nextelement
|
||||||
0
|
0
|
||||||
MyRecursiveIteratorIterator::nextelement
|
MyRecursiveIteratorIterator::nextelement
|
||||||
1
|
1
|
||||||
MyRecursiveIteratorIterator::nextelement
|
MyRecursiveIteratorIterator::nextelement
|
||||||
0
|
0
|
||||||
MyRecursiveIteratorIterator::nextelement
|
MyRecursiveIteratorIterator::nextelement
|
||||||
1
|
1
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
|
SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(array(1,2),2);
|
$arr = array(array(1,2),2);
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||||
|
|
||||||
function beginchildren() {
|
function beginchildren() {
|
||||||
throw new Exception;
|
throw new Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||||
|
|
||||||
var_dump($recItIt->next());
|
var_dump($recItIt->next());
|
||||||
|
|
||||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||||
|
|
||||||
var_dump($recItIt2->next());
|
var_dump($recItIt2->next());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
Fatal error: Uncaught Exception in %s
|
Fatal error: Uncaught Exception in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
|
#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
|
||||||
#1 %s: RecursiveIteratorIterator->next()
|
#1 %s: RecursiveIteratorIterator->next()
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s on line %d
|
thrown in %s on line %d
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
|
SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(1,2);
|
$arr = array(1,2);
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||||
|
|
||||||
function callHasChildren() {
|
function callHasChildren() {
|
||||||
throw new Exception;
|
throw new Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||||
|
|
||||||
var_dump($recItIt->next());
|
var_dump($recItIt->next());
|
||||||
|
|
||||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||||
|
|
||||||
var_dump($recItIt2->next());
|
var_dump($recItIt2->next());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
Fatal error: Uncaught Exception in %s
|
Fatal error: Uncaught Exception in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
|
#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
|
||||||
#1 %s: RecursiveIteratorIterator->next()
|
#1 %s: RecursiveIteratorIterator->next()
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s on line %d
|
thrown in %s on line %d
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
|
SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(array(1,2));
|
$arr = array(array(1,2));
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||||
|
|
||||||
function endchildren() {
|
function endchildren() {
|
||||||
throw new Exception;
|
throw new Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||||
|
|
||||||
foreach ($recItIt as $val) echo "$val\n";
|
foreach ($recItIt as $val) echo "$val\n";
|
||||||
|
|
||||||
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||||
|
|
||||||
echo "===NEXT LOOP===\n";
|
echo "===NEXT LOOP===\n";
|
||||||
|
|
||||||
foreach ($recItIt2 as $val) echo "$val\n";
|
foreach ($recItIt2 as $val) echo "$val\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
===NEXT LOOP===
|
===NEXT LOOP===
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
|
|
||||||
Fatal error: Uncaught Exception in %s
|
Fatal error: Uncaught Exception in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
|
#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
|
||||||
#1 %s: RecursiveIteratorIterator->next()
|
#1 %s: RecursiveIteratorIterator->next()
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s on line %d
|
thrown in %s on line %d
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
|
SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arr = array(1,2);
|
$arr = array(1,2);
|
||||||
$arrOb = new ArrayObject($arr);
|
$arrOb = new ArrayObject($arr);
|
||||||
|
|
||||||
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
|
||||||
|
|
||||||
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
|
||||||
|
|
||||||
function nextelement() {
|
function nextelement() {
|
||||||
throw new Exception;
|
throw new Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
||||||
|
|
||||||
var_dump($recItIt->next());
|
var_dump($recItIt->next());
|
||||||
|
|
||||||
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
|
||||||
|
|
||||||
var_dump($recItIt->next());
|
var_dump($recItIt->next());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
Fatal error: Uncaught Exception in %s
|
Fatal error: Uncaught Exception in %s
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
|
#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
|
||||||
#1 %s: RecursiveIteratorIterator->next()
|
#1 %s: RecursiveIteratorIterator->next()
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s on line %d
|
thrown in %s on line %d
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #73333 (2147483647 is fetched as string)
|
Bug #73333 (2147483647 is fetched as string)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
|
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
|
||||||
?>
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
|
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
|
||||||
|
|
||||||
$db = new SQLite3(':memory:');
|
$db = new SQLite3(':memory:');
|
||||||
$db->exec('CREATE TABLE foo (bar INT)');
|
$db->exec('CREATE TABLE foo (bar INT)');
|
||||||
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
|
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
|
||||||
$db->exec("INSERT INTO foo VALUES ($value)");
|
$db->exec("INSERT INTO foo VALUES ($value)");
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $db->query('SELECT bar FROM foo');
|
$res = $db->query('SELECT bar FROM foo');
|
||||||
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
|
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
|
||||||
echo gettype($row[0]), PHP_EOL;
|
echo gettype($row[0]), PHP_EOL;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
integer
|
integer
|
||||||
integer
|
integer
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #43353 wrong detection of 'data' wrapper
|
Bug #43353 wrong detection of 'data' wrapper
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if(substr(PHP_OS, 0, 3) != "WIN")
|
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||||
die("skip Run only on Windows");
|
die("skip Run only on Windows");
|
||||||
?>
|
?>
|
||||||
--INI--
|
--INI--
|
||||||
allow_url_fopen=1
|
allow_url_fopen=1
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
var_dump(is_dir('file:///datafoo:test'));
|
var_dump(is_dir('file:///datafoo:test'));
|
||||||
var_dump(is_dir('datafoo:test'));
|
var_dump(is_dir('datafoo:test'));
|
||||||
var_dump(file_get_contents('data:text/plain,foo'));
|
var_dump(file_get_contents('data:text/plain,foo'));
|
||||||
var_dump(file_get_contents('datafoo:text/plain,foo'));
|
var_dump(file_get_contents('datafoo:text/plain,foo'));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(false)
|
bool(false)
|
||||||
bool(false)
|
bool(false)
|
||||||
string(3) "foo"
|
string(3) "foo"
|
||||||
|
|
||||||
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
|
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Test fopen() function : variation: interesting paths, no use include path
|
Test fopen() function : variation: interesting paths, no use include path
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
// fopen with interesting windows paths.
|
// fopen with interesting windows paths.
|
||||||
$testdir = __DIR__ . '/bug47177.tmpdir';
|
$testdir = __DIR__ . '/bug47177.tmpdir';
|
||||||
mkdir($testdir);
|
mkdir($testdir);
|
||||||
$t = time() - 3600;
|
$t = time() - 3600;
|
||||||
touch($testdir, $t);
|
touch($testdir, $t);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$t2 = filemtime($testdir);
|
$t2 = filemtime($testdir);
|
||||||
if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
|
if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
|
||||||
rmdir($testdir);
|
rmdir($testdir);
|
||||||
echo "Ok.";
|
echo "Ok.";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Ok.
|
Ok.
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
|
Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
/* unfortunately no standard function does a cast to FILE*, so we need
|
/* unfortunately no standard function does a cast to FILE*, so we need
|
||||||
* curl to test this */
|
* curl to test this */
|
||||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
$fn = __DIR__ . "/test.tmp";
|
$fn = __DIR__ . "/test.tmp";
|
||||||
@unlink($fn);
|
@unlink($fn);
|
||||||
$fh = fopen($fn, 'xb');
|
$fh = fopen($fn, 'xb');
|
||||||
$ch = curl_init('http://www.yahoo.com/');
|
$ch = curl_init('http://www.yahoo.com/');
|
||||||
var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
|
var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
|
||||||
echo "Done.\n";
|
echo "Done.\n";
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
$fn = __DIR__ . "/test.tmp";
|
$fn = __DIR__ . "/test.tmp";
|
||||||
@unlink($fn);
|
@unlink($fn);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
bool(true)
|
bool(true)
|
||||||
Done.
|
Done.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue