Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5e8a673
Php Inspections (EA Extended): Static Code Analysis
kalessil Dec 26, 2015
8cc5364
Php Inspections (EA Extended): fixing UTs
kalessil Dec 26, 2015
99da217
Php Inspections (EA Extended): fixing UTs
kalessil Dec 26, 2015
2ac7b67
Fix integers used in mt_rand()
ngse Jan 15, 2016
043a0f5
Merge pull request #113 from ngse/patch-1
j0k3r Jan 15, 2016
ab7045d
Change parameter of sfAction::renderJson
zobzn Jan 29, 2016
b376a6b
Merge pull request #115 from zobzn/master
j0k3r Jan 31, 2016
1357564
Merge pull request #112 from marekk/master
j0k3r Feb 1, 2016
80f9280
CS
Feb 1, 2016
009e6ff
Merge pull request #111 from kalessil/SCA-Dec-2015
j0k3r Feb 1, 2016
c2674ae
Prepare 1.5.7
Feb 1, 2016
6ac65f7
Use PHP 7.0 instead of nightly
j0k3r Feb 1, 2016
ba992f9
Update UPGRADE file about configureDoctrine
j0k3r Feb 1, 2016
b64c0fb
Typo
j0k3r Feb 2, 2016
aeb49b2
Merge pull request #116 from LExpress/doctrine-project-upgrade
j0k3r Feb 2, 2016
5ff184e
Prepare next release
j0k3r Feb 2, 2016
5ea8d65
exception_handler signature changed in php7
timmipetit Feb 4, 2016
3b90d63
Improve test results
timmipetit Feb 5, 2016
f125ea3
Revert "Improve test results"
timmipetit Feb 9, 2016
3a3da50
Fix test
timmipetit Feb 5, 2016
892186d
Fix yaml tests for php7
timmipetit Feb 9, 2016
f432202
Fix sfWebControllerTest in php7
timmipetit Feb 9, 2016
1f0d1ce
Fix php7 tests for viewConfigHandler
timmipetit Feb 9, 2016
d444e9b
Fix php7 tests
timmipetit Feb 9, 2016
b17574f
Not adding APC on php7, not allowing php7 failures
May 10, 2016
717ae86
added php nightly
zkiiito May 10, 2016
956fa75
Update README.md
zkiiito May 10, 2016
73786d9
Merge pull request #121 from ingatlancom/PHP7
j0k3r May 12, 2016
d6b9a33
running tests with memcache
zkiiito May 13, 2016
daa8bd9
travis does not use --remote on git submodule update
zkiiito May 13, 2016
7ec7317
add memcache.so only for php 5.x
zkiiito May 13, 2016
37c1109
sfMemcacheCache: have to check metadata, if memcache returns false
zkiiito May 13, 2016
fcb3645
memcache set() expire parameters should be consistent
zkiiito May 13, 2016
4c6cde9
Merge pull request #124 from ingatlancom/sfMemcacheCache
j0k3r May 20, 2016
8dfaeb2
submodule refs updated
zkiiito May 20, 2016
7d1e547
Merge pull request #122 from ingatlancom/submodule-fix
j0k3r May 21, 2016
48c7e32
sfAutoload include fix
May 23, 2016
3b302d9
Merge pull request #127 from ingatlancom/sfAutoload-hhvm
j0k3r May 30, 2016
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
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "lib/vendor/swiftmailer"]
path = lib/vendor/swiftmailer
url = https://github.com/swiftmailer/swiftmailer.git
branch = 5.x
[submodule "lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine"]
path = lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine
url = https://github.com/LExpress/doctrine1.git
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ php:
- 5.4
- 5.5
- 5.6
- nightly
- 7.0
- hhvm
- nightly

# run build against nightly but allow them to fail
matrix:
fast_finish: true
allow_failures:
- php: nightly
- php: hhvm
- php: nightly

# faster builds on new travis setup not using sudo
sudo: false

services:
- memcached

# cache vendor dirs
cache:
directories:
Expand All @@ -28,9 +32,12 @@ install:
- composer self-update

