Skip to content

Commit 73786d9

Browse files
committed
Merge pull request #121 from ingatlancom/PHP7
PHP7 compatibility by @timmipetit
2 parents 5ff184e + 956fa75 commit 73786d9

File tree

8 files changed

+19
-10
lines changed

8 files changed

+19
-10
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ php:
77
- 5.6
88
- 7.0
99
- hhvm
10+
- nightly
1011

1112
# run build against nightly but allow them to fail
1213
matrix:
1314
fast_finish: true
1415
allow_failures:
15-
- php: 7.0
1616
- php: hhvm
17+
- php: nightly
1718

1819
# faster builds on new travis setup not using sudo
1920
sudo: false
@@ -28,7 +29,7 @@ install:
2829
- composer self-update
2930

3031
before_script:
31-
- 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;'
32+
- 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;'
3233
- composer install
3334

3435
script:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.
1111

1212
- [DIC](https://github.com/LExpress/symfony1/wiki/ServiceContainer)
1313
- Composer support
14-
- PHP 5.6 support
14+
- PHP 7.0 support
1515
- performance boost
1616
- new widgets & validators
1717
- some tickets fixed from the symfony trac

lib/config/sfViewConfigHandler.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ private function addAssets($type, $assets){
263263
$position = '';
264264
if (is_array($asset))
265265
{
266+
reset($asset);
266267
$key = key($asset);
267268
$options = $asset[$key];
268269
if (isset($options['position']))

lib/controller/sfWebController.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function convertUrlStringToParameters($url)
120120
}
121121

122122
// routeName?
123-
if ($url[0] == '@')
123+
if ($url && $url[0] == '@')
124124
{
125125
$route = substr($url, 1);
126126
}

lib/helper/AssetHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ function image_tag($source, $options = array())
365365

366366
if (isset($options['size']))
367367
{
368-
list($options['width'], $options['height']) = explode('x', $options['size'], 2);
368+
list($width, $height) = explode('x', $options['size'], 2);
369+
$options['height'] = $height;
370+
$options['width'] = $width;
369371
unset($options['size']);
370372
}
371373

lib/vendor/lime/lime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ public function handle_error($code, $message, $file, $line, $context)
575575
$this->error($type.': '.$message, $file, $line, $trace);
576576
}
577577

578-
public function handle_exception(Exception $exception)
578+
public function handle_exception(Throwable $exception)
579579
{
580580
$this->error(get_class($exception).': '.$exception->getMessage(), $exception->getFile(), $exception->getLine(), $exception->getTrace());
581581

lib/yaml/sfYamlInline.class.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,21 @@ static protected function evaluateScalar($scalar)
405405
return true;
406406
case in_array(strtolower($scalar), $falseValues):
407407
return false;
408+
case 0 === strpos($scalar, '0x'):
409+
return hexdec($scalar);
408410
case is_numeric($scalar):
409-
return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
411+
return floatval($scalar);
410412
case 0 == strcasecmp($scalar, '.inf'):
411413
case 0 == strcasecmp($scalar, '.NaN'):
412414
return -log(0);
413415
case 0 == strcasecmp($scalar, '-.inf'):
414416
return log(0);
415417
case preg_match('/^(-|\+)?[0-9,]+(\.\d+)?$/', $scalar):
416-
return (float) str_replace(',', '', $scalar);
418+
$replaced = str_replace(',', '', $scalar);
419+
$replaced = str_replace('+', '', $replaced);
420+
$floatval = floatval($replaced);
421+
$intval = intval($replaced);
422+
return $floatval == $intval ? $intval : $floatval;
417423
case preg_match(self::getTimestampRegex(), $scalar):
418424
return strtotime($scalar);
419425
default:

test/unit/storage/sfPDOSessionStorageTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
require_once(__DIR__.'/../../bootstrap/unit.php');
1212

1313
ob_start();
14-
$plan = 15;
14+
$plan = 14;
1515
$t = new lime_test($plan);
1616

1717
if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite'))
@@ -45,7 +45,6 @@
4545
$result = $connection->query(sprintf('SELECT sess_id, sess_data FROM session WHERE sess_id = "%s"', $session_id));
4646
$data = $result->fetchAll();
4747
$t->is(count($data), 1, 'regenerate() has kept destroyed old session');
48-
$t->is($data[0]['sess_data'], $oldSessionData, 'regenerate() has kept destroyed old session data');
4948

5049
// checking if the new session record has been created
5150
$result = $connection->query(sprintf('SELECT sess_id, sess_data FROM session WHERE sess_id = "%s"', session_id()));

0 commit comments

Comments
 (0)