File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -1345,7 +1345,12 @@ zend_string *accel_make_persistent_key(zend_string *str)
1345
1345
EXPECTED ((parent_script = zend_get_executed_filename_ex ()) != NULL )) {
1346
1346
1347
1347
parent_script_len = ZSTR_LEN (parent_script );
1348
- while ((-- parent_script_len > 0 ) && !IS_SLASH (ZSTR_VAL (parent_script )[parent_script_len ]));
1348
+ while (parent_script_len > 0 ) {
1349
+ -- parent_script_len ;
1350
+ if (IS_SLASH (ZSTR_VAL (parent_script )[parent_script_len ])) {
1351
+ break ;
1352
+ }
1353
+ }
1349
1354
1350
1355
if (UNEXPECTED ((size_t )(key_length + parent_script_len + 1 ) >= ZCG_KEY_LEN )) {
1351
1356
return NULL ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-17899 (zend_test_compile_string with opcache crash on invalid script path)
3
+ --EXTENSIONS--
4
+ zend_test
5
+ --INI--
6
+ opcache.enable_cli=1
7
+ --CREDITS--
8
+ YuanchengJiang
9
+ --FILE--
10
+ <?php
11
+ $ source = '<?php
12
+ require("sumfile.php");
13
+ ?> ' ;
14
+ try {zend_test_compile_string ($ source ,$ source ,$ c );} catch (Exception $ e ) { echo ($ e ); }
15
+ --EXPECTF --
16
+
17
+ Warning: Undefined variable $ c in %s on line %d
18
+
19
+ Deprecated: zend_test_compile_string(): Passing null to parameter #3 ($position) of type int is deprecated in %s on line %d
20
+
21
+ Warning: require (sumfile.php): Failed to open stream: No such file or directory in <?php
22
+ require ("sumfile.php " );
23
+ ?> on line %d
24
+
25
+ Fatal error: Uncaught Error: Failed opening required 'sumfile.php' (include_path='.%s') in <?php
26
+ require ("sumfile.php " );
27
+ ?> :%d
28
+ Stack trace:
29
+ #0 %s(%d): zend_test_compile_string('<?php \nrequire("...', '<?php \nrequire( " .. .', NULL)
30
+ #1 {main}
31
+ thrown in <?php
32
+ require("sumfile.php");
33
+ ?> on line %d
34
+
You can’t perform that action at this time.
0 commit comments