NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
json_decode and php 7.2


Joined: 11 Feb 2009
Posts: 8
Location: Cambridge, MA
Reply with quote
I am calling json_decode as follows:

$jsonobj = json_decode( $jsonstring, false, 512, JSON_INVALID_UTF8_SUBSTITUTE);

When I execute this line, I get the error message:

Use of undefined constant JSON_INVALID_UTF8_SUBSTITUTE - assumed 'JSON_INVALID_UTF8_SUBSTITUTE'

Which doesn't seem to make any sense. The json_decode returns NULL, presumably because of an a umlaut in the input string. The php version in tools->settings->Run & debug->Settings is PHP 7.x. phpinfo tells me that I am running 7.0.13, but JSON_INVALID_UTF8_SUBSTITUTE is not available until 7.2.

Any way to force the use of 7.2?
View user's profileFind all posts by BillSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Bill,
phpinfo is a definite source a of truth. If it says you have 7.0, you indeed have 7.0.
As of tools->settigns->run & debug, it works for SRV web service and CLI mode only. If you use either of the two, you can select php version on Tools->Settings->SRV web server->CGI handlers or Tools->Settings->PHP CLI->PHP CLI executable respectively -- that's what PHP-7.x selects. You can try [Reset] button on those tabs to select default path to php binaries installed with the most recent version. If your version is too old, you may want to upgrade it -- because old version probably was shipped when php 7.2 hasn't been released and therefore php 7.2 debugger is not available for that version.
If your project is configured to use Apache or another web server, PhpED can't make that server change php version for you. You have to configure it yourself in a regular way according to service docs.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
json_decode and php 7.2
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic