-
Notifications
You must be signed in to change notification settings - Fork 883
Update screens for output that changed with PHP itself #5720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6d44e89
ff05449
2ba57e5
03ad3ca
d4e0fc3
ac7eb8d
35185c4
a057c25
21008d6
83171fa
4dcf024
1b0d325
75d9208
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,8 +63,8 @@ var_dump(new class(10) extends SomeClass implements SomeInterface { | |
| &example.outputs; | ||
| <screen> | ||
| <![CDATA[ | ||
| object(class@anonymous)#1 (1) { | ||
| ["Command line code0x104c5b612":"class@anonymous":private]=> | ||
| object(SomeClass@anonymous)#1 (1) { | ||
| ["num":"SomeClass@anonymous":private]=> | ||
|
Comment on lines
+66
to
+67
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, I am not actually sure what's changed. I can see that PHP 8 uses the parent class name, but is this important? Is this intentional or just an implementation detail? |
||
| int(10) | ||
| } | ||
| ]]> | ||
|
|
@@ -153,11 +153,12 @@ same class | |
| </informalexample> | ||
|
|
||
| <note> | ||
| <para> | ||
| <simpara> | ||
| Note that anonymous classes are assigned a name by the engine, as | ||
| demonstrated in the following example. This name has to be regarded an | ||
| implementation detail, which should not be relied upon. | ||
| </para> | ||
| implementation detail, which should not be relied upon. The generated name | ||
| contains a NUL byte, which is not visible in the output below. | ||
|
Comment on lines
+159
to
+160
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the NUL byte? Is it always there? What's the significance of it? |
||
| </simpara> | ||
| <informalexample> | ||
| <programlisting role="php"> | ||
| <![CDATA[ | ||
|
|
@@ -168,7 +169,7 @@ echo get_class(new class {}); | |
| &example.outputs.similar; | ||
| <screen> | ||
| <![CDATA[ | ||
| class@anonymous/in/oNi1A0x7f8636ad2021 | ||
| class@anonymousscript:2$0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference? Isn't it the same thing? |
||
| ]]> | ||
| </screen> | ||
| </informalexample> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -495,7 +495,7 @@ Array | |
| </para> | ||
| <example> | ||
| <title>Using <link linkend="object.set-state">__set_state()</link></title> | ||
| <programlisting role="php"> | ||
| <programlisting role="php" annotations="non-interactive"> | ||
| <![CDATA[ | ||
| <?php | ||
|
|
||
|
|
@@ -524,7 +524,7 @@ var_dump($c); | |
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| &example.outputs; | ||
| &example.outputs.81; | ||
| <screen> | ||
| <![CDATA[ | ||
| string(60) "A::__set_state(array( | ||
|
|
@@ -537,6 +537,21 @@ object(A)#2 (2) { | |
| ["var2"]=> | ||
| string(3) "foo" | ||
| } | ||
| ]]> | ||
| </screen> | ||
| &example.outputs.82; | ||
| <screen> | ||
| <![CDATA[ | ||
| string(61) "\A::__set_state(array( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't even remember what this change was. Is this something that we document or is this an implementation detail? |
||
| 'var1' => 5, | ||
| 'var2' => 'foo', | ||
| ))" | ||
| object(A)#2 (2) { | ||
| ["var1"]=> | ||
| int(5) | ||
| ["var2"]=> | ||
| string(3) "foo" | ||
| } | ||
| ]]> | ||
| </screen> | ||
| </example> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -178,6 +178,9 @@ $c = fopen('/tmp/', 'r'); | |||||
| var_dump($a instanceof stdClass); // $a is an integer | ||||||
| var_dump($b instanceof stdClass); // $b is NULL | ||||||
| var_dump($c instanceof stdClass); // $c is a resource | ||||||
|
|
||||||
| // Prior to PHP 7.3.0 this was a compile-time error, so nothing above ran: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| // instanceof expects an object instance, constant given | ||||||
| var_dump(FALSE instanceof stdClass); | ||||||
| ?> | ||||||
| ]]> | ||||||
|
|
@@ -188,7 +191,7 @@ var_dump(FALSE instanceof stdClass); | |||||
| bool(false) | ||||||
| bool(false) | ||||||
| bool(false) | ||||||
| PHP Fatal error: instanceof expects an object instance, constant given | ||||||
| bool(false) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, but we need to retain the error message. Perhaps split it into two outputs per version? Or just add a code comment on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took the code comment. A split would mislead here: prior to 7.3 this is a compile-time error, so 7.2 prints the fatal line and nothing else — none of the three That's why the comment says "so nothing above ran". The 7.3 boundary itself is already covered by the example directly below, which uses |
||||||
| ]]> | ||||||
| </screen> | ||||||
| </example> | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,11 @@ $b = Suit::from('B'); | |
| <![CDATA[ | ||
| enum(Suit::Hearts) | ||
| Fatal error: Uncaught ValueError: "B" is not a valid backing value for enum "Suit" in /file.php:15 | ||
| Fatal error: Uncaught ValueError: "B" is not a valid backing value for enum Suit in script:14 | ||
| Stack trace: | ||
| #0 script(14): Suit::from('B') | ||
| #1 {main} | ||
| thrown in script on line 14 | ||
|
Comment on lines
+74
to
+78
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just like before, I don't think we should be documenting these stack traces. Just keep the first line and use |
||
| ]]> | ||
| </screen> | ||
| </example> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,7 +133,7 @@ | |
| <para> | ||
| <example> | ||
| <title><function>mb_detect_encoding</function> example</title> | ||
| <programlisting role="php"> | ||
| <programlisting role="php" annotations="non-interactive"> | ||
| <![CDATA[ | ||
| <?php | ||
|
|
||
|
|
@@ -158,7 +158,16 @@ var_dump(mb_detect_encoding($str, $encodings)); | |
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| &example.outputs; | ||
| &example.outputs.82; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 8.2? What changed in 8.2 that we document the difference in output? I can see no related information on this page that would explain this. I would lean towards rejecting this change. Unless we have a basis to add the split example, we should only document the current behaviour. For all I know, the change in behaviour came from a bug fix or some internal refactoring. |
||
| <screen> | ||
| <![CDATA[ | ||
| bool(false) | ||
| bool(false) | ||
| string(8) "SJIS-win" | ||
| bool(false) | ||
| ]]> | ||
| </screen> | ||
| &example.outputs.83; | ||
| <screen> | ||
| <![CDATA[ | ||
| string(5) "ASCII" | ||
|
|
@@ -172,13 +181,14 @@ string(5) "ASCII" | |
| <para> | ||
| <example> | ||
| <title>Effect of <parameter>strict</parameter> parameter</title> | ||
| <programlisting role="php"> | ||
| <programlisting role="php" annotations="non-interactive"> | ||
| <![CDATA[ | ||
| <?php | ||
| // 'áéóú' encoded in ISO-8859-1 | ||
| $str = "\xE1\xE9\xF3\xFA"; | ||
|
|
||
| // The string is not valid ASCII or UTF-8, but UTF-8 is considered a closer match | ||
| // The string is valid in neither encoding: non-strict reports the closest | ||
| // match, strict returns false | ||
| var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], false)); | ||
| var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], true)); | ||
|
|
||
|
|
@@ -188,13 +198,22 @@ var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8', 'ISO-8859-1'], true)); | |
| ?> | ||
| ]]> | ||
| </programlisting> | ||
| &example.outputs; | ||
| &example.outputs.82; | ||
| <screen> | ||
| <![CDATA[ | ||
| string(5) "UTF-8" | ||
| bool(false) | ||
| string(10) "ISO-8859-1" | ||
| string(10) "ISO-8859-1" | ||
| ]]> | ||
| </screen> | ||
| &example.outputs.83; | ||
| <screen> | ||
| <![CDATA[ | ||
| string(5) "ASCII" | ||
| bool(false) | ||
| string(10) "ISO-8859-1" | ||
| string(10) "ISO-8859-1" | ||
| ]]> | ||
| </screen> | ||
| </example> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.