In #2206263: drupal_is_cli() returns FALSE on PHP CLI we removed most logic of drupal_is_cli().
In #2228341: Objectify session management functions + remove session.inc SessionManager duplicated its one line logic, to keep it unit-testable.

It has no value anymore, we should just check PHP_SAPI directly.
One less drupal_* function to learn

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.17 KB
ParisLiakos’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 1: drupal-is_cli-2294161-1.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
2.16 KB

-.-

sun’s picture

Status: Needs review » Reviewed & tested by the community

Awesome.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 8074550 and pushed to 8.x. Thanks!

  • alexpott committed 8074550 on 8.x
    Issue #2294161 by ParisLiakos: Deprecate and remove usages of...
chx’s picture

Status: Fixed » Active

That was great... except now we can't implement phpdbg support in drupal_is_cli() because there's no API function to fix.

chx’s picture

alexpott asked for clarification. phpdbg is a php debugger that has been included in PHP 5.6. https://wiki.php.net/rfc/phpdbg

Like CLI, and gdb, phpdbg is an executable intended to be executed at the terminal in an interactive way.

the way to support it is PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' but now there's no place to put this.

ParisLiakos’s picture

i do not see why we should specialcase for phpdbg.
Did you try something on it and it didnt work?
If there is an issue with phpdbg support, and we need to add checks like that, then an issue should be opened, which adds a method to the Enviroment component.
Keeping drupal_is_cli() around just in case we might need it, is something i disagree with

chx’s picture

Status: Active » Fixed

w/e

jbrown’s picture

The change record is not correct - drupal_is_cli() hasn't been deprecated, it has been removed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

fubhy’s picture

Sorry, but why exactly was this issue closed? It's impossible currently to run the Drupal testsuite with phpdbg. Checking just for 'cli' is simply wrong if we want to support phpdbg and I am pretty sure we want that.

cilefen’s picture

It was closed for having met its goals at the time.

cilefen’s picture

Plus it's been closed so long, your follow up issue is fine.