Skip to content

Commit aeab393

Browse files
authored
Merge pull request #1359 from phalcon/v4-bug-fixes
V4 Bug Fixes
2 parents a6c78b8 + 25ad77e commit aeab393

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

src/Bootstrap.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ public function __construct(array $parameters = [])
182182
$this->initFromConstants();
183183
$this->setParameters($parameters);
184184

185-
$this->di = new FactoryDefault;
186185
$this->app = new MvcApplication;
186+
$this->di = new FactoryDefault;
187+
$this->di->setShared('application', $this);
187188

188189
(new ErrorHandler)->register();
189190

@@ -194,8 +195,6 @@ public function __construct(array $parameters = [])
194195
}
195196

196197
$this->app->setEventsManager($this->di->getShared('eventsManager'));
197-
198-
$this->di->setShared('application', $this->app);
199198
$this->app->setDI($this->di);
200199

201200
Di::setDefault($this->di);

src/Providers/AccessManagerProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AccessManagerProvider implements ServiceProviderInterface
3131
*/
3232
public function register(DiInterface $di): void
3333
{
34-
$ptoolsIp = $di->getShared('application')->ptoolsIp;
34+
$ptoolsIp = $di->getShared('application')->getPtoolsIp();
3535

3636
$di->setShared($this->providerName, function () use ($ptoolsIp) {
3737
$policy = new IpPolicy($ptoolsIp);

src/Providers/ConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ConfigProvider implements ServiceProviderInterface
3131
*/
3232
public function register(DiInterface $di): void
3333
{
34-
$basePath = $di->getShared('application')->basePath;
34+
$basePath = $di->getShared('application')->getBasePath();
3535
$di->setShared($this->providerName, function () use ($basePath) {
3636
$scanner = new ConfigScanner($basePath);
3737
$config = $scanner->load('config');

src/Providers/LoggerProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class LoggerProvider implements ServiceProviderInterface
3434
public function register(DiInterface $di): void
3535
{
3636
$application = $di->getShared('application');
37-
$hostName = $application->hostName;
38-
$basePath = $application->basePath;
37+
$hostName = $application->getHostName();
38+
$basePath = $application->getBasePath();
3939

4040
$di->setShared($this->providerName, function () use ($hostName, $basePath) {
4141
$ptoolsPath = $basePath . DS . '.phalcon' . DS;

src/Providers/RouterProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function register(DiInterface $di): void
3939

4040
$router = new AnnotationsRouter(false);
4141
$router->removeExtraSlashes(true);
42+
$router->notFound(['controller' => 'error', 'action' => 'route404']);
4243
$router->setDefaultAction('index');
4344
$router->setDefaultController('index');
4445
$router->setDefaultNamespace('Phalcon\DevTools\Web\Tools\Controllers');
@@ -63,7 +64,6 @@ public function register(DiInterface $di): void
6364
}
6465

6566
$router->setEventsManager($em);
66-
$router->notFound(['controller' => 'error', 'action' => 'route404']);
6767

6868
return $router;
6969
});

src/Providers/VoltProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class VoltProvider implements ServiceProviderInterface
3838
public function register(DiInterface $di): void
3939
{
4040
$this->di = $di;
41-
$basePath = $di->getShared('application')->basePath;
42-
$ptoolsPath = $di->getShared('application')->ptoolsPath;
41+
$basePath = $di->getShared('application')->getBasePath();
42+
$ptoolsPath = $di->getShared('application')->getPtoolsPath();
4343
$that = $this;
4444

4545
$di->setShared($this->providerName, function ($view, $di) use ($basePath, $ptoolsPath, $that) {

0 commit comments

Comments
 (0)