YAML files should not contain syntax error

More information: https://insight.symfony.com/what-we-analyse/symfony.configuration.yaml_syntax_error

in .travis.yml, line 53
  1. - echo $TRAVIS_PHP_VERSION
  2. - echo $TRAVIS_BRANCH
  3. - echo $TRAVIS_PULL_REQUEST
  4. - composer self-update
  5. - if [ $TRAVIS_BRANCH == 'develop' ] || [ $TRAVIS_PULL_REQUEST != 'false' ]; then
  6. composer install --dev --prefer-dist;

    Unable to parse at line 53 (near " composer install --dev --prefer-dist;").

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. fi
  8. - if [ $TRAVIS_BRANCH != 'develop' ] && [ $TRAVIS_PHP_VERSION == "5.6" ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
  9. export TRAVIS_TAG=$(curl --fail --user "${GH_API_USER}" -s https://api.github.com/repos/getgrav/grav/releases/latest | grep tag_name | head -n 1 | cut -d '"' -f 4);
  10. eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.8 bash)";
  11. go get github.com/aktau/github-release;
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:49:20 GMT

PHP debug statements found

More information: https://insight.symfony.com/what-we-analyse/php.debug_statements

  1. *
  2. * @param $var
  3. */
  4. public function vardumpFunc($var)
  5. {
  6. var_dump($var);

    var_dump() should only be used for debug, and not committed to the source code repository.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  7. }
  8. /**
  9. * Simple wrapper for pathinfo()
  10. *
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:49:30 GMT

PHP configuration should not be changed dynamically 5

More information: https://insight.symfony.com/what-we-analyse/php.dynamically_change_configuration

  1. ]);
  2. $zip = new \ZipArchive();
  3. $zip->open($destination, \ZipArchive::CREATE);
  4. $max_execution_time = ini_set('max_execution_time', 600);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  5. static::folderToZip(GRAV_ROOT, $zip, strlen(rtrim(GRAV_ROOT, DS) . DS), $messager);
  6. $messager && $messager([
  7. 'type' => 'progress',
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:00:26 GMT
  1. ]);
  2. $zip->close();
  3. if ($max_execution_time !== false) {
  4. ini_set('max_execution_time', $max_execution_time);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  5. }
  6. return $destination;
  7. }
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:12:08 GMT
  1. $split_session = $config->get('system.session.split', true);
  2. if ($is_admin && $split_session) {
  3. $session_name .= '-admin';
  4. }
  5. $this->setName($session_name);
  6. ini_set('session.cookie_secure', $secure);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by j000
  7. ini_set('session.cookie_httponly', $httponly);
  8. $this->start();
  9. }
  10. }
  • rhuk

    Ignored on Wed, 06 Sep 2017 03:11:37 GMT
  1. if ($is_admin && $split_session) {
  2. $session_name .= '-admin';
  3. }
  4. $this->setName($session_name);
  5. ini_set('session.cookie_secure', $secure);
  6. ini_set('session.cookie_httponly', $httponly);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by j000
  7. $this->start();
  8. }
  9. }
  10. // Store something in session temporarily
  • rhuk

    Ignored on Wed, 06 Sep 2017 03:11:44 GMT
  1. ob_end_clean();
  2. }
  3. // required for IE, otherwise Content-Disposition may be ignored
  4. if (ini_get('zlib.output_compression')) {
  5. ini_set('zlib.output_compression', 'Off');

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Andy Miller
  6. }
  7. header("Content-Type: " . $mimetype);
  8. header('Accept-Ranges: bytes');
  • rhuk

    Ignored on Thu, 28 Apr 2016 17:54:08 GMT

Source code should not contain TODO comments 3

More information: https://insight.symfony.com/what-we-analyse/task_todo_comment

  1. public function reverse()
  2. {
  3. if (method_exists($this, 'createFrom')) {
  4. return $this->createFrom(array_reverse($this->toArray()));
  5. } else {
  6. // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4).

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  7. return new static(array_reverse($this->toArray()));
  8. }
  9. }
  10. /**
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:49:42 GMT
  1. shuffle($keys);
  2. if (method_exists($this, 'createFrom')) {
  3. return $this->createFrom(array_replace(array_flip($keys), $this->toArray()));
  4. } else {
  5. // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4).

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. return new static(array_replace(array_flip($keys), $this->toArray()));
  7. }
  8. }
  9. /**
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:49:50 GMT
  1. }
  2. /**
  3. * @param Criteria $criteria
  4. * @return ArrayCollection
  5. * @todo Implement lazy matching

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. */
  7. public function matching(Criteria $criteria)
  8. {
  9. $expr = $criteria->getWhereExpression();
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:49:58 GMT

Error silenced by the at sign (@) 17

More information: https://insight.symfony.com/what-we-analyse/php.silenced_error

  1. public static function arrayMergeRecursiveUnique($array1, $array2)
  2. {
  3. if (empty($array1)) return $array2; //optimize the base case
  4. foreach ($array2 as $key => $value) {
  5. if (is_array($value) && is_array(@$array1[$key])) {

    Adding "@" before $array1[$key] prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  6. $value = static::arrayMergeRecursiveUnique($array1[$key], $value);
  7. }
  8. $array1[$key] = $value;
  9. }
  10. return $array1;
  • rhuk

    Ignored on Mon, 30 Jan 2017 20:15:58 GMT
in index.php, line 35
  1. // Register the auto-loader.
  2. $loader = require_once $autoload;
  3. // Set timezone to default, falls back to system if php.ini not set
  4. date_default_timezone_set(@date_default_timezone_get());

    Adding "@" before date_default_timezone_get() prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  5. // Set internal encoding if mbstring loaded
  6. if (!extension_loaded('mbstring')) {
  7. die("'mbstring' extension is not loaded. This is required for Grav to run correctly");
  8. }
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:04:01 GMT
  1. $relative_dir = dirname($relative_path);
  2. $link = ROOT_DIR . $relative_path;
  3. }
  4. $file = ($this->fetch_command instanceof Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);

    Adding "@" before file_get_contents($link) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  5. // No file found, skip it...
  6. if ($file === false) {
  7. continue;
  8. }
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:22:56 GMT
  1. $relative_dir = dirname($relative_path);
  2. $link = ROOT_DIR . $relative_path;
  3. }
  4. $file = ($this->fetch_command instanceof Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);

    Adding "@" before $this->fetch_command->__invoke($link) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  5. // No file found, skip it...
  6. if ($file === false) {
  7. continue;
  8. }
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:22:49 GMT
  1. && $value instanceof \Countable);
  2. }
  3. public static function validateJson($value, $params)
  4. {
  5. return (bool) (@json_decode($value));

    Adding "@" before json_decode($value) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. }
  7. }
  • rhuk

    Ignored on Tue, 08 Mar 2016 21:40:14 GMT
  1. $file->unlock();
  2. // Compile cached file into bytecode cache
  3. if (function_exists('opcache_invalidate')) {
  4. // Silence error if function exists, but is restricted.
  5. @opcache_invalidate($file->filename(), true);

    Adding "@" before opcache_invalidate($file->filename(), true) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. }
  7. }
  8. }
  9. $file->free();
  • rhuk

    Ignored on Mon, 30 Jan 2017 20:15:48 GMT
  1. * @param string $slug The slug of the Plugin
  2. * @return mixed Package if found, NULL if not
  3. */
  4. public function getRepositoryPlugin($slug)
  5. {
  6. return @$this->repository['plugins'][$slug];

    Adding "@" before $this->repository['plugins'][$slug] prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  7. }
  8. /**
  9. * Returns the list of Plugins available in the repository
  10. * @return Iterator The Plugins remotely available
  • rhuk

    Ignored on Mon, 14 Sep 2015 03:20:52 GMT
  1. * @param string $slug The slug of the Theme
  2. * @return mixed Package if found, NULL if not
  3. */
  4. public function getRepositoryTheme($slug)
  5. {
  6. return @$this->repository['themes'][$slug];

    Adding "@" before $this->repository['themes'][$slug] prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  7. }
  8. /**
  9. * Returns the list of Themes available in the repository
  10. * @return Iterator The Themes remotely available
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:04:09 GMT
  1. } else {
  2. $stream = stream_context_create(['http' => $options['fopen']], $options['fopen']);
  3. }
  4. $content = @file_get_contents($uri, false, $stream);

    Adding "@" before file_get_contents($uri, false, $stream) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  5. if ($content === false) {
  6. $code = null;
  7. if (isset($http_response_header)) {
  8. $code = explode(' ', $http_response_header[0])[1];
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:22:59 GMT
  1. */
  2. public function shutdown()
  3. {
  4. // Prevent user abort allowing onShutdown event to run without interruptions.
  5. if (function_exists('ignore_user_abort')) {
  6. @ignore_user_abort(true);

    Adding "@" before ignore_user_abort(true) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  7. }
  8. // Close the session allowing new requests to be handled.
  9. if (isset($this['session'])) {
  10. $this['session']->close();
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:02 GMT
  1. if ($this['config']->get('system.debugger.shutdown.close_connection', true)) {
  2. // Flush the response and close the connection to allow time consuming tasks to be performed without leaving
  3. // the connection to the client open. This will make page loads to feel much faster.
  4. // FastCGI allows us to flush all response data to the client and finish the request.
  5. $success = function_exists('fastcgi_finish_request') ? @fastcgi_finish_request() : false;

    Adding "@" before fastcgi_finish_request() prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. if (!$success) {
  7. // Unfortunately without FastCGI there is no way to force close the connection.
  8. // We need to ask browser to close the connection for us.
  9. if ($this['config']->get('system.cache.gzip')) {
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:06 GMT
  1. // Get length and close the connection.
  2. header('Content-Length: ' . ob_get_length());
  3. header("Connection: close");
  4. ob_end_flush();
  5. @ob_flush();

    Adding "@" before ob_flush() prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Matias Griese
  6. flush();
  7. }
  8. }
  9. // Run any time consuming tasks.
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:09 GMT
  1. // Use output buffering to prevent headers from being sent too early.
  2. ob_start();
  3. if ($this->container['config']->get('system.cache.gzip')) {
  4. // Enable zip/deflate with a fallback in case of if browser does not support compressing.
  5. if (!@ob_start("ob_gzhandler")) {

    Adding "@" before ob_start("ob_gzhandler") prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  6. ob_start();
  7. }
  8. }
  9. // Initialize the timezone.
  • rhuk

    Ignored on Thu, 30 Mar 2017 21:27:34 GMT
  1. private function buildScheme()
  2. {
  3. // set the base
  4. if (isset($_SERVER['HTTPS'])) {
  5. $scheme = (strtolower(@$_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';

    Adding "@" before $_SERVER['HTTPS'] prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  6. } else {
  7. $scheme = 'http://';
  8. }
  9. return $scheme;
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:13 GMT
  1. $this->output->writeln('');
  2. $this->output->writeln('<red>DELETING</red>');
  3. $anything = false;
  4. foreach ($this->paths_to_remove as $path) {
  5. $path = ROOT_DIR . $path;
  6. if (is_dir($path) && @Folder::delete($path)) {

    Adding "@" before \Grav\Common\Filesystem\Folder::delete($path) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andy Miller
  7. $anything = true;
  8. $this->output->writeln('<red>dir: </red>' . $path);
  9. } elseif (is_file($path) && @unlink($path)) {
  10. $anything = true;
  11. $this->output->writeln('<red>file: </red>' . $path);
  • rhuk

    Ignored on Mon, 14 Sep 2015 03:20:57 GMT
  1. $from = $this->source . $source;
  2. $to = $this->destination . $target;
  3. $this->output->writeln(' <cyan>' . $source . '</cyan> <comment>-></comment> ' . $to);
  4. @Folder::rcopy($from, $to);

    Adding "@" before \Grav\Common\Filesystem\Folder::rcopy($from, $to) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  5. }
  6. }
  7. /**
  8. *
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:16 GMT
  1. $to = $this->destination . $target;
  2. $this->output->writeln(' <cyan>' . $source . '</cyan> <comment>-></comment> ' . $to);
  3. if (is_dir($to)) {
  4. @Folder::delete($to);

    Adding "@" before \Grav\Common\Filesystem\Folder::delete($to) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Djamil Legato
  5. } else {
  6. @unlink($to);
  7. }
  8. symlink($from, $to);
  9. }
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:04:24 GMT

Object parameters should be type hinted 5

More information: https://insight.symfony.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. $json_page->onlyForAjaxRequests(true);
  2. }
  3. if (isset($config['log']) && $config['log']) {
  4. $logger = $grav['log'];
  5. $whoops->pushHandler(function($exception, $inspector, $run) use ($logger) {

    The parameter exception, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Flavio Copes
  6. try {
  7. $logger->addCritical($exception->getMessage() . ' - Trace: ' . $exception->getTraceAsString());
  8. } catch (\Exception $e) {
  9. echo $e;
  10. }
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:28 GMT
  1. * Removes all nodes after the current node.
  2. * @param DOMNode|DOMElement $domNode
  3. * @param DOMNode|DOMElement $topNode
  4. * @return void
  5. */
  6. private static function removeProceedingNodes($domNode, $topNode)

    The parameter domNode, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andy Miller
  7. {
  8. $nextNode = $domNode->nextSibling;
  9. if ($nextNode !== null) {
  10. self::removeProceedingNodes($nextNode, $topNode);
  • rhuk

    Ignored on Fri, 07 Oct 2016 14:23:39 GMT
  1. * Returns the innerHTML of a particular DOMElement
  2. *
  3. * @param $element
  4. * @return string
  5. */
  6. private static function innerHTML($element) {

    The parameter element, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andy Miller
  7. $innerHTML = "";
  8. $children = $element->childNodes;
  9. foreach ($children as $child)
  10. {
  11. $tmp_dom = new DOMDocument();
  • rhuk

    Ignored on Fri, 07 Oct 2016 14:23:35 GMT
  1. * @param $packages
  2. */
  3. public function sort($packages)
  4. {
  5. foreach ($this->options['sort'] as $key) {
  6. $packages = $packages->sort(function ($a, $b) use ($key) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Djamil Legato
  7. switch ($key) {
  8. case 'author':
  9. return strcmp($a->{$key}['name'], $b->{$key}['name']);
  10. break;
  11. default:
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:43 GMT
  1. * @param $packages
  2. */
  3. public function sort($packages)
  4. {
  5. foreach ($this->options['sort'] as $key) {
  6. $packages = $packages->sort(function ($a, $b) use ($key) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Djamil Legato
  7. switch ($key) {
  8. case 'author':
  9. return strcmp($a->{$key}['name'], $b->{$key}['name']);
  10. break;
  11. default:
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:23:48 GMT

User specific files should not appear in .gitignore 5

More information: https://insight.symfony.com/what-we-analyse/git.user_specific_ignored_file

in .gitignore, line 32
  1. !user/themes/.*
  2. user/localhost/config/security.yaml
  3. user/config/security.yaml
  4. # OS Generated
  5. .DS_Store*

    .DS_Store* is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. ehthumbs.db
  7. Icon?
  8. Thumbs.db
  9. *.swp
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:26:54 GMT
in .gitignore, line 33
  1. user/localhost/config/security.yaml
  2. user/config/security.yaml
  3. # OS Generated
  4. .DS_Store*
  5. ehthumbs.db

    ehthumbs.db is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. Icon?
  7. Thumbs.db
  8. *.swp
  9. # phpstorm
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:27:16 GMT
in .gitignore, line 35
  1. # OS Generated
  2. .DS_Store*
  3. ehthumbs.db
  4. Icon?
  5. Thumbs.db

    Thumbs.db is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. *.swp
  7. # phpstorm
  8. .idea/*
  9. user/config/security.yaml
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:27:01 GMT
in .gitignore, line 36
  1. # OS Generated
  2. .DS_Store*
  3. ehthumbs.db
  4. Icon?
  5. Thumbs.db
  6. *.swp

    *.swp is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  7. # phpstorm
  8. .idea/*
  9. user/config/security.yaml
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:27:12 GMT
in .gitignore, line 39
  1. Icon?
  2. Thumbs.db
  3. *.swp
  4. # phpstorm
  5. .idea/*

    .idea/* is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  6. user/config/security.yaml
  7. tests/_output/*
  8. tests/_support/_generated/*
  9. tests/cache/*
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:27:07 GMT

Unused method, property, variable or parameter 13

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. header('Content-Disposition: attachment; filename="' . $file_parts['basename'] . '"');
  2. }
  3. // multipart-download and download resuming support
  4. if (isset($_SERVER['HTTP_RANGE'])) {
  5. list($a, $range) = explode("=", $_SERVER['HTTP_RANGE'], 2);

    This a local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. list($range) = explode(",", $range, 2);
  7. list($range, $range_end) = explode("-", $range);
  8. $range = intval($range);
  9. if (!$range_end) {
  10. $range_end = $size - 1;
  • rhuk

    Ignored on Thu, 28 Apr 2016 17:57:36 GMT
  1. * @param mixed $value Value to be validated.
  2. * @param array $params Validation parameters.
  3. * @param array $field Blueprint for the field.
  4. * @return bool True if validation succeeded.
  5. */
  6. public static function typeText($value, array $params, array $field)

    This field argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. {
  8. if (!is_string($value)) {
  9. return false;
  10. }
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:57:28 GMT
  1. * @param mixed $value Value to be validated.
  2. * @param array $params Validation parameters.
  3. * @param array $field Blueprint for the field.
  4. * @return bool True if validation succeeded.
  5. */
  6. public static function typeCheckbox($value, array $params, array $field)

    This params argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. {
  8. $value = (string) $value;
  9. if (!isset($field['value'])) {
  10. $field['value'] = 1;
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:01:53 GMT
  1. * @param mixed $value Value to be validated.
  2. * @param array $params Validation parameters.
  3. * @param array $field Blueprint for the field.
  4. * @return bool True if validation succeeded.
  5. */
  6. public static function typeNumber($value, array $params, array $field)

    This field argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. {
  8. if (!is_numeric($value)) {
  9. return false;
  10. }
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:57:35 GMT
  1. protected static function filterNumber($value, array $params, array $field)
  2. {
  3. return (string)(int)$value !== (string)(float)$value ? (float) $value : (int) $value;
  4. }
  5. protected static function filterDateTime($value, array $params, array $field)

    This field argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. {
  7. $format = Grav::instance()['config']->get('system.pages.dateformat.default');
  8. if ($format) {
  9. $converted = new \DateTime($value);
  10. return $converted->format($format);
  • rhuk

    Ignored on Mon, 14 Sep 2015 03:21:03 GMT
  1. protected static function filterNumber($value, array $params, array $field)
  2. {
  3. return (string)(int)$value !== (string)(float)$value ? (float) $value : (int) $value;
  4. }
  5. protected static function filterDateTime($value, array $params, array $field)

    This params argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. {
  7. $format = Grav::instance()['config']->get('system.pages.dateformat.default');
  8. if ($format) {
  9. $converted = new \DateTime($value);
  10. return $converted->format($format);
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:01:58 GMT
  1. * @param mixed $value Value to be validated.
  2. * @param array $params Validation parameters.
  3. * @param array $field Blueprint for the field.
  4. * @return bool True if validation succeeded.
  5. */
  6. public static function typeDatetime($value, array $params, array $field)

    This field argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. {
  8. if ($value instanceof \DateTime) {
  9. return true;
  10. } elseif (!is_string($value)) {
  11. return false;
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:02:02 GMT
  1. }
  2. return true;
  3. }
  4. protected static function filterArray($value, $params, $field)

    This params argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  5. {
  6. $values = (array) $value;
  7. $options = isset($field['options']) ? array_keys($field['options']) : array();
  8. $multi = isset($field['multiple']) ? $field['multiple'] : false;
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:57:41 GMT
  1. }
  2. return $values;
  3. }
  4. public static function typeList($value, array $params, array $field)

    This params argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Gert
  5. {
  6. if (!is_array($value)) {
  7. return false;
  8. }
  • rhuk

    Ignored on Mon, 14 Sep 2015 02:02:06 GMT
  1. if (isset($proxy['port'])) {
  2. $overrides['curl'][CURLOPT_PROXYPORT] = $proxy['port'];
  3. }
  4. if (isset($proxy['user']) && isset($proxy['pass'])) {
  5. $fopen_auth = $auth = base64_encode($proxy['user'] . ':' . $proxy['pass']);

    This auth local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  6. $overrides['curl'][CURLOPT_PROXYUSERPWD] = $proxy['user'] . ':' . $proxy['pass'];
  7. $overrides['fopen']['header'] = "Proxy-Authorization: Basic $fopen_auth";
  8. }
  9. }
  • rhuk

    Ignored on Fri, 07 Oct 2016 14:23:41 GMT
  1. /**
  2. * Automatically picks the preferred method
  3. *
  4. * @return string The response of the request
  5. */
  6. private static function getAuto()

    This getAuto method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Djamil Legato
  7. {
  8. if (!ini_get('open_basedir') && self::isFopenAvailable()) {
  9. return self::getFopen(func_get_args());
  10. }
  • rhuk

    Ignored on Fri, 05 Feb 2016 19:42:13 GMT
  1. *
  2. * @return array
  3. */
  4. public function inheritedField($field)
  5. {
  6. list($inherited, $currentParams) = $this->getInheritedParams($field);

    This inherited local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Josh Weiss
  7. return $currentParams;
  8. }
  9. /**
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:53:37 GMT
  1. $this->output->write(" |- Installing package... ");
  2. Installer::install(
  3. $zip,
  4. $this->destination,
  5. $options = [

    This options local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Frédéric Potvin
  6. 'install_path' => $install_path,
  7. 'theme' => (($type == 'theme')),
  8. 'is_update' => $is_update
  9. ],
  10. $extracted
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:53:51 GMT

Commented code should not be committed

More information: https://insight.symfony.com/what-we-analyse/php.commented_out_code

in system/defines.php, line 12
  1. */
  2. // Some standard defines
  3. define('GRAV', true);
  4. define('GRAV_VERSION', '1.3.2');
  5. //define('GRAV_TESTING', true);

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Andy Miller
  6. define('DS', '/');
  7. if (!defined('GRAV_PHP_MIN')) {
  8. define('GRAV_PHP_MIN', '5.5.9');
  9. }
  • rhuk

    Ignored on Thu, 27 Jul 2017 02:56:30 GMT