xp-framework/core

Deprecate curly brace syntax for accessing array elements and string offsets

thekid opened this issue · 4 comments

$ XP_RT=7.4 xp -e 'foreach (\xp::$errors as $file => $occurrence) { echo "== $file ==\n"; foreach ($occurrence as $line => $message) { echo "Line #$line: ".key($message)."\n"; }}'
== C:\tools\cygwin\home\Timm\devel\xp\core\src\main\php\lang\ClassLoader.class.php ==
Line #51: Array and string offset access syntax with curly braces is deprecated
Line #88: Array and string offset access syntax with curly braces is deprecated
Line #203: Array and string offset access syntax with curly braces is deprecated
Line #269: Array and string offset access syntax with curly braces is deprecated
Line #284: Array and string offset access syntax with curly braces is deprecated
== C:\tools\cygwin\home\Timm\devel\xp\core\src\main\php\lang\FileSystemClassLoader.class.php ==
Line #85: Array and string offset access syntax with curly braces is deprecated
Line #160: Array and string offset access syntax with curly braces is deprecated
== C:\tools\cygwin\home\Timm\devel\xp\core\src\main\php\lang\archive\ArchiveClassLoader.class.php ==
Line #74: Array and string offset access syntax with curly braces is deprecated
== C:\tools\cygwin\home\Timm\devel\xp\core\src\main\php\xp\runtime\Code.class.php ==
Line #128: Array and string offset access syntax with curly braces is deprecated
Line #154: include(): xp\runtime\Script::stream_set_option is not implemented!
== C:\tools\cygwin\home\Timm\devel\xp\core\src\main\php\lang\Type.class.php ==
Line #140: Array and string offset access syntax with curly braces is deprecated
Line #161: Array and string offset access syntax with curly braces is deprecated
Line #169: Array and string offset access syntax with curly braces is deprecated
Line #228: Array and string offset access syntax with curly braces is deprecated
Line #241: Array and string offset access syntax with curly braces is deprecated
Line #261: Array and string offset access syntax with curly braces is deprecated
Line #289: Array and string offset access syntax with curly braces is deprecated
Line #292: Array and string offset access syntax with curly braces is deprecated

Another problem is this error: Trying to access array offset on value of type null

Also fixed in XP runners v8.1.6

For all XP libraries:

# Overview
$ grep --text -HErn  '\$[a-zA-Z_]+\{' */src/main/php/ | grep -v ^core7 | wc -l
339

# Details
$ grep --text -HErn  '\$[a-zA-Z_]+\{' */src/main/php/ | grep -v ^core7 | \
  cut -d '/' -f 1 | sort | uniq -c | sort -rn
     81 rdbms
     35 lang
     18 text-encode
     17 security
     16 yaml
     13 mirrors
     12 unittest
     12 json
     10 mustache
     10 handlebars
      8 patterns
      8 mail
      8 google-authenticator
      8 ftp
      6 webservices
      6 networking
      6 logging
      6 doclet
      5 zip
      5 web
      5 compiler
      4 xml
      4 markdown
      4 ical
      4 command
      4 address
      3 scriptlet
      3 neo4j
      3 ldap
      3 imaging
      3 csv
      2 uri
      1 webtest
      1 testdown
      1 term
      1 remote
      1 math
      1 http
      1 hashing
      1 hash