diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 7f8b179..912a6f0 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -405,7 +405,7 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
   }
 
   return $allow_caching_static && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')
-    && !drupal_is_cli();
+    && PHP_SAPI !== 'cli';
 }
 
 /**
@@ -1728,6 +1728,9 @@ function drupal_static_reset($name = NULL) {
 
 /**
  * Detects whether the current script is running in a command-line environment.
+ *
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
+ *   Check the PHP_SAPI value directly instead.
  */
 function drupal_is_cli() {
   return PHP_SAPI === 'cli';
diff --git a/core/includes/errors.inc b/core/includes/errors.inc
index ead20d4..992ffaa 100644
--- a/core/includes/errors.inc
+++ b/core/includes/errors.inc
@@ -158,7 +158,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
 
   \Drupal::logger('php')->log($error['severity_level'], '%type: !message in %function (line %line of %file).', $error);
 
-  if (drupal_is_cli()) {
+  if (PHP_SAPI === 'cli') {
     if ($fatal) {
       // When called from CLI, simply output a plain text message.
       // Should not translate the string to avoid errors producing more errors.
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 49a4d02..57a11f8 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -211,7 +211,7 @@ public static function createFromRequest(Request $request, ClassLoader $class_lo
     // Redirect the user to the installation script if Drupal has not been
     // installed yet (i.e., if no $databases array has been defined in the
     // settings.php file) and we are not already installing.
-    if (!Database::getConnectionInfo() && !drupal_installation_attempted() && !drupal_is_cli()) {
+    if (!Database::getConnectionInfo() && !drupal_installation_attempted() && PHP_SAPI !== 'cli') {
       $response = new RedirectResponse($request->getBasePath() . '/core/install.php');
       $response->prepare($request)->send();
     }
