A
A
Anton2018-12-05 23:45:49
PHP
Anton, 2018-12-05 23:45:49

What is the syntax error after migrating to php7?

syntax error, unexpected '[', expecting ',' or ';' (0)

points to this line:
global $$arParams["FILTER_NAME"];
No errors occurred under php5.3, after 7.0 it gives syntax error
If you comment out the line, it works.
Still under 7.0 swears at
ResizeCartPictures(&$arItem);
clean up & - works

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2016-01-10
@melkij

readdir returns the name of the element. The name, not the path, of this element.
Where did you say is_file that such a filename should be looked for in the ../alx2/images directory, and not in the current one?
In order not to be perverted in different ways in the style of PHP4 - use the standard DirectoryIterator. The code will be more compact and clearer.

X
xmoonlight, 2016-01-10
@xmoonlight

php.net/manual/en/function.readdir.php

3
333Serega333 333Serega333, 2016-01-10
@333Serega333

The condition in the loop does not work.
It should be like this:

while (false !== ($file = readdir($handle))) {
     if(is_file($file)) ++$count;
    }

D
Dmitry, 2018-12-06
@anton99zel

global ${$arParams["FILTER_NAME"]};
Passing to a function by reference was removed back in 5.4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question