Skip to content

Undefined array key 0 warning at console Installation #3672

Closed
@akunzai

Description

@akunzai

Preconditions (*)

  1. OpenMage 20.2.0
  2. PHP 8.2

See my gist

Steps to reproduce (*)

# start containers
docker compose up -d

# install OpenMage
bash ./install.sh

Expected result (*)

Install success without errors

Checking database...
Installing OpenMage...
SUCCESS: ef6481244432fb89d109db9017743b1e

Actual result (*)

Checking database...
Installing OpenMage...
ERROR: Error in file: "/var/www/html/app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.7-1.4.0.0.8.php" - Warning: Undefined array key 0  in /var/www/html/app/code/core/Mage/Core/Model/App.php on line 1006

Workaround: change php.ini to ignore warnings

error_reporting=E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING

I wrote some simple code to reproduce exception at App.php.

<?php
function mageCoreErrorHandler($errno, $errstr, $errfile, $errline)
{
  $errno = $errno & error_reporting();
  if ($errno == 0) {
    return false;
  }
  throw new Exception($errstr);
}
set_error_handler('mageCoreErrorHandler');
error_reporting(E_ALL);
$website = 1;
$websites = [];
$id = false;
$code = null;
$websites[$code] = $website;
echo $websites[$code], "\n"; # [''] => 1
echo $websites[$id], "\n"; # [0] => Undefined array key 0
print_r($websites);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions