[php-src] Issue #8799: `opcache.restrict_api` does not correctly apply through web server
| From: | Rarst | Date: | Thu, 16 Jun 2022 07:58:11 +0000 |
| Subject: | [php-src] Issue #8799: `opcache.restrict_api` does not correctly apply through web server | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241743@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8799
Author: Rarst
### Description
I observe an issue when correct
opcache.restrict_api setting isn't being
recognized when run through an Apache (2.4.52) web server.
The following code:
```php
<?php
var_dump(
ini_get( 'opcache.restrict_api' ),
__FILE__,
strpos( __FILE__, ini_get( 'opcache.restrict_api' ) )
);
opcache_get_status();
```
### Non-matching path, CLI (correct, warning)
```
string(3) "cli"
string(10) "C:\serverr"
string(47) "C:\server\www\dev\opcache-restrict-api-test.php"
bool(false)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in
C:\server\www\dev\opcache-restrict-api-test.php on line 9
```
### Non-matching path, web server (correct, warning)
```
string(14) "apache2handler" string(10) "C:\serverr" string(47)
"C:\server\www\dev\opcache-restrict-api-test.php" bool(false)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in
C:\server\www\dev\opcache-restrict-api-test.php on line 9
```
### Matching path, CLI (correct, no warning)
```
string(3) "cli"
string(9) "C:\server"
string(47) "C:\server\www\dev\opcache-restrict-api-test.php"
int(0)
```
### Matching path, web server (INCORRECT, warning)
```
string(14) "apache2handler" string(9) "C:\server" string(47)
"C:\server\www\dev\opcache-restrict-api-test.php" int(0)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in
C:\server\www\dev\opcache-restrict-api-test.php on line 9
```
### PHP Version
8.1.2
### Operating System
Windows 10