File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ You can then point your web server to serve files from the `phpepl/` root folder
33
33
* Namely, you should be able to visit the index page (` phpepl/index.html ` ) from ` http://localhost ` (include a custom port if necessary)
34
34
* Ex: ` http://localhost:8000/index.html ` or simply ` http://localhost:8000 ` , assuming your server is configured to listen to port 8000.
35
35
36
- ** You then need to disable sandboxing** by toggling the ` $sandbox_me ` var in ` src/eval/index.php ` to disable the sandbox locally.
37
36
You'll then have free reign to execute any commands.
38
37
39
38
#### Vagrant
@@ -64,8 +63,9 @@ If you'd like to tinker around with the code, you can do the following:
64
63
` src/phpepl.js ` is the main script for the website. This gets built into ` dist/phpepl.js `
65
64
which is referenced by ` phpepl/index.html ` .
66
65
67
- The php evaluation code is in ` src/eval/index.php ` . That endpoint is sandboxed by default,
68
- so toggle the ` $sandbox_me ` var in ` src/eval/index.php ` to disable the sandbox locally.
66
+ The php evaluation code is in ` src/eval/index.php ` . That endpoint checks for the existence of a
67
+ ` PHPEPL_PROD ` environment variable (which is set on the production hosts) for sandboxing. Locally, you won't
68
+ have that set, so you'll have the unsandboxed version by default.
69
69
70
70
* With grunt running, that change should rebuild the app and you can just refresh the page.
71
71
Original file line number Diff line number Diff line change 1
1
<?php
2
- // set me to false to turn off sandboxing
3
- $ sandbox_me = true ;
4
-
2
+ // Only production environments will have this set – turning on sandboxing
3
+ // DEP_VERSION is for cloud control
4
+ $ sandbox_me = isset ( $ _ENV [ ' PHPEPL_PROD ' ]) || isset ( $ _ENV [ ' DEP_VERSION ' ]);
5
5
require_once ('../../vendor/autoload.php ' );
6
6
7
7
// Turn off errors since eval will throw them on invalid syntax
@@ -85,7 +85,7 @@ function php_execute_sandboxed($code) {
85
85
foreach ($ pattern as $ _pattern ){
86
86
if (strtolower (substr ($ _pattern , -1 )) == 'e ' ){
87
87
throw new Exception ("Can not use PREG_REPLACE_EVAL! " );
88
- }
88
+ }
89
89
}
90
90
} else if (strtolower (substr ($ pattern , -1 )) == 'e ' ){
91
91
throw new Exception ("Can not use PREG_REPLACE_EVAL! " );
You can’t perform that action at this time.
0 commit comments