[TYPO3-dev] phpMyAdmin 4.1.1+ breaks relogin
Dmitry Dulepov
dmitry at typo3.org
Sat Jan 17 14:13:39 CET 2009
Hi!
Steffen Kamper wrote:
> there seems to be one exception. I checked BE-scripts with JSlint
> yesterday and there where many things not correct, and with this
> statemaent var is not valid
jslint is correct here. Browsers allow more relaxed syntax (assignment in declaration). Here is the specification:
http://www.ecma-international.org/publications/standards/Ecma-262.htm
Page 74 says that variable declaration should look like:
var variable;
The specification does not allow this:
var variable = 1;
but browsers allow it.
> var anything = AJAX.Request(...);
> must be
> anything = AJAX.Request(...);
So it must be
var anything;
anything = AJAX.Request(...);
to pass jslint. I am not sure if it should be fixed or not.
>
> some other errors i found are:
>
> var a = array() //php-syntax
It must be "Array", not "array". "Array()" is a function and functions in JavaScript are case-sensitive (see page 100 of the spec, item 15.4)
> var T3AJAX = new Object(); // php-syntax
Object is also a standard function (page 95, item 15.2). It is jslint error I think.
> if (a !=b) return;
> must be
> if (a !=b) {
> return
> };
Specification does not have anything definite on it. 12.5 in the spec says that "if" has this grammar:
if ( Expression ) Statement else Statement
if ( Expression ) Statement
Statement is:
Statement:
Block
VariableStatement
EmptyStatement
ExpressionStatement
IfStatement
IterationStatement
ContinueStatement
BreakStatement
ReturnStatement
WithStatement
LabelledStatement
SwitchStatement
ThrowStatement
TryStatement
There is no AssignmentExpression here but there is a ExpressionStatement, which is not clearly defined. Anyway we should use { and } to match our PHP code.
> new used as statement
Yes, this is wrong because "new" is not a statement, it is an expression. Its result should be assigned or passed to something.
--
Dmitry Dulepov
TYPO3 core team
"Sometimes they go bad. No one knows why" (Cameron, TSCC, "Dungeons&Dragons")
More information about the TYPO3-dev
mailing list