before_script:
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
# by default, --remote is not used on travis
- git submodule update --remote --force
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- sh -c 'if [ $(php -r "echo PHP_RELEASE_VERSION;") -le 98 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- composer install

script:
- php data/bin/check_configuration.php
- php -dshort_open_tag=Off -dmagic_quotes_gpc=Off data/bin/symfony symfony:test --trace
- php data/bin/symfony symfony:test --trace
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
CHANGELOG
=========

02/02/2016: Version 1.5.7
-------------------------

* Fix error in embedded form #105
* Added HTTP PATCH request method #110
* Fix integers used in mt_rand() #113
* Remove array cast from parameter of sfAction::renderJson #115
* Don't post unnamed submit fields in sfBrowserBase #112
* Add support for traits in autoloaders #112
* Php Inspections (EA Extended): Static Code Analysis #111

22/07/2015: Version 1.5.6
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.

- [DIC](https://github.com/LExpress/symfony1/wiki/ServiceContainer)
- Composer support
- PHP 5.6 support
- PHP 7.0 support
- performance boost
- new widgets & validators
- some tickets fixed from the symfony trac
Expand Down
29 changes: 29 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,32 @@ Due to the new embed form enhancements:
* You cannot added the same `sfValidatorErrorSchema` instance twice or more into an `sfValidatorErrorSchema`.
* The method `sfValidatorErrorSchema::addErrors` only accept an `sfValidatorErrorSchema` instance as argument.
+ The `sfValidatorErrorSchema` constructor no longer accept an array of errors as second argument.

Doctrine & Project configuration
--------------------------------

Previously, you were able to configure doctrine in your `/config/ProjectConfiguration.class.php` using the method `configureDoctrine`.
This method isn't called anymore. You now need to connect to the `doctrine.configure` event:

```php
<?php
// ...

class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
// ...

$this->dispatcher->connect('doctrine.configure', array($this, 'configureDoctrineEvent'));
}

public function configureDoctrineEvent(sfEvent $event)
{
$manager = $event->getSubject();

// configure what ever you want on the doctrine manager
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, false);
}
}
```
2 changes: 2 additions & 0 deletions data/bin/check_configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ function_exists('xcache_set')
check(!ini_get('register_globals'), 'php.ini has register_globals set to off', 'Set it to off in php.ini', false);
check(!ini_get('session.auto_start'), 'php.ini has session.auto_start set to off', 'Set it to off in php.ini', false);

check(class_exists('Memcache'), 'Memcache is available', 'You must have memcache installed and enabled to use sfMemcacheCache class.', false);

if (!is_cli())
{
echo '</pre></body></html>';
Expand Down
2 changes: 1 addition & 1 deletion data/bin/sandbox_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$seen = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item)
{
if ($item->isDir() && !$item->isLink() && !isset($seen[$path]))
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink())
{
touch($item->getRealPath().'/.sf');
}
Expand Down
6 changes: 3 additions & 3 deletions lib/action/sfAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ public function renderText($text)
}

