Skip to content

Commit

Permalink
Merge pull request #807 from phalcon/3.2.x
Browse files Browse the repository at this point in the history
3.2.2
  • Loading branch information
sergeyklay authored Jul 31, 2017
2 parents 2bdb6fc + ff05361 commit 52766a4
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ env:
- ZEND_DONT_UNLOAD_MODULES=1
- CC="ccache gcc"
- PATH="$PATH:~/bin"
- PHALCON_VERSION="v3.2.0"
- PHALCON_VERSION="v3.2.1"

before_install:
- export PHP_MAJOR="$(echo $TRAVIS_PHP_VERSION | cut -d '.' -f 1)"
Expand Down
4 changes: 2 additions & 2 deletions Library/Phalcon/Acl/Factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To setup `acl` service in DI `service.php` file using `acl.ini` file:
use Phalcon\Config\Adapter\Ini as ConfigIni;
use Phalcon\Acl\Factory\Memory as AclMemory;

$di->setShaerd(
$di->setShared(
'acl'
function () {
$config = new ConfigIni(APP_PATH . '/config/acl.ini');
Expand All @@ -33,7 +33,7 @@ To setup `acl` service in DI `service.php` file using `acl.php` (array) file:
use Phalcon\Config;
use Phalcon\Acl\Factory\Memory as AclMemory;

$di->setShaerd(
$di->setShared(
'acl'
function () {
$config = new Config(APP_PATH . '/config/acl.php');
Expand Down
10 changes: 9 additions & 1 deletion Library/Phalcon/Mailer/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,15 @@ protected function getView()
$view = $this->getDI()->get('\Phalcon\Mvc\View\Simple');
$view->setViewsDir($viewsDir);

if ($engines = $viewApp->getRegisteredEngines()) {
if ($registeredEngines = $viewApp->getRegisteredEngines()) {
$engines = [];
foreach ($registeredEngines as $key => $engine) {
if (is_object($engine)) {
$engines[$key] = get_class($engine);
} else {
$engines[$key] = $engine;
}
}
$view->registerEngines($engines);
}

Expand Down
12 changes: 10 additions & 2 deletions Library/Phalcon/Mvc/View/Engine/Twig/CoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ public function getFunctions()
];

return [
'assetsOutputCss' => new \Twig_Function_Method($this, 'functionAssetsOutputCss', $options),
'assetsOutputJs' => new \Twig_Function_Method($this, 'functionAssetsOutputJs', $options),
'assetsOutputCss' => new \Twig_SimpleFunction(
'assetsOutputCss',
[$this, 'functionAssetsOutputCss'],
$options
),
'assetsOutputJs' => new \Twig_SimpleFunction(
'assetsOutputJs',
[$this, 'functionAssetsOutputJs'],
$options
)
];
}

Expand Down
6 changes: 4 additions & 2 deletions Library/Phalcon/Session/Adapter/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Phalcon\Session\AdapterInterface;
use Phalcon\Session\Exception;
use Phalcon\Db\AdapterInterface as DbAdapter;
use Phalcon\Db\Column;

/**
* Phalcon\Session\Adapter\Database
Expand Down Expand Up @@ -121,7 +122,8 @@ public function read($sessionId)
$maxLifetime
),
Db::FETCH_NUM,
[$sessionId, time()]
[$sessionId, time()],
[Column::BIND_PARAM_STR, Column::BIND_PARAM_INT]
);

if (empty($row)) {
Expand Down Expand Up @@ -151,7 +153,7 @@ public function write($sessionId, $data)
[$sessionId]
);

if (!empty($row) && intval($row[0]) > 0) {
if ($row[0] > 0) {
return $this->connection->execute(
sprintf(
'UPDATE %s SET %s = ?, %s = ? WHERE %s = ?',
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"codeception/specify": "^0.4",
"codeception/verify": "^0.3",
"vlucas/phpdotenv": "^2.4",
"phalcon/dd": "^1.1"
"phalcon/dd": "^1.1",
"doctrine/instantiator": "1.0.5"
},
"suggest": {
"ext-aerospike": "*",
Expand All @@ -64,7 +65,8 @@
"Phalcon\\Test\\Behavior\\Blameable\\": "tests/_data/behavior/blameable",
"Phalcon\\Test\\Aerospike\\": "tests/aerospike/",
"Phalcon\\Test\\Unit5x\\": "tests/unit5x/",
"Phalcon\\Test\\Collections\\": "tests/_data/collections"
"Phalcon\\Test\\Collections\\": "tests/_data/collections",
"Phalcon\\Test\\Module\\": "tests/_support/Module"
},
"files": [
"tests/_support/functions.php"
Expand Down
11 changes: 11 additions & 0 deletions tests/_data/dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1252,13 +1252,15 @@ CREATE TABLE `cache_data` (
`lifetime` INT,
PRIMARY KEY(`key_name`)
);

DROP TABLE IF EXISTS `robots`;
CREATE TABLE `robots` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(32) COLLATE utf8_unicode_ci NOT NULL default 'mechanical',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE if EXISTS `audit`;
CREATE TABLE `audit` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
Expand All @@ -1270,6 +1272,7 @@ CREATE TABLE `audit` (
`primary_key` TEXT DEFAULT NULL, /* for BC reasons */
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE if EXISTS `audit_detail`;
CREATE TABLE `audit_detail` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
Expand All @@ -1279,3 +1282,11 @@ CREATE TABLE `audit_detail` (
`new_value` TEXT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE if EXISTS `session`;
CREATE TABLE `sessions` (
session_id TEXT NOT NULL,
data TEXT,
created_at INT,
modified_at INT
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
28 changes: 28 additions & 0 deletions tests/_support/Helper/Session/Dialect/DatabaseTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Helper\Session\Dialect;

/**
* Helper\Session\Dialect\DatabaseTrait
*
* @copyright (c) 2011-2017 Phalcon Team
* @link https://phalconphp.com
* @author Sergii Svyrydenko <[email protected]>
* @package Helper\Session\Dialect
*
* The contents of this file are subject to the New BSD License that is
* bundled with this package in the file LICENSE.txt
*
* If you did not receive a copy of the license and are unable to obtain it
* through the world-wide-web, please send an email to [email protected]
* so that we can send you a copy immediately.
*/
trait DatabaseTrait
{
protected function getWrittenSessionData($sessionID)
{
$sql = "DELETE FROM sessions WHERE session_id = '{$sessionID}'";

return $sql;
}
}
27 changes: 27 additions & 0 deletions tests/_support/Helper/Session/Dialect/ModelSession.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Helper\Session\Dialect;

/**
* Helper\Session\Dialect\ModelSession
*
* @copyright (c) 2011-2017 Phalcon Team
* @link https://phalconphp.com
* @author Sergii Svyrydenko <[email protected]>
* @package Helper\Session\Dialect
*
* The contents of this file are subject to the New BSD License that is
* bundled with this package in the file LICENSE.txt
*
* If you did not receive a copy of the license and are unable to obtain it
* through the world-wide-web, please send an email to [email protected]
* so that we can send you a copy immediately.
*/

use Phalcon\Mvc\Model;
use Phalcon\Mvc\ModelInterface;

class ModelSession extends Model
{
public static $table = 'sessions';
}
36 changes: 36 additions & 0 deletions tests/_support/Module/UnitTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Phalcon\Test\Module;

use UnitTester;
use Codeception\Specify;
use Codeception\Test\Unit;
use PHPUnit_Runner_Version;

/**
* \Phalcon\Test\Module\UnitTest
* Base class for all Unit tests
*
* @copyright (c) 2011-2017 Phalcon Team
* @link http://www.phalconphp.com
* @author Andres Gutierrez <[email protected]>
* @author Nikolaos Dimopoulos <[email protected]>
* @package Phalcon\Test\Module
*
* The contents of this file are subject to the New BSD License that is
* bundled with this package in the file LICENSE.txt
*
* If you did not receive a copy of the license and are unable to obtain it
* through the world-wide-web, please send an email to [email protected]
* so that we can send you a copy immediately.
*/
class UnitTest extends Unit
{
use Specify;

/**
* UnitTester Object
* @var UnitTester
*/
protected $tester;
}
Loading

0 comments on commit 52766a4

Please sign in to comment.