mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #1416] Issues found by WordPress Theme Check plugin #590
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#590
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @troytempleman on GitHub (Dec 22, 2019).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1416
Hi Jordi,
Monolog is used in MerlinWP and when included in a WordPress theme and put through the Theme Check plugin, I get the following errors relating to Monolog:
WARNING: Found exec in the file merlin/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php. PHP system calls are often disabled by server admins and should not be in themes.
Line24: exec('where hg 2>NUL', $output, $result);
Line26: exec('which hg 2>/dev/null >/dev/null', $output, $result);
WARNING: Found base64_encode in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php. base64_encode() is not allowed.
Line41: 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
Line75: 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
Line118: 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
WARNING: Found base64_encode in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php. base64_encode() is not allowed.
Line138: $data = base64_encode(utf8_encode($json));
Line153: $data = base64_encode(utf8_encode($json));
WARNING: Found ->exec in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php. PHP system calls are often disabled by server admins and should not be in themes.
Line79: ->exec();
WARNING: pfsockopen was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line17: * Stores to any socket - uses fsockopen() or pfsockopen().
Line196: protected function pfsockopen()
Line198: return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this-
Line276: $resource = $this->pfsockopen();
WARNING: fwrite was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line353: fwrite($resource, 'test_resource');
WARNING: fwrite was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line130: fwrite($stream, (string) $record['formatted']);
WARNING: fwrite was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line225: protected function fwrite($data)
Line227: return @fwrite($this->resource, $data);
Line300: $chunk = $this->fwrite($data);
Line302: $chunk = $this->fwrite(substr($data, $sent));
WARNING: fwrite was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line156: fwrite($handle, $log);
WARNING: fsockopen was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line17: * Stores to any socket - uses fsockopen() or pfsockopen().
Line20: * @see http://php.net/manual/en/function.fsockopen.php
Line98: * @see http://php.net/manual/en/function.fsockopen.php
Line183: * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
Line196: protected function pfsockopen()
Line198: return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->
Line204: protected function fsockopen()
Line206: return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->
Line276: $resource = $this->pfsockopen();
Line278: $resource = $this->fsockopen();
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line32: $this->assertEquals('testtest2test3', fread($handle, 100));
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line203: $this->assertEquals('test1test2test3', fread($this->res, 1024));
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line47: $content = fread($this->res, 1024);
Line57: $content = fread($this->res, 1024);
Line70: $content = fread($this->res, 1024);
Line76: $content2 = fread($this->res, 1024);
Line87: $content = fread($this->res, 1024);
Line100: $content = fread($this->res, 1024);
Line110: $content = fread($this->res, 1024);
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line34: $content = fread($this->res, 1024);
Line54: $content = fread($this->res, 1024);
Line65: $content = fread($this->res, 1024);
Line77: $content = fread($this->res, 1024);
Line89: $content = fread($this->res, 1024);
Line99: $content = fread($this->res, 1024);
Line109: $content = fread($this->res, 1024);
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line38: $content = fread($this->res, 1024);
Line54: $content = fread($this->res, 1024);
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line32: $content = fread($this->res, 1024);
Line44: $content = fread($this->res, 1024);
Line56: $content = fread($this->res, 1024);
Line68: $content = fread($this->res, 1024);
Line80: $content = fread($this->res, 1024);
Line100: $content = fread($this->res, 1024);
Line136: $content = fread($this->res, 1024);
Line148: $content = fread($this->res, 1024);
Line158: $content = fread($this->res, 12000);
Line171: $content = fread($this->res, 1024);
Line200: $content = fread($this->res, 1024);
WARNING: fread was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line46: $content = fread($this->res, 1024);
WARNING: fread was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line160: @fread($res, 2048);
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line25: $handle = fopen('php://memory', 'a+');
Line40: $handle = fopen('php://memory', 'a+');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line278: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line132: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line118: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line63: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line242: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line65: $this->res = fopen('php://memory', 'a');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line34: 'extra' => array('foo' => new TestFooNorm, 'bar' => new TestBarNorm, 'baz' => array(), 'res' => fopen('php://memory', 'rb')),
Line199: $resource = fopen(FILE, 'r');
Line352: $resource = fopen('php://memory', 'rw+');
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line116: 'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')),
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line100: $this->stream = fopen($this->url, 'a');
Line135: $this->errorMessage = preg_replace('{^(fopen|mkdir)(.*?): }', '', $msg);
WARNING: fopen was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line140: $handle = fopen($this->deduplicationStore, 'rw+');
WARNING: file_put_contents was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line197: file_put_contents($log, 'foo');
WARNING: file_put_contents was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line167: file_put_contents($this->deduplicationStore, $record['datetime']->getTimest
WARNING: file_get_contents was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line73: $this->assertEquals('test', file_get_contents($log));
Line104: $this->assertEquals('test', file_get_contents($log));
Line201: $this->assertEquals('footest', file_get_contents($log));
WARNING: file_get_contents was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line133: file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
Line154: file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
WARNING: file_get_contents was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line60: if (false === @file_get_contents($url, null, $context)) {
WARNING: fclose was found in the file merlin/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line181: fclose($res);
WARNING: fclose was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line63: fclose($this->stream);
WARNING: fclose was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line78: fclose($this->resource);
WARNING: fclose was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line160: fclose($handle);
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line72: $ch = curl_init();
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line83: $ch = curl_init();
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line55: $ch = curl_init();
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line87: $ch = curl_init();
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line58: $ch = curl_init();
WARNING: curl_init was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line91: $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put');
WARNING: curl_exec was found in the file merlin/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line35: if (curl_exec($ch) === false) {
I realize this is not specifically for Wordpress, but any ideas how to fix these errors?
Thanks!
@Seldaek commented on GitHub (Dec 22, 2019):
I have no idea what system/static analysis these errors come from, but I am 100% sure we can not fix this in Monolog. There is no way we are going to use WP_Filesystem instead of
freadfor example.I am not familiar enough with WP to help you here sorry. Maybe best to report this to MerlinWP if that's what's shipping Monolog in your WP setup?