Inspectopedia
 
2024.3

Invalid string offset usage

Error
New
Last modified: 03 December 2024

Reports invalid string offset usages that will result in a runtime error.

The following usages are reported:

  • Using string offsets as objects or arrays

  • Unsetting string offsets via unset

  • Passing string offsets by reference

  • Creating references to or from string offsets

  • Incrementing or decrementing string offsets

  • Using combined operator assignments such as += or .= on string offsets

  • Assigning string offsets with empty strings or strings with length >1