Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: PHP7.2, PHALCON 4.0.2, $this->cache->getKeys(), Use error reporting in the controller #14714

Closed
as882301 opened this issue Jan 16, 2020 · 10 comments
Labels
bug A bug report status: unverified Unverified

Comments

@as882301
Copy link

public function indexAction()
{
$aa = $this->cache->getKeys();
var_dump($aa);
die();
}
Use error reporting in the controller

@as882301 as882301 added bug A bug report status: unverified Unverified labels Jan 16, 2020
@ruudboon
Copy link
Member

Can you explain a bit more what the issue is?

@as882301
Copy link
Author

Can you explain a bit more what the issue is?
--DI
$di->set('cache', function () {
$config = $this->getConfig();
$cacheConfig = $config->cache;
if ($cacheConfig->adapter == 'Stream') {
if (empty($dir = $cacheConfig->options->storageDir)) {
throw new \Exception('缓存目录不能为空');
}
$dir = Common::dirFormat($dir);
$mkdirRes = Common::mkdir($dir);
if (!$mkdirRes) {
throw new \Exception('创建目录 ' . $dir . ' 失败');
}
}
$options = $cacheConfig->options->toArray();
$adapterClassName = 'Phalcon\Cache\Adapter\' . Text::camelize($cacheConfig->adapter);
$serializerFactory = new SerializerFactory();
$cache = new $adapterClassName($serializerFactory, $options);
return $cache;
});

--CONFIG
'cache' => [
'adapter' => 'Stream',
'options' => [
'lifetime' => 7200,
'storageDir' => BASE_PATH . RUNTIME .'/cache/file/admin/',
'defaultSerializer' => 'Json',
'safekey' => false,
'prefix' => ''
]
],

--CONTROLLER
public function indexAction()
{
$aa = $this->cache->getKeys();
var_dump($aa);
die();
}

--ERROR
Warning: Invalid arguments supplied for str_replace() in controllers\IndexController.php on line 14

@ruudboon
Copy link
Member

Thank you. We will investigate this.

@ruudboon ruudboon added the 4.0.3 label Jan 16, 2020
@as882301
Copy link
Author

Thank you. We will investigate this.

Okay, thank you!

@duongkhoangiam
Copy link

i think problem getKeys need prefix.

@as882301
Copy link
Author

i think problem getKeys need prefix.

Thank you. But not for that reason. 3.4 uses the function querykeys(). If 4. X is changed to getkeys(), an error will be reported. This function does not need a prefix

@ekmst
Copy link
Contributor

ekmst commented Jan 17, 2020

@as882301
Some work has been done here #14721. But I was not able to reproduce this problem.
You can build Phalcon from source (4.0.x) and try again?

@as882301
Copy link
Author

@as882301
Some work has been done here #14721. But I was not able to reproduce this problem.
You can build Phalcon from source (4.0.x) and try again?

Sorry, I use windows 4.0.2 DLL

@ruudboon
Copy link
Member

ruudboon commented Jan 22, 2020

@as882301 Could you try picking a dll from AppVeyor https://ci.appveyor.com/project/sergeyklay/cphalcon
Choose your version and go to Artifacts.

Othewise I would like to close this issue and it can be re-opened if it still occurs in 4.0.3

@ruudboon
Copy link
Member

Gonna close then assuming it's fixed. If this this is still occurring after our 4.0.3 release please re-open.

@niden niden moved this to Unverified - Wont Fix - Duplicates in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: unverified Unverified
Projects
Archived in project
Development

No branches or pull requests

4 participants