I do not recommend to use this code as it has known vulnerabilities. You may want to have a look at some more recent sandboxing project like https://github.com/fieryprophet/php-sandbox (though I can't say anything about its quality). In general though the only really safe way to sandbox PHP is to run it in a jail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RouteCompilationException extends LogicException | |
{ | |
public function setContext($line, $route) { | |
$this->message = 'Line ' . $line . ': ' . $this->getMessage() . ' (route: "' . $route . '")'; | |
} | |
} | |
class RouterCompiler | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<pre>'; | |
$w = 1000; | |
$h = 1000; | |
// generate multidimensional array | |
$multi = array(); | |
for ($i = 0; $i < $w; ++$i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('SAFE_MODE', 42); | |
echo '<pre>'; | |
function throw_exception($error) { | |
die('--- EXCEPTION: ' . $error); | |
} | |
if (!isset($_GET['source'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bar($a, $b, $c) { | |
foreach (compact('a', 'b', 'c') as $key => $value) { | |
$form[$key] = array( | |
'#type' => 'hidden', | |
'#value' => $value, | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PHPTokenizer_Tokenizer_PHP53To536 extends PHPTokenizer_Tokenizer_Base | |
{ | |
public function tokenize($code) { | |
@$resetErrorMsg; | |
$tokens = @token_get_all($code); | |
$error = error_get_last(); | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ext/standard/tests/strings/md5_file.phpt | |
=================================================================== | |
--- ext/standard/tests/strings/md5_file.phpt (revision 316568) | |
+++ ext/standard/tests/strings/md5_file.phpt (working copy) | |
@@ -56,7 +56,7 @@ | |
/* Raw Binary Output for Empty file as input */ | |
echo "\n*** Raw Binary Output for Empty file as Argument ***\n"; | |
-var_dump( md5_file("EmptyFile.txt", true) ); | |
+var_dump( bin2hex(md5_file("EmptyFile.txt", true)) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/tokenizer/tests/token_get_all_error.phpt b/ext/tokenizer/tests/token_get_all_error.phpt | |
index 29e97c3..5b455e9 100644 | |
--- a/ext/tokenizer/tests/token_get_all_error.phpt | |
+++ b/ext/tokenizer/tests/token_get_all_error.phpt | |
@@ -19,7 +19,7 @@ var_dump( token_get_all()); | |
echo "-- Testing token_get_all() function with more than expected no. of arguments --\n"; | |
$source = '<?php ?>'; | |
$extra_arg = 10; | |
-var_dump( token_get_all($source, $extra_arg)); | |
+var_dump( token_get_all($source, false, $extra_arg)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Wed Dec 21 17:06:58 2011] Script: 'test2.php' | |
/home/nikic/dev/php-src-git/Zend/zend_API.c(311) : Freeing 0xB78B836C (20 bytes), script=test2.php | |
Last leak repeated 1 time | |
[Wed Dec 21 17:06:58 2011] Script: 'test2.php' | |
/home/nikic/dev/php-src-git/Zend/zend_execute_API.c(876) : Freeing 0xB78B8490 (20 bytes), script=test2.php | |
=== Total 3 memory leaks detected === |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(3:22:33 PM) johannes: hey ho helly\G | |
(3:22:33 PM) helly\G: Moin moin | |
(3:24:21 PM) chregu_ [~chregu@77-58-253-248.dclient.hispeed.ch] entered the room. | |
(3:25:56 PM) jpauli1: helly\G: helly ! :) morning ^^ | |
(3:26:26 PM) helly\G: Jo | |
(3:28:41 PM) jpauli1: helly\G: sorry that the guy (forgot his name) who wants to review ext/SPL code seems not here ATM | |
(3:29:19 PM) nikic: jpauli1: Levi? | |
(3:29:30 PM) jpauli1: nikic: +1 :) | |
(3:29:39 PM) helly\G: Spl use or extend? | |
(3:29:40 PM) jpauli1: nikic: I'm not good at names remembering :p |
OlderNewer