Skip to content

Bug: init of $data arrays in controllers #2933

Description

@Conspir3D

Description
When you fill an array in a controller function, typically the $data array, and the first value is a returned array from a models function, the key won't be populated. look at expected behaviour

CodeIgniter 4 version
4.0.3

Affected module(s)
Seems that the bug is somwhere around controller/modell package

Expected behavior, and steps to reproduce if appropriate
not working, $data['data'] is not populated at 'page' view:

$data['data'] = $model->getData($id);
$data['title'] = 'Page for '.$data['data']['dataname'];
$data['something'] = 'else';

echo view('page', $data);

working, $data['data'] is populated at 'page' view:

$data['something'] = 'else';
$data['data'] = $model->getData($id);
$data['title'] = 'Page for '.$data['data']['dataname'];

echo view('page', $data);

Context

  • OS: Debian Linux 10
  • Web server Apache2
  • PHP version 7.3

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions