Description
The following code:
<?php
$s='';
$s++;
var_dump($s);
works without errors on PHP 8.x and renders a deprecation warning since PHP 8.5.x
it results in this output:
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in /in/8jhPc on line 4
running a empty string thru str_increment()
will turn into a error though
Fatal error: Uncaught ValueError: str_increment(): Argument #1 ($string) must not be empty in /in/8jhPc:7
Stack trace:
#0 /in/8jhPc(7): str_increment('')
I think: either the increment-operator should still be allowed on empty-string, or str_increment
should support a empty string.
PHP Version
PHP 8.5.0-dev (cli) (built: Aug 24 2025 22:23:16) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.5.0-dev, Copyright (c), by Zend Technologies
Operating System
macOS