Browse Source

Merge pull request #7782 from dakota/phpdbg

Consider a SAPI of phpdbg to be the same as cli.
José Lorenzo Rodríguez 10 years ago
parent
commit
f24c4dd3b3

+ 1 - 1
src/Cache/Engine/XcacheEngine.php

@@ -58,7 +58,7 @@ class XcacheEngine extends CacheEngine
      */
     public function init(array $config = [])
     {
-        if (PHP_SAPI === 'cli' || !extension_loaded('xcache')) {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') || !extension_loaded('xcache')) {
             return false;
         }
 

+ 1 - 1
src/Error/BaseErrorHandler.php

@@ -69,7 +69,7 @@ abstract class BaseErrorHandler
         set_error_handler([$this, 'handleError'], $level);
         set_exception_handler([$this, 'wrapAndHandleException']);
         register_shutdown_function(function () {
-            if (PHP_SAPI === 'cli') {
+            if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
                 return;
             }
             $error = error_get_last();

+ 1 - 1
src/Network/Session.php

@@ -219,7 +219,7 @@ class Session
         }
 
         $this->_lifetime = ini_get('session.gc_maxlifetime');
-        $this->_isCLI = PHP_SAPI === 'cli';
+        $this->_isCLI = (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg');
         session_register_shutdown();
     }
 

+ 2 - 2
src/basics.php

@@ -73,7 +73,7 @@ HTML;
 
 TEXT;
         $template = $html;
-        if (PHP_SAPI === 'cli' || $showHtml === false) {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') || $showHtml === false) {
             $template = $text;
             if ($showFrom) {
                 $lineInfo = sprintf('%s (line %s)', $file, $line);
@@ -157,7 +157,7 @@ if (!function_exists('breakpoint')) {
      */
     function breakpoint()
     {
-        if (PHP_SAPI === 'cli' && class_exists('\Psy\Shell')) {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && class_exists('\Psy\Shell')) {
             return 'extract(\Psy\Shell::debug(get_defined_vars(), isset($this) ? $this : null));';
         }
         trigger_error(

+ 2 - 2
tests/TestCase/BasicsTest.php

@@ -301,7 +301,7 @@ EXPECTED;
 ###########################
 
 EXPECTED;
-        if (PHP_SAPI === 'cli') {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
             $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18);
         } else {
             $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19);
@@ -326,7 +326,7 @@ EXPECTED;
 ###########################
 
 EXPECTED;
-        if (PHP_SAPI === 'cli') {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
             $expected = sprintf($expectedText, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 18);
         } else {
             $expected = sprintf($expectedHtml, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 19);

+ 1 - 1
tests/TestCase/Cache/Engine/ApcEngineTest.php

@@ -36,7 +36,7 @@ class ApcEngineTest extends TestCase
         parent::setUp();
         $this->skipIf(!function_exists('apc_store'), 'Apc is not installed or configured properly.');
 
-        if (PHP_SAPI === 'cli') {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
             $this->skipIf(!ini_get('apc.enable_cli'), 'APC is not enabled for the CLI.');
         }
 

+ 1 - 1
tests/TestCase/Cache/Engine/XcacheEngineTest.php

@@ -35,7 +35,7 @@ class XcacheEngineTest extends TestCase
     public function setUp()
     {
         parent::setUp();
-        if (PHP_SAPI === 'cli') {
+        if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
             $this->markTestSkipped('Xcache is not available for the CLI.');
         }
         if (!function_exists('xcache_set')) {