Global variable or function should never be used

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

in tst/serversalt.php, line 43
  1. // mcrypt mock
  2. if (!function_exists('mcrypt_create_iv'))
  3. {
  4. if (!defined('MCRYPT_DEV_URANDOM')) define('MCRYPT_DEV_URANDOM', 1);
  5. function mcrypt_create_iv($int, $flag)

    mcrypt_create_iv() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by El RIDO
  6. {
  7. $randomSalt = '';
  8. for($i = 0; $i < $int; ++$i) {
  9. $randomSalt .= base_convert(mt_rand(), 10, 16);
  10. }

sleep() should not be used 3

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

in tst/purgelimiter.php, line 28
  1. purgelimiter::canPurge();
  2. // try setting it
  3. purgelimiter::setLimit(1);
  4. $this->assertEquals(false, purgelimiter::canPurge());
  5. sleep(2);

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  6. $this->assertEquals(true, purgelimiter::canPurge());
  7. // disable it
  8. purgelimiter::setLimit(0);
  9. purgelimiter::canPurge();
  1. $file = 'baz';
  2. $this->assertEquals($this->_path . DIRECTORY_SEPARATOR . $file, trafficlimiter::getPath($file));
  3. trafficlimiter::setLimit(4);
  4. $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  5. $this->assertTrue(trafficlimiter::canPass(), 'first request may pass');
  6. sleep(1);

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. $this->assertFalse(trafficlimiter::canPass(), 'second request is to fast, may not pass');
  8. sleep(4);
  9. $this->assertTrue(trafficlimiter::canPass(), 'third request waited long enough and may pass');
  10. $_SERVER['REMOTE_ADDR'] = '2001:1620:2057:dead:beef::cafe:babe';
  11. $this->assertTrue(trafficlimiter::canPass(), 'fourth request has different ip and may pass');
  1. trafficlimiter::setLimit(4);
  2. $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  3. $this->assertTrue(trafficlimiter::canPass(), 'first request may pass');
  4. sleep(1);
  5. $this->assertFalse(trafficlimiter::canPass(), 'second request is to fast, may not pass');
  6. sleep(4);

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. $this->assertTrue(trafficlimiter::canPass(), 'third request waited long enough and may pass');
  8. $_SERVER['REMOTE_ADDR'] = '2001:1620:2057:dead:beef::cafe:babe';
  9. $this->assertTrue(trafficlimiter::canPass(), 'fourth request has different ip and may pass');
  10. $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  11. $this->assertFalse(trafficlimiter::canPass(), 'fifth request is to fast, may not pass');

Code should not be duplicated 11

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

  1. <meta name="robots" content="noindex" />
  2. <title><?php echo i18n::_('PrivateBin'); ?></title>
  3. <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
  4. <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
  5. <link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  6. if ($SYNTAXHIGHLIGHTING): ?>

    The next 239 lines appear both in tpl/bootstrap-compact.php:12 and tpl/bootstrap-page.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. <link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  8. if (strlen($SYNTAXHIGHLIGHTINGTHEME)): ?>
  9. <link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  10. endif;
  11. endif; ?>
  1. <meta name="robots" content="noindex" />
  2. <title><?php echo i18n::_('PrivateBin'); ?></title>
  3. <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
  4. <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
  5. <link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  6. if ($SYNTAXHIGHLIGHTING): ?>

    The next 76 lines appear both in tpl/bootstrap-compact.php:12 and tpl/bootstrap-dark-page.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. <link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  8. if (strlen($SYNTAXHIGHLIGHTINGTHEME)): ?>
  9. <link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  10. endif;
  11. endif; ?>
  1. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <?php echo $LANGUAGES[$LANGUAGESELECTION][0]; ?> <span class="caret"></span></a>
  2. <ul class="dropdown-menu"><?php
  3. foreach ($LANGUAGES as $key => $value): ?>
  4. <li>
  5. <a href="#" class="reloadlink" onclick="document.cookie='lang={$key}';">
  6. <?php echo $value[0]; ?> (<?php echo $value[1]; ?>)

    The next 87 lines appear both in tpl/bootstrap-compact.php:167 and tpl/bootstrap-dark-page.php:164.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. </a>
  8. </li><?php
  9. endforeach; ?>
  10. </ul>
  11. </li><?php
  1. </ul>
  2. </div>
  3. </div>
  4. </nav>
  5. <header class="container"><?php
  6. if (strlen($NOTICE)): ?>

    The next 71 lines appear both in tpl/bootstrap-compact.php:184 and tpl/bootstrap-dark.php:180.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. <div role="alert" class="alert alert-info">
  8. <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE); ?>
  9. </div><?php
  10. endif; ?>
  11. <div id="remainingtime" role="alert" class="hidden alert alert-info">
  1. <ul class="nav navbar-nav">
  2. <li>
  3. <button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
  4. <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo i18n::_('Send'); ?>
  5. </button><?php
  6. if ($EXPIRECLONE): ?>

    The next 112 lines appear both in tpl/bootstrap-dark-page.php:62 and tpl/bootstrap-dark.php:62.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. <button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
  8. <span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo i18n::_('Clone'); ?>
  9. </button><?php
  10. endif; ?>
  11. <button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
  1. <meta name="robots" content="noindex" />
  2. <title><?php echo i18n::_('PrivateBin'); ?></title>
  3. <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
  4. <link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
  5. <link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  6. if ($SYNTAXHIGHLIGHTING): ?>

    The next 239 lines appear both in tpl/bootstrap-dark.php:12 and tpl/bootstrap.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. <link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  8. if (strlen($SYNTAXHIGHLIGHTINGTHEME)): ?>
  9. <link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" /><?php
  10. endif;
  11. endif; ?>
in tst/model.php, line 59
  1. $this->assertEquals($pasteData['meta'][$key], $paste->meta->$key);
  2. }
  3. // storing comments
  4. $commentData = helper::getComment();
  5. $paste = $this->_model->getPaste(helper::getPasteId());

    The next 15 lines appear both in tst/model.php:59 and tst/model.php:291.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  6. $comment = $paste->getComment(helper::getPasteId(), helper::getCommentId());
  7. $this->assertFalse($comment->exists(), 'comment does not yet exist');
  8. $comment = $paste->getComment(helper::getPasteId());
  9. $comment->setData($commentData['data']);
  1. helper::rmdir($this->_path);
  2. }
  3. public function testFileBasedDataStoreWorks()
  4. {
  5. $this->_model->delete(helper::getPasteId());

    The next 30 lines appear both in tst/privatebin/data.php:23 and tst/privatebin/db.php:27.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  6. // storing pastes
  7. $paste = helper::getPaste(array('expire_date' => 1344803344));
  8. $this->assertFalse($this->_model->exists(helper::getPasteId()), 'paste does not yet exist');
  9. $this->assertTrue($this->_model->create(helper::getPasteId(), $paste), 'store new paste');
  1. public function testFileBasedAttachmentStoreWorks()
  2. {
  3. $this->_model->delete(helper::getPasteId());
  4. $original = $paste = helper::getPasteWithAttachment(array('expire_date' => 1344803344));
  5. $paste['meta']['attachment'] = $paste['attachment'];

    The next 11 lines appear both in tst/privatebin/data.php:56 and tst/privatebin/db.php:61.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  6. $paste['meta']['attachmentname'] = $paste['attachmentname'];
  7. unset($paste['attachment'], $paste['attachmentname']);
  8. $this->assertFalse($this->_model->exists(helper::getPasteId()), 'paste does not yet exist');
  9. $this->assertTrue($this->_model->create(helper::getPasteId(), $paste), 'store new paste');
  10. $this->assertTrue($this->_model->exists(helper::getPasteId()), 'paste exists after storing it');
  1. $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
  2. $ids = array();
  3. foreach ($keys as $key)
  4. {
  5. $ids[$key] = substr(md5($key), 0, 16);
  6. $this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist");

    The next 22 lines appear both in tst/privatebin/data.php:76 and tst/privatebin/db.php:82.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. if (in_array($key, array('x', 'y', 'z')))
  8. {
  9. $this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste");
  10. }
  11. else
in tst/privatebin.php, line 297
  1. helper::confBackup();
  2. helper::createIniFile(CONF, $options);
  3. $_POST = helper::getPaste();
  4. $_POST['expire'] = '5min';
  5. $_POST['formatter'] = 'foo';
  6. $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';

    The next 17 lines appear both in tst/privatebin.php:297 and tst/privatebin.php:329.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by El RIDO
  7. $_SERVER['REQUEST_METHOD'] = 'POST';
  8. $_SERVER['REMOTE_ADDR'] = '::1';
  9. $time = time();
  10. ob_start();
  11. new privatebin;

Source code should not contain TODO comments

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

in lib/model/comment.php, line 37
  1. * @throws Exception
  2. * @return stdClass
  3. */
  4. public function get()
  5. {
  6. // @todo add support to read specific comment

    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 El RIDO
  7. $comments = $this->_store->readComments($this->getPaste()->getId());
  8. foreach ($comments as $comment) {
  9. if (
  10. $comment->parentid == $this->getParentId() &&
  11. $comment->id == $this->getId()

Error silenced by the at sign (@)

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

in lib/serversalt.php, line 71
  1. {
  2. if (strlen(self::$_salt)) return self::$_salt;
  3. $file = 'salt.php';
  4. if (self::_exists($file)) {
  5. $items = explode('|', @file_get_contents(self::getPath($file)));

    Adding "@" before file_get_contents(self::getPath($file)) 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 El RIDO
  6. if (!is_array($items) || count($items) != 3) {
  7. throw new Exception('unable to read file ' . self::getPath($file), 20);
  8. }
  9. self::$_salt = $items[1];
  10. } else {

User specific files should not appear in .gitignore

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

in .gitignore, line 2
  1. # Ignore data/, tmp/ and vendor/
  2. data/

    data/ 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 Lancelot HARDEL
  3. tmp/
  4. vendor/
  5. # Ignore for safety
  6. .htaccess
  7. .htpasswd

Unused method, property, variable or parameter 2

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

in tst/serversalt.php, line 43
  1. // mcrypt mock
  2. if (!function_exists('mcrypt_create_iv'))
  3. {
  4. if (!defined('MCRYPT_DEV_URANDOM')) define('MCRYPT_DEV_URANDOM', 1);
  5. function mcrypt_create_iv($int, $flag)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  6. {
  7. $randomSalt = '';
  8. for($i = 0; $i < $int; ++$i) {
  9. $randomSalt .= base_convert(mt_rand(), 10, 16);
  10. }
  1. * @access private
  2. * @static
  3. * @param string $element
  4. * @return bool
  5. */
  6. private static function _isFirstLevelDir($element)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. return self::_isSecondLevelDir($element) &&
  9. is_dir(self::$_dir . DIRECTORY_SEPARATOR . $element);
  10. }

PHP code should follow PSR-1 basic coding standard 84

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

in tst/serversalt.php, line 2
  1. <?php
  2. class serversaltTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_path;
  5. private $_invalidPath;
  1. <?php
  2. class purgelimiterTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_path;
  5. public function setUp()
  6. {
  1. <?php
  2. class trafficlimiterTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_path;
  5. public function setUp()
  6. {
in tst/model.php, line 2
  1. <?php
  2. class modelTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_conf;
  5. private $_model;
  1. <?php
  2. class privatebin_dataTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_model;
  5. private $_path;
in tst/privatebin.php, line 2
  1. <?php
  2. class privatebinTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. protected $_model;
  5. public function setUp()
  6. {
in lib/serversalt.php, line 23
  1. *
  2. * Salt is used:
  3. * - to generate unique VizHash in discussions (which are not reproductible across PrivateBin servers)
  4. * - to generate unique deletion token (which are not re-usable across PrivateBin servers)
  5. */
  6. class serversalt extends persistence

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. /**
  9. * generated salt
  10. *
  11. * @access private
  1. /**
  2. * privatebin_data
  3. *
  4. * Model for data access, implemented as a singleton.
  5. */
  6. class privatebin_data extends privatebin_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * directory where data is stored
  10. *
  11. * @access private
  1. *
  2. * @access private
  3. * @param int $batchsize
  4. * @return array
  5. */
  6. protected function _getExpiredPastes($batchsize)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $pastes = array();
  9. $firstLevel = array_filter(
  10. scandir(self::$_dir),
  11. array('self', '_isFirstLevelDir')
  1. *
  2. * @access private
  3. * @static
  4. * @return void
  5. */
  6. private static function _init()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. // Create storage directory if it does not exist.
  9. if (!is_dir(self::$_dir)) mkdir(self::$_dir, 0705);
  10. // Create .htaccess file if it does not exist.
  11. if (!is_file(self::$_dir . '.htaccess'))
  1. * @access private
  2. * @static
  3. * @param string $dataid
  4. * @return void
  5. */
  6. private static function _dataid2path($dataid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. return self::$_dir . substr($dataid, 0, 2) . DIRECTORY_SEPARATOR .
  9. substr($dataid, 2, 2) . DIRECTORY_SEPARATOR;
  10. }
  1. * @access private
  2. * @static
  3. * @param string $dataid
  4. * @return void
  5. */
  6. private static function _dataid2discussionpath($dataid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. return self::_dataid2path($dataid) . $dataid .
  9. '.discussion' . DIRECTORY_SEPARATOR;
  10. }
  1. * @access private
  2. * @static
  3. * @param string $element
  4. * @return bool
  5. */
  6. private static function _isFirstLevelDir($element)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. return self::_isSecondLevelDir($element) &&
  9. is_dir(self::$_dir . DIRECTORY_SEPARATOR . $element);
  10. }
  1. * @access private
  2. * @static
  3. * @param string $element
  4. * @return bool
  5. */
  6. private static function _isSecondLevelDir($element)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. return (bool) preg_match('/^[a-f0-9]{2}$/', $element);
  9. }
  10. }
in lib/model/comment.php, line 18
  1. /**
  2. * model_comment
  3. *
  4. * Model of a PrivateBin comment.
  5. */
  6. class model_comment extends model_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * Instance's parent.
  10. *
  11. * @access private
in lib/auto.php, line 20
  1. /**
  2. * auto
  3. *
  4. * provides autoloading functionality
  5. */
  6. class auto

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. /**
  9. * includes file for given class name
  10. *
  11. * @access public
in lib/configuration.php, line 18
  1. /**
  2. * configuration
  3. *
  4. * parses configuration file, ensures default values present
  5. */
  6. class configuration

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * parsed configuration
  10. *
  11. * @var array
in lib/filter.php, line 18
  1. /**
  2. * filter
  3. *
  4. * Provides data filtering functions.
  5. */
  6. class filter

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. /**
  9. * strips slashes deeply
  10. *
  11. * @access public
in lib/filter.php, line 28
  1. * @access public
  2. * @static
  3. * @param mixed $value
  4. * @return mixed
  5. */
  6. public static function stripslashes_deep($value)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. return is_array($value) ?
  9. array_map('filter::stripslashes_deep', $value) :
  10. stripslashes($value);
  11. }
in lib/filter.php, line 46
  1. * @static
  2. * @param string $time
  3. * @throws Exception
  4. * @return string
  5. */
  6. public static function time_humanreadable($time)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. if (preg_match('/^(\d+) *(\w+)$/', $time, $matches) !== 1) {
  9. throw new Exception("Error parsing time format '$time'", 30);
  10. }
  11. switch ($matches[2]) {
in lib/filter.php, line 72
  1. * @access public
  2. * @static
  3. * @param int $size
  4. * @return string
  5. */
  6. public static function size_humanreadable($size)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. $iec = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
  9. $i = 0;
  10. while ( ( $size / 1024 ) >= 1 ) {
  11. $size = $size / 1024;
in lib/filter.php, line 93
  1. * @static
  2. * @param string $a
  3. * @param string $b
  4. * @return bool
  5. */
  6. public static function slow_equals($a, $b)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. $diff = strlen($a) ^ strlen($b);
  9. for($i = 0; $i < strlen($a) && $i < strlen($b); $i++)
  10. {
  11. $diff |= ord($a[$i]) ^ ord($b[$i]);
in lib/i18n.php, line 18
  1. /**
  2. * i18n
  3. *
  4. * provides internationalization tools like translation, browser language detection, etc.
  5. */
  6. class i18n

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * language
  10. *
  11. * @access protected
in lib/i18n.php, line 83
  1. * @static
  2. * @param string $messageId
  3. * @param mixed $args one or multiple parameters injected into placeholders
  4. * @return string
  5. */
  6. public static function _($messageId)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. return call_user_func_array(array('i18n', 'translate'), func_get_args());
  9. }
  10. /**
in lib/i18n.php, line 283
  1. * @access protected
  2. * @static
  3. * @param string $file
  4. * @return string
  5. */
  6. protected static function _getPath($file = '')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. if (strlen(self::$_path) == 0)
  9. {
  10. self::$_path = PUBLIC_PATH . DIRECTORY_SEPARATOR . 'i18n';
  11. }
in lib/i18n.php, line 302
  1. * @access protected
  2. * @static
  3. * @param int $n
  4. * @return int
  5. */
  6. protected static function _getPluralForm($n)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. switch (self::$_language) {
  9. case 'fr':
  10. case 'zh':
  11. return ($n > 1 ? 1 : 0);
in lib/i18n.php, line 327
  1. * @static
  2. * @param array $acceptedLanguages
  3. * @param array $availableLanguages
  4. * @return string
  5. */
  6. protected static function _getMatchingLanguage($acceptedLanguages, $availableLanguages) {

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. $matches = array();
  8. $any = false;
  9. foreach ($acceptedLanguages as $acceptedQuality => $acceptedValues)
  10. {
  11. $acceptedQuality = floatval($acceptedQuality);
in lib/i18n.php, line 386
  1. * @static
  2. * @param string $a
  3. * @param string $b
  4. * @return float
  5. */
  6. protected static function _matchLanguage($a, $b) {

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. $a = explode('-', $a);
  8. $b = explode('-', $b);
  9. for ($i=0, $n = min(count($a), count($b)); $i < $n; ++$i)
  10. {
  11. if ($a[$i] !== $b[$i]) break;
  1. /**
  2. * model_abstract
  3. *
  4. * Abstract model for PrivateBin objects.
  5. */
  6. abstract class model_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * Instance ID.
  10. *
  11. * @access protected
in lib/model/paste.php, line 18
  1. /**
  2. * model_paste
  3. *
  4. * Model of a PrivateBin paste.
  5. */
  6. class model_paste extends model_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * Get paste data.
  10. *
  11. * @access public
in lib/model.php, line 18
  1. /**
  2. * model
  3. *
  4. * Factory of PrivateBin instance models.
  5. */
  6. class model

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * Configuration.
  10. *
  11. * @var configuration
in lib/model.php, line 77
  1. /**
  2. * Gets, and creates if neccessary, a store object
  3. *
  4. * @return privatebin_abstract
  5. */
  6. private function _getStore()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. if ($this->_store === null)
  9. {
  10. $this->_store = forward_static_call(
  11. array($this->_conf->getKey('class', 'model'), 'getInstance'),
in lib/persistence.php, line 18
  1. /**
  2. * persistence
  3. *
  4. * persists data in PHP files
  5. */
  6. abstract class persistence

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. /**
  9. * path in which to persist something
  10. *
  11. * @access private
in lib/persistence.php, line 70
  1. * @access protected
  2. * @static
  3. * @param string $filename
  4. * @return bool
  5. */
  6. protected static function _exists($filename)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. self::_initialize();
  9. return is_file(self::$_path . DIRECTORY_SEPARATOR . $filename);
  10. }
in lib/persistence.php, line 84
  1. * @access protected
  2. * @static
  3. * @throws Exception
  4. * @return void
  5. */
  6. protected static function _initialize()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. // Create storage directory if it does not exist.
  9. if (!is_dir(self::$_path))
  10. if (!@mkdir(self::$_path))
  11. throw new Exception('unable to create directory ' . self::$_path, 10);
in lib/persistence.php, line 117
  1. * @param string $filename
  2. * @param string $data
  3. * @throws Exception
  4. * @return string
  5. */
  6. protected static function _store($filename, $data)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. self::_initialize();
  9. $file = self::$_path . DIRECTORY_SEPARATOR . $filename;
  10. $writtenBytes = @file_put_contents($file, $data, LOCK_EX);
  11. if ($writtenBytes === false || $writtenBytes < strlen($data))
  1. /**
  2. * privatebin_abstract
  3. *
  4. * Abstract model for PrivateBin data access, implemented as a singleton.
  5. */
  6. abstract class privatebin_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * singleton instance
  10. *
  11. * @access protected
  1. *
  2. * @access protected
  3. * @param int $batchsize
  4. * @return array
  5. */
  6. abstract protected function _getExpiredPastes($batchsize);

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. /**
  8. * Perform a purge of old pastes, at most the given batchsize is deleted.
  9. *
  10. * @access public
in lib/privatebin/db.php, line 18
  1. /**
  2. * privatebin_db
  3. *
  4. * Model for DB access, implemented as a singleton.
  5. */
  6. class privatebin_db extends privatebin_abstract

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * cache for select queries
  10. *
  11. * @var array
in lib/privatebin/db.php, line 412
  1. *
  2. * @access private
  3. * @param int $batchsize
  4. * @return array
  5. */
  6. protected function _getExpiredPastes($batchsize)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $pastes = array();
  9. $rows = self::_select(
  10. 'SELECT dataid FROM ' . self::_sanitizeIdentifier('paste') .
  11. ' WHERE expiredate < ? LIMIT ?', array(time(), $batchsize)
in lib/privatebin/db.php, line 439
  1. * @param string $sql
  2. * @param array $params
  3. * @throws PDOException
  4. * @return bool
  5. */
  6. private static function _exec($sql, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. $statement = self::$_db->prepare($sql);
  9. $result = $statement->execute($params);
  10. $statement->closeCursor();
  11. return $result;
in lib/privatebin/db.php, line 458
  1. * @param array $params
  2. * @param bool $firstOnly if only the first row should be returned
  3. * @throws PDOException
  4. * @return array
  5. */
  6. private static function _select($sql, array $params, $firstOnly = false)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. $statement = self::$_db->prepare($sql);
  9. $statement->execute($params);
  10. $result = $firstOnly ?
  11. $statement->fetch(PDO::FETCH_ASSOC) :
in lib/privatebin/db.php, line 478
  1. * @static
  2. * @param string $type
  3. * @throws Exception
  4. * @return string
  5. */
  6. private static function _getTableQuery($type)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. switch($type)
  9. {
  10. case 'ibm':
  11. $sql = 'SELECT tabname FROM SYSCAT.TABLES ';
in lib/privatebin/db.php, line 534
  1. * @static
  2. * @param string $key
  3. * @throws PDOException
  4. * @return string
  5. */
  6. private static function _getConfig($key)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $row = self::_select(
  9. 'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
  10. ' WHERE id = ?', array($key), true
  11. );
in lib/privatebin/db.php, line 551
  1. * @access private
  2. * @static
  3. * @param string $key
  4. * @return array
  5. */
  6. private static function _getPrimaryKeyClauses($key = 'dataid')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $main_key = $after_key = '';
  9. if (self::$_type === 'mysql')
  10. {
  11. $after_key = ", PRIMARY KEY ($key)";
in lib/privatebin/db.php, line 572
  1. *
  2. * @access private
  3. * @static
  4. * @return void
  5. */
  6. private static function _createPasteTable()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. list($main_key, $after_key) = self::_getPrimaryKeyClauses();
  9. $dataType = self::$_type === 'pgsql' ? 'TEXT' : 'BLOB';
  10. self::$_db->exec(
  11. 'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' .
in lib/privatebin/db.php, line 597
  1. *
  2. * @access private
  3. * @static
  4. * @return void
  5. */
  6. private static function _createCommentTable()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. list($main_key, $after_key) = self::_getPrimaryKeyClauses();
  9. $dataType = self::$_type === 'pgsql' ? 'text' : 'BLOB';
  10. self::$_db->exec(
  11. 'CREATE TABLE ' . self::_sanitizeIdentifier('comment') . ' ( ' .
in lib/privatebin/db.php, line 624
  1. *
  2. * @access private
  3. * @static
  4. * @return void
  5. */
  6. private static function _createConfigTable()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. list($main_key, $after_key) = self::_getPrimaryKeyClauses('id');
  9. self::$_db->exec(
  10. 'CREATE TABLE ' . self::_sanitizeIdentifier('config') .
  11. " ( id CHAR(16) NOT NULL$main_key, value TEXT$after_key );"
in lib/privatebin/db.php, line 646
  1. * @access private
  2. * @static
  3. * @param string $identifier
  4. * @return string
  5. */
  6. private static function _sanitizeIdentifier($identifier)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. return preg_replace('/[^A-Za-z0-9_]+/', '', self::$_prefix . $identifier);
  9. }
  10. /**
in lib/privatebin/db.php, line 659
  1. * @access private
  2. * @static
  3. * @param string $oldversion
  4. * @return void
  5. */
  6. private static function _upgradeDatabase($oldversion)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $dataType = self::$_type === 'pgsql' ? 'TEXT' : 'BLOB';
  9. switch ($oldversion)
  10. {
  11. case '0.21':
in lib/privatebin.php, line 18
  1. /**
  2. * privatebin
  3. *
  4. * Controller, puts it all together.
  5. */
  6. class privatebin

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * version
  10. *
  11. * @const string
in lib/privatebin.php, line 164
  1. * initialize privatebin
  2. *
  3. * @access private
  4. * @return void
  5. */
  6. private function _init()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. foreach (array('cfg', 'lib') as $dir)
  9. {
  10. if (!is_file(PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess')) file_put_contents(
  11. PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess',
in lib/privatebin.php, line 213
  1. * pasteid (optional) = in discussion, which paste this comment belongs to.
  2. *
  3. * @access private
  4. * @return string
  5. */
  6. private function _create()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. // Ensure last paste from visitors IP address was more than configured amount of seconds ago.
  9. trafficlimiter::setConfiguration($this->_conf);
  10. if (!trafficlimiter::canPass()) return $this->_return_message(
  11. 1, i18n::_(
in lib/privatebin.php, line 314
  1. * @access private
  2. * @param string $dataid
  3. * @param string $deletetoken
  4. * @return void
  5. */
  6. private function _delete($dataid, $deletetoken)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. try {
  9. $paste = $this->_model->getPaste($dataid);
  10. if ($paste->exists())
  11. {
in lib/privatebin.php, line 366
  1. *
  2. * @access private
  3. * @param string $dataid
  4. * @return void
  5. */
  6. private function _read($dataid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. try {
  9. $paste = $this->_model->getPaste($dataid);
  10. if ($paste->exists())
  11. {
in lib/privatebin.php, line 404
  1. * Display PrivateBin frontend.
  2. *
  3. * @access private
  4. * @return void
  5. */
  6. private function _view()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. // set headers to disable caching
  9. $time = gmdate('D, d M Y H:i:s \G\M\T');
  10. header('Cache-Control: no-store, no-cache, must-revalidate');
  11. header('Pragma: no-cache');
in lib/privatebin.php, line 465
  1. *
  2. * @access private
  3. * @param string $type
  4. * @return void
  5. */
  6. private function _jsonld($type)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. if (
  9. $type !== 'paste' && $type !== 'comment' &&
  10. $type !== 'pastemeta' && $type !== 'commentmeta'
  11. )
in lib/privatebin.php, line 500
  1. * @param int $status
  2. * @param string $message
  3. * @param array $other
  4. * @return void
  5. */
  6. private function _return_message($status, $message, $other = array())

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. $result = array('status' => $status);
  9. if ($status)
  10. {
  11. $result['message'] = i18n::_($message);
in lib/purgelimiter.php, line 18
  1. /**
  2. * purgelimiter
  3. *
  4. * Handles purge limiting, so purging is not triggered to often.
  5. */
  6. class purgelimiter extends persistence

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * time limit in seconds, defaults to 300s
  10. *
  11. * @access private
in lib/request.php, line 18
  1. /**
  2. * request
  3. *
  4. * parses request parameters and provides helper functions for routing
  5. */
  6. class request

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * MIME type for JSON
  10. *
  11. * @const string
in lib/request.php, line 193
  1. * Adapted from: https://stackoverflow.com/questions/3770513/detect-browser-language-in-php#3771447
  2. *
  3. * @access private
  4. * @return bool
  5. */
  6. private function _detectJsonRequest()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. $hasAcceptHeader = array_key_exists('HTTP_ACCEPT', $_SERVER);
  9. $acceptHeader = $hasAcceptHeader ? $_SERVER['HTTP_ACCEPT'] : '';
  10. // simple cases
in lib/sjcl.php, line 18
  1. /**
  2. * sjcl
  3. *
  4. * Provides SJCL validation function.
  5. */
  6. class sjcl

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  7. {
  8. /**
  9. * SJCL validator
  10. *
  11. * Checks if a json string is a proper SJCL encrypted message.
  1. /**
  2. * trafficlimiter
  3. *
  4. * Handles traffic limiting, so no user does more than one call per 10 seconds.
  5. */
  6. class trafficlimiter extends persistence

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  7. {
  8. /**
  9. * time limit in seconds, defaults to 10s
  10. *
  11. * @access private
in lib/view.php, line 18
  1. /**
  2. * view
  3. *
  4. * Displays the templates
  5. */
  6. class view

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. /**
  9. * variables available in the template
  10. *
  11. * @access private
in lib/vizhash16x16.php, line 25
  1. * header('Content-type: image/png');
  2. * echo $data;
  3. * exit;
  4. */
  5. class vizhash16x16

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sebastien SAUVAGE
  6. {
  7. /**
  8. * hash values
  9. *
  10. * @access private
in tst/auto.php, line 2
  1. <?php
  2. class autoTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. public function testAutoloaderReturnsFalseWhenCallingNonExistingClass()
  5. {
  6. $this->assertFalse(auto::loader('foo2501bar42'), 'calling non existent class');
  7. }
in tst/bootstrap.php, line 12
  1. if (!defined('CONF')) define('CONF', PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini');
  2. if (!is_file(CONF)) copy(CONF . '.sample', CONF);
  3. require PATH . 'lib/auto.php';
  4. class helper

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Simon Rupf
  5. {
  6. /**
  7. * example ID of a paste
  8. *
  9. * @var string
in tst/bootstrap.php, line 245
  1. *
  2. * @param mixed $var
  3. * @param bool $return
  4. * @return void|string
  5. */
  6. public static function var_export_min($var, $return = false)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. {
  8. if (is_array($var)) {
  9. $toImplode = array();
  10. foreach ($var as $key => $value) {
  11. $toImplode[] = var_export($key, true) . ' => ' . self::var_export_min($value, true);
  1. ),
  2. 'affects' => array('create')
  3. ),
  4. ),
  5. ));
  6. Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. class configurationTestGenerator
  8. {
  9. /**
  10. * endless loop protection, since we're working with a recursive function,
  11. * creating factorial configurations
  1. $this->_writeConfigurationTest();
  2. }
  3. /**
  4. * write configuration test file based on generated configuration array
  5. */

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  6. private function _writeConfigurationTest()
  7. {
  8. $defaultOptions = parse_ini_file(CONF, true);
  9. $code = $this->_getHeader();
  10. foreach ($this->_configurations as $key => $conf) {
  1. /**
  2. * get header of configuration test file
  3. *
  4. * @return string
  5. */

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  6. private function _getHeader()
  7. {
  8. return <<<'EOT'
  9. <?php
  10. /**
  1. * @param int $key
  2. * @param array $options
  3. * @param array $preCode
  4. * @param array $testCode
  5. * @return string
  6. */

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. private function _getFunction($step, $key, &$options, $preCode, $testCode)
  8. {
  9. if (count($testCode) == 0) {
  10. echo "skipping creation of test$step$key, no valid tests found for configuration: $options". PHP_EOL;
  11. return '';
  1. /**
  2. * recursive function to generate configurations based on options
  3. *
  4. * @throws Exception
  5. * @return array
  6. */

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. private function _generateConfigurations()
  8. {
  9. // recursive factorial function
  10. if (++$this->_iterationCount > self::MAX_ITERATIONS) {
  11. echo 'max iterations reached, stopping', PHP_EOL;
  1. * @param array $setting
  2. * @param string $section
  3. * @param string $option
  4. * @throws Exception
  5. * @return array
  6. */

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  7. private function _addSetting(&$configuration, &$setting, &$section, &$option) {
  8. if (++$this->_iterationCount > self::MAX_ITERATIONS) {
  9. echo 'max iterations reached, stopping', PHP_EOL;
  10. return $configuration;
  11. }
  1. <?php
  2. class configurationTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_options;
  5. private $_minimalConfig;
in tst/filter.php, line 2
  1. <?php
  2. class filterTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. public function testFilterStripsSlashesDeeply()
  5. {
  6. $this->assertEquals(
  7. array("f'oo", "b'ar", array("fo'o", "b'ar")),
in tst/i18n.php, line 2
  1. <?php
  2. class i18nTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_translations = array();
  5. public function setUp()
  6. {
in tst/jsonApi.php, line 2
  1. <?php
  2. class jsonApiTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. protected $_model;
  5. public function setUp()
  6. {
  1. <?php
  2. class privatebin_dbTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_model;
  5. private $_options = array(
  6. 'dsn' => 'sqlite::memory:',
  1. <?php
  2. require_once 'privatebin.php';
  3. class privatebinWithDbTest extends privatebinTest

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  4. {
  5. private $_options = array(
  6. 'usr' => null,
  7. 'pwd' => null,
  8. 'opt' => array(
in tst/request.php, line 2
  1. <?php
  2. class requestTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. public function setUp()
  5. {
  6. /* Setup Routine */
  7. }
in tst/sjcl.php, line 2
  1. <?php
  2. class sjclTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. public function testSjclValidatorValidatesCorrectly()
  5. {
  6. $paste = helper::getPasteWithAttachment();
  7. $this->assertTrue(sjcl::isValid($paste['data']), 'valid sjcl');
in tst/view.php, line 2
  1. <?php
  2. class viewTest extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private static $error = 'foo bar';
  5. private static $status = '!*#@?$+';
  1. <?php
  2. class vizhash16x16Test extends PHPUnit_Framework_TestCase

    Class names should be declared in StudlyCaps.
    You should rename this class to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by El RIDO
  3. {
  4. private $_file;
  5. private $_path;

.htaccess should be avoided 3

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

A .htaccess file has been spotted. You should consider moving it to the server configuration to improve global performances.

Time to fix: about 1 hour
Open Issue Permalink
Last edited by Simon Rupf

A .htaccess file has been spotted. You should consider moving it to the server configuration to improve global performances.

Time to fix: about 1 hour
Open Issue Permalink
Last edited by Simon Rupf

A .htaccess file has been spotted. You should consider moving it to the server configuration to improve global performances.

Time to fix: about 1 hour
Open Issue Permalink
Last edited by rugk