I have several errors that show up on my site. This has happened recently due to I believe an update on the server (providers) to PHP 5.3
Latest News: (loading..)
Warning: substr() expects parameter 3 to be long, string given in products_new.php on line 100
Started by djackson1001, Jun 11 2012 07:51 PM
problem with php 5.3 & templa
5 replies to this topic
#1
Posted 11 June 2012 - 07:51 PM
#2 ONLINE
Posted 11 June 2012 - 08:14 PM
@djackson1001
You duplicate post in the commercial support area requests additional information. THIS post, will also require additional information. However, if the error was caused by a PHP update, I would suggest you update your website to be PHP 5.3 compatible.
Chris
You duplicate post in the commercial support area requests additional information. THIS post, will also require additional information. However, if the error was caused by a PHP update, I would suggest you update your website to be PHP 5.3 compatible.
Chris
:|: Was this post helpful ? Click the LIKE THIS button :|:
See my Profile to learn more about add ons, templates, support plans and custom coding (click here)
See my Profile to learn more about add ons, templates, support plans and custom coding (click here)
#3
Posted 11 June 2012 - 08:28 PM
djackson1001, on 11 June 2012 - 07:51 PM, said:
I have several errors that show up on my site. This has happened recently due to I believe an update on the server (providers) to PHP 5.3
All you have to do is force parameter 3 to be of the right "type" by putting (int) in front of it.
Edited by germ, 11 June 2012 - 08:29 PM.
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#4
Posted 14 June 2012 - 03:31 PM
germ, on 11 June 2012 - 08:28 PM, said:
All you have to do is force parameter 3 to be of the right "type" by putting (int) in front of it.
That's risky. The complaint is that the parameter is not a well-formed number. It doesn't matter if a well-formed number is in the form of a string -- PHP should convert it to an integer. It sounds like there is some other garbage in there. (int) may simply hide the problem by forcing non-numeric text to a 0. It would be better to find the source of the invalid data and fix it (upstream).
#5
Posted 14 June 2012 - 04:41 PM
MrPhil, on 14 June 2012 - 03:31 PM, said:
That's risky. The complaint is that the parameter is not a well-formed number. It doesn't matter if a well-formed number is in the form of a string -- PHP should convert it to an integer. It sounds like there is some other garbage in there. (int) may simply hide the problem by forcing non-numeric text to a 0. It would be better to find the source of the invalid data and fix it (upstream).
Probably not. I can't say I've ever seen a case where doing this would be "risky", personally.
PHP does a pretty good job converting strings to numbers and vice versa when it needs to most of the time.
Other times it requires a little help.
But unless the OP bothers to come back and post the offending code we'll never know.
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -
"Headers already sent" - The definitive help
"Cannot redeclare ..." - How to find/fix it
SSL Implementation Help
Like this post? "Like" it again over there >
#6
Posted 10 September 2012 - 10:31 PM
Thanks, Jim, applied your 'fix' to this code in a fork of osC.
$p_desc = substr(strip_tags($product['products_description']), 0, (int)MAX_DESCR_1);
Cheers,
EricK
$p_desc = substr(strip_tags($product['products_description']), 0, (int)MAX_DESCR_1);
Cheers,
EricK









