I'm using PHP 7.2.0alpha2 where below command doesn't work, but it works in PHP 7.0.20.

And I've the following warnings when installing Drupal from scratch by drush quick-drupal, e.g.

$ drush qd
Project drupal (8.3.6) downloaded to drupal8/quick-drupal-20170812152339/drupal.     [success]
Project drupal contains:                                                                                 [success]
 - 1 profile: standard
 - 14 themes: stark, stable, seven, twig, classy, bartik, testing_multilingual_with_english,
testing_multilingual, testing_missing_dependencies, testing_config_overrides, testing_config_import,
drupal_system_listing_compatible_test, testing, minimal
 - 73 modules: workflows, views_ui, views, user, update, tracker, tour, toolbar, text, telephone,
taxonomy, system, syslog, statistics, simpletest, shortcut, serialization, search, rest,
responsive_image, rdf, quickedit, path, page_cache, outside_in, options, node, migrate_drupal_ui,
migrate_drupal, migrate, menu_ui, menu_link_content, locale, link, layout_discovery, language,
inline_form_errors, image, history, help, hal, forum, filter, file, field_ui, field_layout, field,
entity_reference, editor, dynamic_page_cache, dblog, datetime_range, datetime, contextual,
content_translation, content_moderation, contact, config_translation, config, comment, color, ckeditor,
breakpoint, book, block_place, block_content, block, big_pipe, basic_auth, ban, automated_cron,
aggregator, action

You are about to create a drupal8/quick-drupal-20170812152339/drupal/sites/default/settings.php file and CREATE the 'sites/default/files/quick-drupal-20170812152339.sqlite' database. Do you want to continue? (y/n): y
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time        [warning]
DrupalKernel.php:971
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time        [warning]
DrupalKernel.php:972
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time        [warning]
DrupalKernel.php:973
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time        [warning]
DrupalKernel.php:976
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time        [warning]
DrupalKernel.php:978
PHP Deprecated:  assert(): Calling assert() with a string argument is deprecated in drupal8/quick-drupal-20170812152339/drupal/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php on line 151

Code:

    // Use session cookies, not transparent sessions that puts the session id in
    // the query string.
    ini_set('session.use_cookies', '1');
    ini_set('session.use_only_cookies', '1');
    ini_set('session.use_trans_sid', '0');
    // Don't send HTTP headers using PHP's session handler.
    // Send an empty string to disable the cache limiter.
    ini_set('session.cache_limiter', '');
    // Use httponly session cookies.
    ini_set('session.cookie_httponly', '1');

Comments

kenorb created an issue. See original summary.

kenorb’s picture

Issue summary: View changes
kenorb’s picture

Issue tags: +PHP 7.2
kenorb’s picture

Title: DrupalKernel.php: ini_set(): Headers already sent » [PHP 7.2] DrupalKernel.php: ini_set(): Headers already sent
martin107’s picture

I am seeing this too.

For me on drush site-install

jibran’s picture

Version: 8.3.6 » 8.5.x-dev
Status: Active » Postponed (maintainer needs more info)

Can you please confirm the Drupal version?
As per https://www.drupal.org/core/release-cycle-overview

October 4, 2017 8.4.0 released. End-of-life for Drupal 8.3.x.

and then there is #2932574: Indicate Drupal 8.4.x is not compatible with PHP7.2 so if we don't have this issue in 8.5.x then it is a won't fix.

martin107’s picture

Status: Postponed (maintainer needs more info) » Active

Ah, sorry. I was looking at 8.5.x when I reported #5.

Just to be complete. I can say I saw it this morning.

This line numbers may have drifted - but this is the result of drush site install.

Starting Drupal installation. This takes a while. Consider using the --notify global option.                                [ok]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:979      [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:980      [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:981      [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:984      [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:986      [warning]
Installation complete.                                                                                                      [ok]
Congratulations, you installed Drupal!                                                                                      [status]
jibran’s picture

Priority: Normal » Major

Thanks, I think we can call it major if not critical.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vipul tulse’s picture

Me too also suffering from same issue using Drupal 8.5.0

Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:979 [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:980 [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:981 [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:984 [warning]
ini_set(): Headers already sent. You cannot change the session module's ini settings at this time DrupalKernel.php:986 [warning]
Installation complete. [ok]
Congratulations, you installed Drupal!

alexpott’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new1.56 KB

This is happening because we're setting session stuff even where the kernel is being booted from the CLI. You can see the same message if you do:

php -r "print 1; ini_set('session.use_cookies', '1');";

from CLI with PHP 7.2. Nothing actually breaks so at best this is a normal bug.

Patch attached fixes this. I'm not sure a test is required because well sessions are meaningless in CLI.

alexpott’s picture

StatusFileSize
new1.56 KB
new1.56 KB
alexpott’s picture

StatusFileSize
new770 bytes
new1.56 KB

Comment needed re-flowing.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

I see no reason in test as well

ikit-claw’s picture

I am running into this error when I try to import a db from a PHP 7.2 site.

alexpott’s picture

@ikit-claw it's a warning - not an error - disconcerting yes but actually nothing breaks (phew).

  • catch committed 9286bb4 on 8.6.x
    Issue #2901753 by alexpott: [PHP 7.2] DrupalKernel.php: ini_set():...

  • catch committed 70bf193 on 8.5.x
    Issue #2901753 by alexpott: [PHP 7.2] DrupalKernel.php: ini_set():...
catch’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!

Status: Fixed » Closed (fixed)

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

moshe weitzman’s picture

Maybe this affects someone else .. Beware that although this issue is only a warning, it can cause PHPUnit to fail. I worked around it by using dev-8.5.x from composer.

zterry95’s picture

Check if the disk is full.
In our case, this is caused by disk full. clean up files resolved the problem.