/**
* Convert the given array of data into a JSON response.
* Convert the given data into a JSON response.
*
* <code>return $this->renderJson(array('username' => 'john'))</code>
*
* @param array $data Data to encode as JSON
* @param mixed $data Data to encode as JSON
*
* @return sfView::NONE
*/
public function renderJson(array $data)
public function renderJson($data)
{
$this->getResponse()->setContentType('application/json');
$this->getResponse()->setContent(json_encode($data));
Expand Down
10 changes: 9 additions & 1 deletion lib/autoload/sfAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ public function reloadClasses($force = false)

$file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');

$this->classes = include($file);
if (defined('HHVM_VERSION'))
{
// workaround for https://github.com/facebook/hhvm/issues/1447
$this->classes = eval(str_replace('<?php', '', file_get_contents($file)));
}
else
{
$this->classes = include $file;
}

foreach ($this->overriden as $class => $path)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/autoload/sfCoreAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* The current symfony version.
*/
define('SYMFONY_VERSION', '1.5.7-dev');
define('SYMFONY_VERSION', '1.5.8-dev');

/**
* sfCoreAutoload class.
Expand Down
8 changes: 4 additions & 4 deletions lib/cache/sfFileCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ protected function write($path, $data, $timeout)
$current_umask = umask();
umask(0000);

if (!is_dir(dirname($path)))
$cacheDir = dirname($path);
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir))
{
// create directory structure if needed
mkdir(dirname($path), 0777, true);
throw new \sfCacheException(sprintf('Cache was not able to create a directory "%s".', $cacheDir));
}

$tmpFile = tempnam(dirname($path), basename($path));
$tmpFile = tempnam($cacheDir, basename($path));

if (!$fp = @fopen($tmpFile, 'wb'))
{
Expand Down
12 changes: 9 additions & 3 deletions lib/cache/sfMemcacheCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,21 @@ public function get($key, $default = null)
{
$value = $this->memcache->get($this->getOption('prefix').$key);

return false === $value ? $default : $value;
return (false === $value && false === $this->getMetadata($key)) ? $default : $value;
}

/**
* @see sfCache
*/
public function has($key)
{
return !(false === $this->memcache->get($this->getOption('prefix').$key));
if (false === $this->memcache->get($this->getOption('prefix') . $key))
{
// if there is metadata, $key exists with a false value
return !(false === $this->getMetadata($key));
}

return true;
}

/**
Expand Down Expand Up @@ -232,7 +238,7 @@ protected function getMetadata($key)
*/
protected function setMetadata($key, $lifetime)
{
$this->memcache->set($this->getOption('prefix').'_metadata'.self::SEPARATOR.$key, array('lastModified' => time(), 'timeout' => time() + $lifetime), false, $lifetime);
$this->memcache->set($this->getOption('prefix').'_metadata'.self::SEPARATOR.$key, array('lastModified' => time(), 'timeout' => time() + $lifetime), false, time() + $lifetime);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/sfSQLiteCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function clean($mode = sfCache::ALL)
{
$res = $this->dbh->exec("DELETE FROM cache".(sfCache::OLD == $mode ? sprintf(" WHERE timeout < '%s'", time()) : ''));

if ($res);
if ($res)
{
return (boolean) $this->dbh->changes();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/command/sfAnsiColorFormatter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function formatSection($section, $text, $size = null, $style = 'INFO')
$style = array_key_exists($style, $this->styles) ? $style : 'INFO';
$width = 9 + strlen($this->format('', $style));

return sprintf(">> %-{$width}s %s", $this->format($section, $style), $this->excerpt($text, $size - 4 - (strlen($section) > 9 ? strlen($section) : 9)));
return sprintf(">> %-${width}s %s", $this->format($section, $style), $this->excerpt($text, $size - 4 - (strlen($section) > 9 ? strlen($section) : 9)));
}

/**
Expand Down
10 changes: 4 additions & 6 deletions lib/config/sfConfigCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,13 @@ protected function loadConfigHandlers()
protected function writeCacheFile($config, $cache, $data)
{
$current_umask = umask(0000);
if (!is_dir(dirname($cache)))
$cacheDir = dirname($cache);
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir))
{
if (false === @mkdir(dirname($cache), 0777, true))
{
throw new sfCacheException(sprintf('Failed to make cache directory "%s" while generating cache for configuration file "%s".', dirname($cache), $config));
}
throw new \sfCacheException(sprintf('Failed to make cache directory "%s" while generating cache for configuration file "%s".', $cacheDir, $config));
}

$tmpFile = tempnam(dirname($cache), basename($cache));
$tmpFile = tempnam($cacheDir, basename($cache));

if (!$fp = @fopen($tmpFile, 'wb'))
{
Expand Down
1 change: 1 addition & 0 deletions lib/config/sfViewConfigHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private function addAssets($type, $assets){
$position = '';
if (is_array($asset))
{
reset($asset);
$key = key($asset);
$options = $asset[$key];
if (isset($options['position']))
Expand Down
2 changes: 1 addition & 1 deletion lib/controller/sfWebController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function convertUrlStringToParameters($url)
}

// routeName?
if ($url[0] == '@')
if ($url && $url[0] == '@')
{
$route = substr($url, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/database/sfPDODatabase.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function connect()
$password = $this->getParameter('password');
$persistent = $this->getParameter('persistent');

$options = ($persistent) ? array(PDO::ATTR_PERSISTENT => true) : array();
$options = $persistent ? array(PDO::ATTR_PERSISTENT => true) : array();

$this->connection = new $pdo_class($dsn, $username, $password, $options);

Expand Down
2 changes: 1 addition & 1 deletion lib/debug/sfWebDebugPanelMemory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class sfWebDebugPanelMemory extends sfWebDebugPanel
{
public function getTitle()
{
$totalMemory = sprintf('%.1f', (memory_get_peak_usage(true) / 1024));
$totalMemory = sprintf('%.1f', memory_get_peak_usage(true) / 1024);

return '<img src="'.$this->webDebug->getOption('image_root_path').'/memory.png" alt="Memory" /> '.$totalMemory.' KB';
}
Expand Down
6 changes: 4 additions & 2 deletions lib/form/sfForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ public function setValidators(array $validators)
*/
public function setValidator($name, sfValidatorBase $validator)
{
if (isset($this->embeddedForms[$name])) {
if (isset($this->embeddedForms[$name]))
{
throw new LogicException('You cannot set a validator for an embedded form.');
}

Expand All @@ -635,7 +636,8 @@ public function getValidator($name)
throw new InvalidArgumentException(sprintf('The validator "%s" does not exist.', $name));
}

if (isset($this->embeddedForms[$name])) {
if (isset($this->embeddedForms[$name]))
{
return $this->embeddedForms[$name]->getValidatorSchema();
}

Expand Down
7 changes: 4 additions & 3 deletions lib/generator/sfGeneratorManager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ public function save($path, $content)
{
$path = $this->getBasePath().DIRECTORY_SEPARATOR.$path;

if (!is_dir(dirname($path)))
$cacheDir = dirname($path);
if (!is_dir($cacheDir))
{
$current_umask = umask(0000);
if (false === @mkdir(dirname($path), 0777, true))
if (!@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir))
{
throw new sfCacheException(sprintf('Failed to make cache directory "%s".', dirname($path)));
throw new \sfCacheException(sprintf('Failed to make cache directory "%s".', $cacheDir));
}
umask($current_umask);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/helper/AssetHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ function image_tag($source, $options = array())

if (isset($options['size']))
{
list($options['width'], $options['height']) = explode('x', $options['size'], 2);
list($width, $height) = explode('x', $options['size'], 2);
$options['height'] = $height;
$options['width'] = $width;
unset($options['size']);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/helper/TagHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function tag($name, $options = array(), $open = false)
return '';
}

return '<'.$name._tag_options($options).(($open) ? '>' : ' />');
return '<'.$name._tag_options($options).($open ? '>' : ' />');
}

function content_tag($name, $content = '', $options = array())
Expand Down
4 changes: 2 additions & 2 deletions lib/helper/TextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function truncate_text($text, $length = 30, $truncate_string = '...', $truncate_
$old_encoding = mb_internal_encoding();
@mb_internal_encoding(mb_detect_encoding($text));
}
$strlen = ($mbstring) ? 'mb_strlen' : 'strlen';
$substr = ($mbstring) ? 'mb_substr' : 'substr';
$strlen = $mbstring ? 'mb_strlen' : 'strlen';
$substr = $mbstring ? 'mb_substr' : 'substr';

if ($strlen($text) > $length)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function link_to1($name, $internal_uri, $options = array())
}
}

if (!strlen($name))
if ('' === $name)
{
$name = $html_options['href'];
}
Expand Down
7 changes: 1 addition & 6 deletions lib/i18n/sfChoiceFormat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,7 @@ public function isValid($number, $set)
$right = $number < $elements[$total - 1];
}

if ($left && $right)
{
return true;
}

return false;
return $left && $right;
}

protected function isValidSetNotation($number, $set)
Expand Down
Loading