Skip to content

Fix Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string#16919

Merged
williamdes merged 1 commit intophpmyadmin:QA_5_1from
freax:array-fill-resolve-php8
May 28, 2021
Merged

Fix Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string#16919
williamdes merged 1 commit intophpmyadmin:QA_5_1from
freax:array-fill-resolve-php8

Conversation

@freax
Copy link
Contributor

@freax freax commented May 26, 2021

Description

This PR resolving following issue:

PHP Fatal error:

Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string given in .../libraries/classes/InsertEdit.php:273
Stack trace:
#0 .../libraries/classes/InsertEdit.php(273): array_fill()
#1 .../libraries/classes/InsertEdit.php(2247): PhpMyAdmin\\InsertEdit->loadFirstRow()
#2 .../libraries/classes/Controllers/Table/ChangeController.php(79): PhpMyAdmin\\InsertEdit->determineInsertOrEdit()
#3 .../libraries/classes/Routing.php(189): PhpMyAdmin\\Controllers\\Table\\ChangeController->index()
#4 .../index.php(18): PhpMyAdmin\\Routing::callControllerForRoute()
#5 {main}\n  thrown in .../libraries/classes/InsertEdit.php on line 273

@williamdes
Copy link
Member

Hi @freax
What is your value of InsertRows in your config file ?

@freax
Copy link
Contributor Author

freax commented May 26, 2021

Hi @williamdes
Value of InsertRows in my config file is not set.

@williamdes
Copy link
Member

williamdes commented May 26, 2021

Hi @williamdes
Value of InsertRows in my config file is not set.

Do you have configuration storage enabled ?
If yes did you define the value ?

(PHP 8 works fine, even PHP 8.1. So there is something more to discover ;) )

I am trying to pin point the issue to add an unit test afterwards

@freax
Copy link
Contributor Author

freax commented May 26, 2021

Hi @williamdes
Value of InsertRows in my config file is not set.

Do you have configuration storage enabled ?
If yes did you define the value ?

(PHP 8 works fine, even PHP 8.1. So there is something more to discover ;) )

I am trying to pin point the issue to add an unit test afterwards

Yep! Configuration storage enabled!
InsertRows represent as json object "InsertRows":"2"

May be, this is because of upgrading PhpMyAdmin version with old configuration storage tables from previous versions of PhpMyAdmin. Now I using fresh 5.2+ snapshot.

This PR will save backwards compatibility from previous versions.

…must be of type int, string

Co-Authored-by: William Desportes <williamdes@wdes.fr>
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes force-pushed the array-fill-resolve-php8 branch from 405710a to 822dce2 Compare May 28, 2021 16:01
@williamdes williamdes changed the base branch from master to QA_5_1 May 28, 2021 16:01
@williamdes williamdes self-assigned this May 28, 2021
@williamdes williamdes added this to the 5.1.1 milestone May 28, 2021
Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !
I rebased this on QA_5_1 to have it in the next 5.1 version and added tests.

@williamdes williamdes changed the title Resolve Fatal Error on PHP8 Fix Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string May 28, 2021
@codecov
Copy link

codecov bot commented May 28, 2021

Codecov Report

Merging #16919 (822dce2) into QA_5_1 (79ae9ad) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             QA_5_1   #16919   +/-   ##
=========================================
  Coverage     56.45%   56.45%           
  Complexity    15266    15266           
=========================================
  Files           471      471           
  Lines         62057    62057           
=========================================
  Hits          35037    35037           
  Misses        27020    27020           
Flag Coverage Δ
arch-7-amd64 59.81% <100.00%> (ø)
arch-7-arm32v6 59.68% <100.00%> (ø)
arch-7-arm32v7 59.68% <100.00%> (ø)
arch-7-arm64v8 59.81% <100.00%> (ø)
arch-7-i386 59.68% <100.00%> (ø)
arch-7-ppc64le ?
arch-7-s390x ?
dbase-extension 56.03% <100.00%> (ø)
recode-extension 55.99% <100.00%> (ø)
unit-7.1-ubuntu-latest 55.99% <100.00%> (ø)
unit-7.2-ubuntu-latest 56.17% <100.00%> (ø)
unit-7.3-ubuntu-latest 59.82% <100.00%> (ø)
unit-7.4-ubuntu-latest 59.82% <100.00%> (ø)
unit-8.0-ubuntu-latest 60.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
libraries/classes/InsertEdit.php 87.68% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79ae9ad...822dce2. Read the comment docs.

williamdes added a commit that referenced this pull request May 28, 2021
Pull-request: #16919

Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes merged commit 8343c28 into phpmyadmin:QA_5_1 May 28, 2021
@freax freax deleted the array-fill-resolve-php8 branch May 28, 2021 17:27
@williamdes
Copy link
Member

Just built the snapshots, you can now enjoy your fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants