Skip to content

Commit

Permalink
Merge pull request #14315 from ZhangRuiMingZRM/fixed-issue-14314
Browse files Browse the repository at this point in the history
Fixed issue 14314
  • Loading branch information
sergeyklay authored Aug 20, 2019
2 parents 2f55dc5 + d64931a commit e0badaf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Fixed
- Fixed `Phalcon\Helper\Str::includes` to return correct result [#14301](https://github.com/phalcon/cphalcon/issues/14301)
- Fixed `Phalcon\Logger` moved to correct namespace [#14263](https://github.com/phalcon/cphalcon/issues/14263)
- Fixed `Phalcon\Session\Adapter\AbstractAdapter::read()` to return ""(empty string) when `Session/Adapter/*::get()` returns null [#14314](https://github.com/phalcon/cphalcon/issues/14314)

# [4.0.0-beta.2](https://github.com/phalcon/cphalcon/releases/tag/v4.0.0-beta.2) (2019-08-18)

Expand Down
5 changes: 4 additions & 1 deletion phalcon/Session/Adapter/AbstractAdapter.zep
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ abstract class AbstractAdapter implements SessionHandlerInterface
*/
public function read(var id) -> string
{
return this->adapter->get(id);
var data;
let data = this->adapter->get(id);

return null === data ? "" : data;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/Session/Adapter/Libmemcached/ReadCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ public function sessionAdapterLibmemcachedRead(IntegrationTester $I)
);

$I->removeFromLibmemcached('sess-memc-test1');

$I->assertNotNull(
$adapter->read('test1')
);
}
}
8 changes: 6 additions & 2 deletions tests/integration/Session/Adapter/Redis/ReadCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public function _before(IntegrationTester $I)
}

/**
* Tests Phalcon\Session\Adapter\Redis :: write()
* Tests Phalcon\Session\Adapter\Redis :: read()
*
* @author Phalcon Team <team@phalconphp.com>
* @since 2018-11-13
*/
public function sessionAdapterRedisRead(IntegrationTester $I)
{
$I->wantToTest('Session\Adapter\Redis - write()');
$I->wantToTest('Session\Adapter\Redis - read()');
$adapter = $this->getSessionRedis();
$value = uniqid();

Expand All @@ -45,5 +45,9 @@ public function sessionAdapterRedisRead(IntegrationTester $I)
$actual = $adapter->read('test1');
$I->assertEquals($expected, $actual);
$I->sendCommandToRedis('del', 'sess-reds-test1');

$I->assertNotNull(
$adapter->read('test1')
);
}
}

0 comments on commit e0badaf

Please sign in to comment.