Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Noticed this error coming up switching to PHP 7 this morning. Looks like the template function is assuming that variable $footer is an array when it's not.
Comment | File | Size | Author |
---|---|---|---|
#18 | php72-countable-warning.patch | 925 bytes | sgourebi |
#15 | 2999011-15.patch | 611 bytes | kevineinarsson |
#9 | php7-countable-2999011-9.patch | 1.57 KB | bkosborne |
#2 | php7-countable-2999011.patch | 1.57 KB | bkosborne |
Comments
Comment #2
bkosborneThis just swaps all these count() calls with !empty() which will handle the case when the value is null.
Comment #4
selfsimilar CreditAttribution: selfsimilar as a volunteer commentedAlternatively, you could cast all the variables that should be arrays to array at the top of the function. e.g.
Comment #5
markhalliwellThis should not have
!
in front ofempty
. I'll fix on commit.Comment #7
markhalliwellComment #8
bkosborneAh good catch, thanks!
Comment #9
bkosborneHere's the updated patch, just so I can include it in a make file.
Comment #10
joseph.olstadThanks for the fix,
IMHO, this fix warrants a tagged release, wink wink nudge nudge.
Drupal core 7.60 will be released 'any day now' and sports support for php 7.2.x, would be nice to hit the ground running when it is released.
Comment #11
markhalliwellAre there any other PHP7 issues that should likely be fixed before that? I really haven't worked with D7 and PHP7 together much (mainly due to the fact that most contrib breaks).
Comment #12
joseph.olstadAFAIK that's the only php7.x patch needed for bootstrap. unless someone else finds something else?
I did a blitz this weekend on drupal.org.
Yesterday I fixed organic groups so that it passes on all versions, had just a small change to the og.test to make, very small change. Requires the latest 7.x-dev core. php 7.2.x (see tests all pass)
#3000030: og fix head tests for various versions of php
I released libraries 7.x-2.4 last week that now supports 7.1.x and php 7.2.x (see tests all pass)
My servers can run 7.1.x , 7.2.x , 7.0.x , 5.6.x , 5.5.x per vhost settings, so each site can have it's own versions. So lately I've been trying out 7.1.x and 7.2.x. I also worked on the core fixes for 7.2.x , 7.60 will be released 'anytime now' , who knows, I think Pol wants to put quite a bit more fixes and new features/improvements in it.
Comment #13
joseph.olstadviews now passes all php 7.1.x and php 7.2.x
https://www.drupal.org/node/38878/qa
ctools passes as well:
https://www.drupal.org/pift-ci-job/1069673
Comment #15
kevineinarsson CreditAttribution: kevineinarsson as a volunteer commentedFound another case of a null-count() in the table template. Patched against 7.x-3.x. Should I open another issue for this Mark?
Comment #16
joseph.olstadHi kevineinarsson please open a new issue for this and paste a link here so we can find it easily (set it as a related issue or just paste a link to it) please and thanks
Comment #17
joseph.olstadThanks for the patch kevin
I've created a new issue for you and marked it as RTBC, your patch is good, let's push it in
#3012715-2: PHP 7.2.x compatibility - in the table template
Comment #18
sgourebi CreditAttribution: sgourebi commentedI tried all patches above and nothing worked. So I tried @selfsimilar way and it works with php7.2. I created a patch for php7.2. You can try it.
Comment #19
joseph.olstad@sgourebi , merci pour le patch!
selon la politique, au lieu de prolonger un vieux issue déjà fermé, on doit créé un autre
/ according to policy, create a new issue instead of prolonging a closed one.
le voici: /here it is
#3088940: php 7.2.x / php 7.3.x countable warning fix
Comment #20
murrumba CreditAttribution: murrumba as a volunteer and commentedI spent hours trying to solve it and what it solved for me was to make the adjustment below:
function wetkit_bootstrap_table($variables) {
// $header = $variables['header'];
// $rows = $variables['rows'];
$header = is_array($variables['header']) ? $variables['header'] : [];
$rows = is_array($variables['rows']) ? $variables['rows'] : [];
$footer = is_array($variables['footer']) ? $variables['footer'] : [];
//$attributes = $variables['attributes'];
$attributes = is_array($variables['attributes']) ? $variables['attributes'] : [];
$caption = is_array($variables['caption']) ? $variables['caption'] : [];
$caption = $variables['caption'];
//$colgroups = $variables['colgroups'];
$colgroups = is_array($variables['colgroups']) ? $variables['colgroups'] : [];
$sticky = is_array($variables['sticky']) ? $variables['sticky'] : [] ;
$empty = is_array($variables['empty']) ? $variables['empty'] : [] ;
$responsive = is_array($variables['responsive']) ? $variables['responsive'] : [];