spotweb: Fatal error: Uncaught Error: [] operator not supported for strings in PHP 7.1.0
Updated my system to PHP 7.1.0 and got this after a git pull to have most recent code:
[danny@server03 spotweb]$ php retrieve.php
Removing Spot information which is beyond retention period,, done
Last retrieve at Sun 04 Dec 2016 11:12:16 PM UTC
Retrieving new Spots from server xxxxxxxxxxx...
Appr. Message count: 2969126
First message number: 2
Last message number: 2969128
Current article number: 2968442
Retrieving 2968442 till 2969129PHP Fatal error: Uncaught Error: [] operator not supported for strings in /home/danny/public_html/spotweb/lib/services/Format/Services_Format_Parsing.php:140
Stack trace:
#0 /home/danny/public_html/spotweb/lib/services/Retriever/Services_Retriever_Spots.php(492): Services_Format_Parsing->parseFull('<Spotnet><Posti...')
#1 /home/danny/public_html/spotweb/lib/services/Retriever/Services_Retriever_Base.php(227): Services_Retriever_Spots->process(Array, '2968442', 2969129, 1481079369.404)
#2 /home/danny/public_html/spotweb/lib/services/Retriever/Services_Retriever_Base.php(319): Services_Retriever_Base->loopTillEnd(2969129, '5000')
#3 /home/danny/public_html/spotweb/retrieve.php(145): Services_Retriever_Base->perform()
#4 {main}
thrown in /home/danny/public_html/spotweb/lib/services/Format/Services_Format_Parsing.php on line 140
[danny@server03 spotweb]$
[danny@server03 spotweb]$ php -v
PHP 7.1.0 (cli) (built: Dec 1 2016 08:23:35) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies
[danny@server03 spotweb]$
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 33 (16 by maintainers)
Links to this issue
Commits related to this issue
- Fix for: Github #243 Uncaught Error: [] operator not supported for strings — committed to spotweb/spotweb by deleted user 8 years ago
- Merge pull request #245 from spotweb/hotfix/php71-support Fix for array issue in #243 — committed to spotweb/spotweb by GeoffreyDijkstra 8 years ago
It is PHP Design. Changed in PHP 7.1.0:
So that means that you need to say that it is an array $myString = array(); Prior to PHP 7.1.0 , PHP converted a [] to array() silently, and now not anymore.
The GUI is showed in browser without new spots. Dont know if there are more places in the code with this kind of error.
@mesa57 It’s not an issue with [] we can still use that, but you have to initialize it now. So:
$var1[] = $xresults in error when not initialized.$var1 = []; $var1[] = $xdoes not 😄 It seems they become a little more strict.