Skip to content
Permalink
Browse files

Fix EZP-24135: Output buffer gets cleared after legacy call

Moved hasInstance() method from \eZ\Publish\Core\MVC\Legacy\Kernel to ezpKernel
Use hasInstance() in eZScript
Use hasInstance() in Kernel::instance()
CS fix in Kernel::instance()
  • Loading branch information...
glye committed Mar 18, 2015
1 parent 61a1831 commit 97d6a72390fcf8b186326685ed2eacf9c0c200b2
Showing with 19 additions and 5 deletions.
  1. +5 −2 kernel/classes/ezscript.php
  2. +14 −3 kernel/private/classes/ezpkernel.php
@@ -235,8 +235,11 @@ function startup()
*/
function initialize()
{
if( ob_get_length() != 0 )
ob_end_clean();
if ( !ezpKernel::hasInstance() )
{
if ( ob_get_length() != 0 )
ob_end_clean();
}
// Initialize text codec settings
$this->updateTextCodecSettings();
@@ -119,6 +119,16 @@ public function getServiceContainer()
return $this->kernelHandler->getServiceContainer();
}
/**
* Checks if the kernel has already been instantiated.
*
* @return bool
*/
public static function hasInstance()
{
return self::$instance !== null;
}
/**
* Returns the current instance of ezpKernel.
*
@@ -127,14 +137,15 @@ public function getServiceContainer()
*/
public static function instance()
{
if ( self::$instance === null )
if ( !self::hasInstance() )
{
throw new LogicException(
'Cannot return the instance of '
. __CLASS__
. ', it has not been instantiated'
. __CLASS__
. ', it has not been instantiated'
);
}
return self::$instance;
}
}

0 comments on commit 97d6a72

Please sign in to comment.
You can’t perform that action at this time.