Skip to content

Using null as an array offset is not deprecated #20194

@thomas-0816

Description

@thomas-0816

Description

The following code:

<?php

$a = [null => 1];

echo $a[null];

Resulted in this output:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/test.php on line 5
1

But I expected this output instead:

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/test.php on line 3
Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/test.php on line 5
1

PHP Version

PHP 8.5.0RC2 (cli) (built: Oct  9 2025 23:32:25) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.0RC2, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0RC2, Copyright (c), by Zend Technologies

Operating System

Docker php:8.5.0RC2-cli-bookworm

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions