Jump to content
TNG Community
  • 0
Newfloridian

PHP Warning with PHP 7.2

Question

Newfloridian

I'm generating an isolated PHP Warning when running PHP 7.2 that doesn't show with PHP 5.6:

Illegal string offset 'maint' in ...maint.php line 3

Cannot assign an empty string to a string offset in ...maint.php on line 3

This line reads:

$tngconfig['maint'] = "";

There is a similar warning for 'maint' in globallib.php

I saw something similar with $tngconfig['menu'] which required the "" to be changed to "0". Should the above be rewritten as:

$tngconfig['maint'] = "0";

Thanks - Alan

 

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0
Ken Roy

Alan,

You should probably report this issue to Darrin, so it can be fixed

Share this post


Link to post
  • 0
Ken Roy

Alan,

I just turned maintenance on in my sandbox running PHP 7.2 and it is not generating an error in the php error log.  Can you provide the steps to cause this error.

Thanks

Share this post


Link to post
  • 0
Newfloridian

I was discussing another matter with my ISP and they reported the Warning message back to me.

On closer inspection, I can see that my config.php file contains a number of variables which are empty and which generate similar messages in error_log. Others are not.

Examples (although not sure what they actually relate to)

$lnprefixes = "0";
$lnpfxnum = "";

Should these all have the "" replaced with "0"

Alan

 

Share this post


Link to post
  • 0
Ken Roy

Alan,

That would be a Darrin question because he might also need to update what he is checking for within the code.

Share this post


Link to post
  • 0
Newfloridian

Just received the following reply:

"The real problem is that PHP 7 wants you to define $tngconfig as an 
array before you use it like one. In earlier versions of TNG, I had 
initialized $tngconfig by setting it equal to "". That made PHP decide 
it was a string, so any attempt to use it as an array after that would 
cause an error like this. You'll have to make sure you're initializing 
it as an array instead by setting it equal to []."

I'm now looking into that

My Wampserver installation runs without issue on PHP7.2.14 However my online site, which has identical file structure, bombs out above PHP 7.0.4 I'm finding difficulty understanding why one installation runs but the other doesn.t

 

Cheers Alan

 

Share this post


Link to post
  • 0
Ken Roy

Alan,

I believe these type of errors have been fixed in TNG v12. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×