php/doc-en

Discrepancy between expected and actual output

Aberta

#4.312 aberto em 15 de dez. de 2024

 (10 comentários) (0 reação) (0 responsável)XML (882 forks)auto 404
Status: Verifiedgood first issue

Métricas do repositório

Stars
 (596 estrelas)
Métricas de merge de PR
 (Mesclagem média 99d 23h) (90 fundiu PRs em 30d)

Description

From manual page: https://php.net/language.types.string


In Example #18, the expected output described in the documentation is:

string(1) "b"
bool(true)

Warning: Illegal string offset '1.0' in /tmp/t.php on line 7
string(1) "b"
bool(false)

Warning: Illegal string offset 'x' in /tmp/t.php on line 9
string(1) "a"
bool(false)
string(1) "b"
bool(false)

However, the actual output is:

string(1) "b"
bool(true)
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in php-wasm run script:7
Stack trace:
#0 {main}
  thrown in php-wasm run script on line 7

Guia do colaborador