Skip to content

Commit

Permalink
Merge pull request #14336 from ruudboon/4.0.x
Browse files Browse the repository at this point in the history
Fixed issue #14265
  • Loading branch information
sergeyklay authored Aug 27, 2019
2 parents 30d85ac + b6132ee commit 8ed84b0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed `Phalcon\Cache\InvalidArgumentException` to extend Phalcon\Exception
- Fixed `Phalcon\Collection\Exception` to extend Phalcon\Exception
- Fixed `Phalcon\Storage\Adapter\AbstractAdapter::initSerializer` to throw exception if `null === $this->serializerFactory && null === $this->serializer` [#14324](https://github.com/phalcon/cphalcon/issues/14324)
- Fixed `Phalcon\Session\Adapter\Stream` to not override configured save path [#14265](https://github.com/phalcon/cphalcon/issues/14265)

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

Expand Down
13 changes: 5 additions & 8 deletions phalcon/Session/Adapter/Stream.zep
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,13 @@ class Stream extends Noop
return true;
}

/**
* Ignore the savePath and use local defined path
*
* @return bool
*/
public function open(var savePath, var sessionName) -> bool
{
var path;

if true !== ends_with(savePath, "/") {
let path = savePath . "/";
}

let this->path = path;

return true;
}

Expand Down
25 changes: 25 additions & 0 deletions tests/integration/Session/Adapter/Stream/OpenCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use IntegrationTester;
use Phalcon\Test\Fixtures\Traits\DiTrait;
use Phalcon\Test\Fixtures\Traits\SessionTrait;
use Phalcon\Session\Manager;
use Phalcon\Session\Adapter\Stream;

class OpenCest
{
Expand Down Expand Up @@ -45,4 +47,27 @@ public function sessionAdapterStreamOpen(IntegrationTester $I)
)
);
}

/**
* Tests Phalcon\Session\Adapter\Stream :: open()
*
* @author Phalcon Team <[email protected]>
* @since 2019-08-06
*/
public function issue14265(IntegrationTester $I)
{
$I->wantToTest('Session\Adapter\Stream - open() for issue 14265');
$session = new Manager();
$stream = new Stream(getOptionsSessionStream());
$session->setHandler($stream);
$I->assertTrue(
$session->start()
);
$value = uniqid();
$stream->write('test1', $value);
$I->amInPath(cacheDir('sessions'));
$I->seeFileFound('test1');
$I->seeInThisFile($value);
$I->safeDeleteFile(cacheDir('sessions/test1'));
}
}

0 comments on commit 8ed84b0

Please sign in to comment.