Merge branch '2.8' into 3.4

* 2.8:
  [HttpKernel] fix test compat with PHP 5.3
  fix file lock on SunOS
  change `evaluate()` docblock return type from string to mixed
  Set serialize_precision explicitly to avoid fancy float rounding
This commit is contained in:
Nicolas Grekas 2018-06-21 13:09:30 +02:00
commit 7090495250
3 changed files with 13 additions and 4 deletions

View File

@ -71,7 +71,7 @@ class ExpressionLanguage
* @param Expression|string $expression The expression to compile
* @param array $values An array of values
*
* @return string The result of the evaluation of the expression
* @return mixed The result of the evaluation of the expression
*/
public function evaluate($expression, $values = array())
{

View File

@ -81,12 +81,12 @@ class LockHandler
$error = $msg;
});
if (!$this->handle = fopen($this->file, 'r')) {
if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
if ($this->handle = fopen($this->file, 'x')) {
chmod($this->file, 0444);
} elseif (!$this->handle = fopen($this->file, 'r')) {
} elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
usleep(100); // Give some time for chmod() to complete
$this->handle = fopen($this->file, 'r');
$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
}
}
restore_error_handler();

View File

@ -16,6 +16,15 @@ use Symfony\Component\HttpFoundation\JsonResponse;
class JsonResponseTest extends TestCase
{
protected function setUp()
{
parent::setUp();
if (!defined('HHVM_VERSION')) {
$this->iniSet('serialize_precision', 14);
}
}
public function testConstructorEmptyCreatesJsonObject()
{
$response = new JsonResponse();