-1

I have an error "A non well formed numeric value encountered" in this code on my localhost:

Yii::app()->cache->set($cache_key, $res, 60*60*24*3);

It obviously points to "60*60*24*3". I know I can typecast it to integer and problem is solved, but the same code works fine on server.

On my localhost I have php7.2 installed, and on server is old php5.3.

What could be the reason of problem?

theduck
  • 2,589
  • 13
  • 17
  • 23
Abay
  • 11
  • 3

1 Answers1

0

I think i found an answer. Offical documentation says that:

Deprecated features in PHP 7.2.x ¶ Unquoted strings ¶ Unquoted strings that are non-existent global constants are taken to be strings of themselves. This behaviour used to emit an E_NOTICE, but will now emit an E_WARNING. In the next major version of PHP, an Error exception will be thrown instead.

Abay
  • 11
  • 3
  • `60*60*24*3` is not "unquoted string", it is expression which returns integer. – rob006 May 24 '19 at 08:24
  • yes you are right. Actually instead of 60*60*24*3 there was CATEGORY_DEEP_CACHE_LIFETIME which was defined in config/consts.ini like CATEGORY_DEEP_CACHE_LIFETIME = 60*60*24*3 – Abay May 24 '19 at 08:40
  • You should probably add this info to question - right now it does not make much sense since code you've shared should not produce such error. – rob006 May 24 '19 at 08:44