WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
Uname:Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64

Base Dir : /var/www/eduesan

User : www-data


403WebShell
403Webshell
Server IP : 202.131.237.196  /  Your IP : 216.73.216.192
Web Server : nginx/1.14.0
System : Linux wp 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.2.24-0ubuntu0.18.04.17
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/php/72/src/Zend/tests/closures/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/php/72/src/Zend/tests/closures/closure_from_callable_error.phpt
--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===

Youez - 2016 - github.com/yon3zu
LinuXploit