Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.119
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
php-7.4.33 /
Zend /
tests /
closures /
Delete
Unzip
Name
Size
Permission
Date
Action
bug80929.phpt
1.1
KB
-rw-rw-r--
2022-10-31 11:36
closure_from_callable.inc
3.09
KB
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_basic.phpt
3.99
KB
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_error.phpt
6.36
KB
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_lsb.phpt
326
B
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_non_static_statically.phpt
403
B
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_rebinding.phpt
330
B
-rw-rw-r--
2022-10-31 11:36
closure_from_callable_reflection.phpt
743
B
-rw-rw-r--
2022-10-31 11:36
closure_instantiate.phpt
590
B
-rw-rw-r--
2022-10-31 11:36
Save
Rename
--TEST-- Testing Closure::fromCallable() functionality: Errors --FILE-- <?php include('closure_from_callable.inc'); echo 'Cannot access privateInstance method statically'."\n"; try { $fn = Closure::fromCallable(['Foo', 'privateInstanceFunc']); echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access privateInstance method statically with colon scheme'."\n"; try { $fn = Closure::fromCallable('Foo::privateInstanceFunc'); echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access privateInstance method'."\n"; try { $fn = Closure::fromCallable([new Foo, 'privateInstanceFunc']); echo "Test failed to fail and return was : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'SubClass cannot access private instance method'."\n"; try { $fn = Closure::fromCallable([new SubFoo, 'privateInstanceFunc']); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static function of instance'."\n"; try { $fn = Closure::fromCallable([new Foo, 'privateStaticFunction']); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static method statically'."\n"; try { $fn = Closure::fromCallable(['Foo', 'privateStaticFunction']); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Cannot access private static method statically with colon scheme'."\n"; try { $fn = Closure::fromCallable('Foo::privateStaticFunction'); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent method should fail'."\n"; try { $fn = Closure::fromCallable('Foo::nonExistentFunction'); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent class should fail'."\n"; try { $fn = Closure::fromCallable(['NonExistentClass', 'foo']); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Non-existent function should fail'."\n"; try { $fn = Closure::fromCallable('thisDoesNotExist'); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Subclass cannot closure over parent private instance method'."\n"; try { $subFoo = new SubFoo; $fn = $subFoo->closePrivateInvalid(); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Subclass cannot closure over parant private static method'."\n"; try { $subFoo = new SubFoo; $fn = $subFoo->closePrivateStaticInvalid(); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Function scope cannot closure over protected instance method'."\n"; try { $fn = functionAccessProtected(); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Function scope cannot closure over private instance method'."\n"; try { $fn = functionAccessPrivate(); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo 'Access private instance method of parent object through "self::" to parent method'."\n"; try { $foo = new SubFoo; $fn = $foo->getSelfColonParentPrivateInstanceMethod(); echo "Test failed to fail, closure is : ".var_export($fn, true)."\n"; } catch (\TypeError $te) { //This is the expected outcome. } catch (\Throwable $t) { echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n"; } echo "OK\n"; ?> ===DONE=== --EXPECT-- Cannot access privateInstance method statically Cannot access privateInstance method statically with colon scheme Cannot access privateInstance method SubClass cannot access private instance method Cannot access private static function of instance Cannot access private static method statically Cannot access private static method statically with colon scheme Non-existent method should fail Non-existent class should fail Non-existent function should fail Subclass cannot closure over parent private instance method Subclass cannot closure over parant private static method Function scope cannot closure over protected instance method Function scope cannot closure over private instance method Access private instance method of parent object through "self::" to parent method OK ===DONE===