Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/addon/sfPager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function getPreviousPage()
*/
public function setPage($page)
{
$this->page = intval($page);
$this->page = (int) $page;

if ($this->page <= 0)
{
Expand Down
6 changes: 3 additions & 3 deletions lib/cache/sfFileCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function has($key)
*/
public function set($key, $data, $lifetime = null)
{
if ($this->getOption('automatic_cleaning_factor') > 0 && rand(1, $this->getOption('automatic_cleaning_factor')) == 1)
if ($this->getOption('automatic_cleaning_factor') > 0 && mt_rand(1, $this->getOption('automatic_cleaning_factor')) == 1)
{
$this->clean(sfCache::OLD);
}
Expand Down Expand Up @@ -235,12 +235,12 @@ protected function read($path, $type = self::READ_DATA)
}

@flock($fp, LOCK_SH);
$data[self::READ_TIMEOUT] = intval(@stream_get_contents($fp, 12, 0));
$data[self::READ_TIMEOUT] = (int) @stream_get_contents($fp, 12, 0);
if ($type != self::READ_TIMEOUT && time() < $data[self::READ_TIMEOUT])
{
if ($type & self::READ_LAST_MODIFIED)
{
$data[self::READ_LAST_MODIFIED] = intval(@stream_get_contents($fp, 12, 12));
$data[self::READ_LAST_MODIFIED] = (int) @stream_get_contents($fp, 12, 12);
}
if ($type & self::READ_DATA)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/cache/sfMemcacheCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand Down Expand Up @@ -60,7 +60,7 @@ public function initialize($options = array())
foreach ($this->getOption('servers') as $server)
{
$port = isset($server['port']) ? $server['port'] : 11211;
if (!$this->memcache->addServer($server['host'], $port, isset($server['persistent']) ? $server['persistent'] : true))
if (!$this->memcache->addserver($server['host'], $port, isset($server['persistent']) ? $server['persistent'] : true))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct addServer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably PhpStoms has incorrect definition in stubs, will revert this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 1cb8f45

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

{
throw new sfInitializationException(sprintf('Unable to connect to the memcache server (%s:%s).', $server['host'], $port));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/cache/sfSQLiteCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function has($key)
*/
public function set($key, $data, $lifetime = null)
{
if ($this->getOption('automatic_cleaning_factor') > 0 && rand(1, $this->getOption('automatic_cleaning_factor')) == 1)
if ($this->getOption('automatic_cleaning_factor') > 0 && mt_rand(1, $this->getOption('automatic_cleaning_factor')) == 1)
{
$this->clean(sfCache::OLD);
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public function getTimeout($key)

$rs = $this->dbh->query(sprintf("SELECT timeout FROM cache WHERE key = '%s' AND timeout > %d", sqlite_escape_string($key), time()));

return $rs->numRows() ? intval($rs->fetchSingle()) : 0;
return $rs->numRows() ? (int) $rs->fetchSingle() : 0;
}

/**
Expand All @@ -184,7 +184,7 @@ public function getLastModified($key)

$rs = $this->dbh->query(sprintf("SELECT last_modified FROM cache WHERE key = '%s' AND timeout > %d", sqlite_escape_string($key), time()));

return $rs->numRows() ? intval($rs->fetchSingle()) : 0;
return $rs->numRows() ? (int) $rs->fetchSingle() : 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/config/sfAutoloadConfigHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static public function getConfiguration(array $configFiles)
foreach ($configFiles as $i => $configFile)
{
$configFilePath = str_replace(DIRECTORY_SEPARATOR, '/', $configFile);
$path = str_replace(DIRECTORY_SEPARATOR, '/', realpath(join('/', array_slice(explode('/', $configFilePath), 0, -2))));
$path = str_replace(DIRECTORY_SEPARATOR, '/', realpath(implode('/', array_slice(explode('/', $configFilePath), 0, -2))));
if (in_array($path, $pluginPaths))
{
$pluginConfigFiles[] = $configFile;
Expand Down
40 changes: 20 additions & 20 deletions lib/config/sfPluginConfiguration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/**
* sfPluginConfiguration represents a configuration for a symfony plugin.
*
*
* @package symfony
* @subpackage config
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
Expand All @@ -26,7 +26,7 @@ abstract class sfPluginConfiguration

/**
* Constructor.
*
*
* @param sfProjectConfiguration $configuration The project configuration
* @param string $rootDir The plugin root directory
* @param string $name The plugin name
Expand All @@ -50,7 +50,7 @@ public function __construct(sfProjectConfiguration $configuration, $rootDir = nu

/**
* Sets up the plugin.
*
*
* This method can be used when creating a base plugin configuration class for other plugins to extend.
*/
public function setup()
Expand All @@ -59,7 +59,7 @@ public function setup()

/**
* Configures the plugin.
*
*
* This method is called before the plugin's classes have been added to sfAutoload.
*/
public function configure()
Expand All @@ -68,9 +68,9 @@ public function configure()

/**
* Initializes the plugin.
*
*
* This method is called after the plugin's classes have been added to sfAutoload.
*
*
* @return boolean|null If false sfApplicationConfiguration will look for a config.php (maintains BC with symfony < 1.2)
*/
public function initialize()
Expand All @@ -79,7 +79,7 @@ public function initialize()

/**
* Returns the plugin root directory.
*
*
* @return string
*/
public function getRootDir()
Expand All @@ -89,7 +89,7 @@ public function getRootDir()

/**
* Returns the plugin name.
*
*
* @return string
*/
public function getName()
Expand All @@ -99,11 +99,11 @@ public function getName()

/**
* Initializes autoloading for the plugin.
*
*
* This method is called when a plugin is initialized in a project
* configuration. Otherwise, autoload is handled in
* {@link sfApplicationConfiguration} using {@link sfAutoload}.
*
*
* @see sfSimpleAutoload
*/
public function initializeAutoload()
Expand All @@ -126,10 +126,10 @@ public function initializeAutoload()

/**
* Filters sfAutoload configuration values.
*
* @param sfEvent $event
* @param array $config
*
*
* @param sfEvent $event
* @param array $config
*
* @return array
*/
public function filterAutoloadConfig(sfEvent $event, array $config)
Expand Down Expand Up @@ -169,10 +169,10 @@ public function connectTests()

/**
* Listens for the "task.test.filter_test_files" event and adds tests from the current plugin.
*
*
* @param sfEvent $event
* @param array $files
*
*
* @return array An array of files with the appropriate tests from the current plugin merged in
*/
public function filterTestFiles(sfEvent $event, $files)
Expand Down Expand Up @@ -211,18 +211,18 @@ public function filterTestFiles(sfEvent $event, $files)

/**
* Guesses the plugin root directory.
*
*
* @return string
*/
protected function guessRootDir()
{
$r = new ReflectionClass(get_class($this));
return realpath(dirname($r->getFilename()).'/..');
return realpath(dirname($r->getFileName()).'/..');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this found automatically, I spent couple hours just fixing.

}

/**
* Guesses the plugin name.
*
*
* @return string
*/
protected function guessName()
Expand Down
2 changes: 1 addition & 1 deletion lib/config/sfRootConfigHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function execute($configFiles)
$config = static::getConfiguration($configFiles);

// determine if we're loading the system config_handlers.yml or a module config_handlers.yml
$moduleLevel = ($this->getParameterHolder()->get('module_level') === true) ? true : false;
$moduleLevel = ($this->getParameterHolder()->get('module_level') === true);

if ($moduleLevel)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/config/sfRoutingConfigHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function parse($configFiles)
else
{
$routes[$name] = array(isset($params['class']) ? $params['class'] : 'sfRoute', array(
$params['url'] ? $params['url'] : '/',
$params['url'] ?: '/',
isset($params['params']) ? $params['params'] : (isset($params['param']) ? $params['param'] : array()),
isset($params['requirements']) ? $params['requirements'] : array(),
isset($params['options']) ? $params['options'] : array(),
Expand Down
2 changes: 1 addition & 1 deletion lib/debug/sfWebDebug.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function asHtml()
$titles[] = sprintf('<li%s><a title="%s" href="%s"%s>%s</a></li>',
$panel->getStatus() ? ' class="sfWebDebug'.ucfirst($this->getPriority($panel->getStatus())).'"' : '',
$panel->getPanelTitle(),
$panel->getTitleUrl() ? $panel->getTitleUrl() : '#',
$panel->getTitleUrl() ?: '#',
$panel->getTitleUrl() ? '' : ' onclick="sfWebDebugShowDetailsFor(\''.$id.'\'); return false;"',
$title
);
Expand Down
Loading