phparraysphalcon

Can not access array with valid key in PHP 7.4


When I try to see actual keys of array with:

dd(array_keys($this->credentials));

it shows me following:

Array (4) (
  [0] => String (7) "*data"
  [1] => String (14) "*insensitive"
  [2] => String (12) "*lowerKeys"
  [3] => String (16) "*pathDelimiter"
)

But when I try to access the keys listed here like

dd($this->credentials['*data']);

or

dd($this->credentials['data']);

it returns Null.

Any ideas? Thanks in advance)

Edit:

The issue was about converting object to array in my case. In old versions of PHP I have done it like

$this->credentials = (array) $this->config->smth->{$key};

Which is not working in 7.4 ($this->config returns object). I needed to change it to

$this->credentials = $this->config->smth->{$key}->toArray();

But still can anyone explain what exactly changed in new version.


Solution

  • Could it be that $this->credentials is a converted object/class? If so, the asterisk means that those were private properties.