php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #67836
Patch PHP_formal_spec_errata revision 2014-08-13 19:39 UTC by tom dot phinney at cox dot net

Patch PHP_formal_spec_errata for PHP Language Specification Bug #67836

Patch version 2014-08-13 19:39 UTC

Return to Bug #67836 | Download this patch
Patch Revisions:

Developer: tom.phinney@cox.net

09-lexical
"White Space"
 - the definitions of "vertical-tab" and "form-feed" are missing from the lexical definition of "white-space-character", though they are enumerated in the preceding text. Also, the following subclause on semantics implies that "new-line", "vertical-tab" and "form-feed" are probably considered "vertical white-space characters". Also, in the first sentence of the clause on "White Space", the words "horizontal tab" and "vertical tab" do not have an intermediary dash, as they do in the actual productions.

"Keywords"
 - additional white space is needed between "new" and "or" in the lexical definition of "keyword".

"Double-Quoted String Literals"
 - The third definition in the production of "dq-char" has an unintended (else syntactically invalid) line-wrap before "octal-digit".

"Heredoc String Literals"
 - The third definition in the production of "hd-char" has an unintended (else syntactically invalid) line-wrap before "octal-digit".

"Nowdoc String Literals"
 - The production "nowdoc-string-literal::" seems to be missing an initial single quote before the "hd-start-identifier" in the definition. The explanation of the semantics and the example both show such a leading single quote.

"Operators and Punctuators"
 - either additional white space is needed between "%" and ">" in the second line of alternatives, or the existing minimal white space needs to be removed.

Note that most or all of the above changes also need to go into "master/spec/19-grammar.md".
======
10-expressions
"isset"
- The penultimate line of the examples may be in error. It reads "$v1 = TRUE; $v2 = 12.3; $v1 = NULL;" when the last assignment might have been intended to read "$v3 = NULL;". On the other hand it may well be written exactly as intended, with both a reference to a known null variable and a reference to a variable that is undefined within the scope of the example.

"list"
- The second paragraph under "Constraints" lists an italicized syntactic element, "expression-list-one-or-more", that is not present in the prior exposition of a "list".
- In the first paragraph under "Semantics" the phrase "this is consider a failure" should be "this is considered a failure".
- In the last paragraph under "Semantics" the phrase "with an expression that designate" should be "with an expression that designates".

"The clone Operator"
- In the second sentence under "Semantics" the statement "that is called to perform a deep copy" is an inference which may not be correct. What might be said is "that is called, usually to perform a deep copy". Whether or not a deeper copy is created, and how deep that copy is, is strictly a function of the semantics of the specified __clone method. Of course, if the __clone methods of all classes are constrained to perform deep copies, then this clarifying correction is not required, but that is not the current specification. See https://github.com/php/php-langspec/blob/master/spec/14-classes.md#method-__clone

"Array Creation Operator"
- in the third line under "Semantics", the text "s, each of which is used to provide an" should not be italicized.
- 4th paragraph, same problem: "in an" should not be italicized.

"Function Call Operator"
- Under "Semantics", either the statement "There is a sequence point (§§) right before the function is called." should be "There is a sequence point (§§) immediately after each argument is declared." or the comment "calls g(2,3,3,12,11)" in the subsequent example is misleadingly optimistic because other evaluation orderings could give rise to many other sets of parameters of the call.

"Cast Operator"
- In the second sentence under "Semantics", the text 'This construct is referred to a <em>cast</em>, and is used as the verb, "to cast".' should be 'This construct is referred to as a <em>cast</em>, and is used as the verb "to cast".' where the "as" is added, the comma after "as the verb" is removed (because it causes an incorrect parse of the sentence) and the HTML <em> and </em> tags bracket an italicized word.

"Multiplicative Operators"
- The syntax equation shhould be
 multiplicative-expression:
    instanceof-expression
    multiplicative-expression  *  instanceof-expression
    multiplicative-expression  /  instanceof-expression
    multiplicative-expression  %  instanceof-expression
where the three right-hand components have been changed to instanceof-expression, expressing the left-associativity of these operators and providing an unambiguous parse.

"Bitwise Shift Operators"
- Under "Syntax", the 3rd line probably should include the left-shift operator "<<". This error may result from not encoding the HTML as "&lt;&lt;"

"Relational Operators"
- Under "Syntax", the 3rd and 5th lines probably should include the "<" and "<=" operators, respectively. This error may result from not encoding the HTML as "&lt;" and "&lt;=", respectively

"Equality Operators"
- Under "Syntax", the 5th line probably should include the alternate form of the unequal operator, "<>". This error may result from not encoding the HTML as "&lt;&gt;"

Note that the last four above changes also need to go into "master/spec/19-grammar.md".
======
11-statements
"The if Statement"
- In the second paragraph under "Semantics" the second sentence neglects to discuss evaluation of the conditional of the elseif clause before stating that the following statement is executed (unconditionally).

"The switch Statement"
- In the last paragraph under "Semantics", "Switches may nested" should be "Switches may be nested".

======
14-classes
"Class Declarations"
- Under "Syntax", in the 2nd line the two separated items "class-base   clauseopt" should be connected by a hyphen.

"Class Members"
- Under "Semantics", in the 1st paragraph, the final period should be inside the parentheses, or the parentheses should be removed.

"Method __set_state"
- Under "Examples", there needs to be vertical white space before the following line (which contains both single and double quotes, and thus is not readily quoted in this errata listing without resorting to non-ASCII quotes):
 eval('$z = ' . $v . ";"); // execute the string putting the result in $z

"Serialization"
- In the 2nd paragraph, 2nd sentence, the comma in the phrase "in one of two, mutually exclusive ways" causes the sentence to parse incorrectly. Thus it is erroneous and needs to be removed.

"Class Closure"
- In the 3rd paragraph, "objects of tha class" should be "objects of thE class".

"Class Generator"
- In the table, in the row for "next", the font at the end of the cell entry "Iterator::next" is incorrect.

======
16-traits
"Trait Declarations"
- In "Semantics", last paragraph, the second comma in the first sentence, at "alias, if", causes the sentence to mis-parse. The comma should be removed. Otherwise the sentence logically reads "If trait-alias-as-clause contains a visibility-modifier {, that controls the visibility of the alias,}OPT if a right-hand name is provided; otherwise, it controls the visibility of the left-hand name" where the braces and OPT indicate that the second comma makes the preceding intermediary subclause optional rather than essential to the interpretation of the sentence. Even so, the sentence is still difficult to interpret due to the dual potential interpretations of "that". It would be helped considerably if it were rewritten to read "If trait-alias-as-clause contains a visibility-modifier, that visibility-modifier controls the visibility of the alias when a right-hand name is provided; otherwise it controls the visibility of the left-hand name.'

======
17-exception-handling
- In "General". 1st paragraph, the parenthetical 2nd sentence is incorrectly punctuated. The 1st comma is incorrect and should be deleted. The closing period should be inside, not outside, the closing parenthesis.

"Tracing Exceptions"
- In the last cell of the table, for row "type", it is not clear what specific strings are returned. Are they "->", "::" and ""? If so, why are the first two not quoted and why is the third not enumerated identically to the first two?

"Namespace Use Declarations**"
- In "Semantics", last paragraph, 2nd last sentence, "If a namespace-alias-clause is present" should be "If a namespace-aliasING-clause is present".

======
19-grammar

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 12:01:27 2024 UTC