Req #66462 [NEW]: Add opcache.api_enabled to provide password-based access to API functions
| From: | Terry at ellisons dot org dot uk | Date: | Fri, 10 Jan 2014 23:37:31 +0000 |
| Subject: | Req #66462 [NEW]: Add opcache.api_enabled to provide password-based access to API functions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183706@lists.php.net to get a copy of this message | ||
From: Terry at ellisons dot org dot uk
Operating system: N/A
PHP version: master-Git-2014-01-10 (Git)
Package: opcache
Bug Type: Feature/Change Request
Bug description:Add opcache.api_enabled to provide password-based access to API functions
Description:
------------
As per README addition:
opcache.api_password (default "")
calling OPcache API functions only from PHP scripts which first
the API by calling opcache_enable_api("password"). This parameter
is set to the MD5 of the required password. Note that if the
opcache.restrict_api is also set then both tests are applied.
The patch is attached
Test script:
---------------
This PHPT validates the functionality:
--TEST--
Validate use of the directive
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.api_password="e946adb45d4299def2071880d30136d4"
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
var_dump(opcache_get_status());
var_dump(opcache_enable_api("fred"));
var_dump(opcache_get_status());
var_dump(opcache_enable_api("Mary had a little lamb"));
$status = opcache_get_status();
echo "Get status ", (is_array($status) &&
isset($status['scripts'][__FILE__])) ? "works":"fails",
"\n";
?>
--EXPECTF--
Warning: Zend OPcache API is restricted by "api_password" configuration
directive in %s on line 2
bool(false)
Warning: Zend OPcache Invalid API enable password in %s line 3
bool(false)
Warning: Zend OPcache API is restricted by "api_password" configuration
directive in %s on line 4
bool(false)
bool(true)
Get status works
--
Edit bug report at https://bugs.php.net/bug.php?id=66462&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66462&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66462&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66462&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66462&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66462&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66462&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66462&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66462&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66462&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66462&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66462&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66462&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66462&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66462&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66462&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66462&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66462&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66462&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66462&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66462&r=mysqlcfg