PeeHaa / OpCacheGUI

GUI for PHP's OpCache
1.46k stars 170 forks source link

php7.1 Fatal error: Cannot use variable $request twice #78

Closed miqmago closed 6 years ago

miqmago commented 7 years ago

With php7.1 I'm getting this error (that was not happening with php7.0):

Fatal error: Cannot use variable $request twice in /var/www/admin/routes.php on line 13
Call Stack
#   Time    Memory  Function    Location
1   0.0000  358528  {main}( )   .../index.php:0
2   0.0001  359072  require( '/var/www/admin/index.php' )   .../index.php:3
miqmago commented 7 years ago

Also note that I'm using Zend OPcache, from php -i:

Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI

Directive => Local Value => Master Value
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 0 => 0
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 4 => 4
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 2000 => 2000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 64 => 64
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On

But this is under nginx - php-fpm which outputs:

Zend OPcache

Opcode Caching  Up and Running
Optimization    Enabled
SHM Cache   Enabled
File Cache  Disabled
Startup OK
Shared memory model mmap
Cache hits  2469
Cache misses    509
Used memory 33716536
Free memory 100501192
Wasted memory   0
Interned Strings Used memory    2198296
Interned Strings Free memory    1996008
Cached scripts  507
Cached keys 515
Max keys    3907
OOM restarts    0
Hash keys restarts  0
Manual restarts 0
Nicolas01 commented 7 years ago

Editing the /srv/http/OpCacheGUI/routes.php file fixed the error:

//$router->post('', function() use ($htmlTemplate, $csrfToken, $request, $user, $request) {
$router->post('', function() use ($htmlTemplate, $csrfToken, $request, $user) {
miqmago commented 7 years ago

That works, maybe it's an error in the code? ($request parameter is repeated)

Nicolas01 commented 7 years ago

You're right, it seems an error to me.
I don't see the point of using $request twice as an argument in this anonymous function.
I just wonder why we are the only ones to have this error!

miqmago commented 7 years ago

Maybe we are the only ones using php7.x in production ;)

MDT-FGI commented 7 years ago

Can confirm the issue and the mentioned fix.

ekinhbayar commented 6 years ago

Closing as this was fixed in #75.

CallejaMotos commented 4 years ago

hi guys, I am in prestashop 1.7.6, I solve coding the line you mean, but I have this notices:

Notice: Undefined index: opcache.load_comments in /home/pre/domains/mydomain/public_html/modules/opcache/opcache/src/OpCacheGUI/OpCache/Configuration.php on line 82

Notice: Undefined index: opcache.fast_shutdown in /home/pre/domains/mydomain/public_html/modules/opcache/opcache/src/OpCacheGUI/OpCache/Configuration.php on line 83

anyone can hlep?