Error when a customer goes to the website

7 posts by 3 authors in: Forums > CMS Builder
Last Post: July 22, 2022   (RSS)

By Robarbh - July 19, 2022

When you go to the website you get this error

123disposal.com

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home1/rick123/public_html/includes/php/funclib.php on line 8

Robert Hedrick

By daniel - July 20, 2022

Hi Robert,

As Jerry suggests, this looks like something to do with your PHP version - PHP has likely been upgraded on your server, and some older code is causing an error. It appears to be coming from a custom file or library outside of CMSB so simply upgrading the CMS is unlikely to fix it, however, if you're able to post a snippet of the code I can try to help correct it.

The error is coming from line 8 of /includes/php/funclib.php - can you copy at least that line, as well as ~5 lines above and below it and paste that here?

Thanks,

Daniel
Technical Lead
interactivetools.com

By Robarbh - July 21, 2022

<?php
// ********** TEXT-LIMITING FUNCTION ***********
// (to display only a portion of each blog post's content)
// For use on all Blog list pages
function cutText($string, $setlength) {
$length = $setlength;
if($length<strlen($string)){
while (($string{$length} != " ") AND ($length > 0)) {
$length--;
}
if ($length == 0) return substr($string, 0, $setlength);
else return substr($string, 0, $length);
}else return $string;
}
// ********** Check if sidebar defined function **********
function sidebar_defined($groupNum) {
list($sidebar_grecss, $sidebar_gMetaData) = getRecords(array(
'tableName' => 'sidebar_groups',
'where' => "category = '$groupNum'",
'loadUploads' => false,
'allowSearch' => false,
));
if($sidebar_grecss)
{return 1;}
else
{return 0;}
}
// ********* extracts the YouTube video 10 character code from URL! *******
function quickYouTubeId($youtubeurl)
{
preg_match("#[a-zA-Z0-9-_]{11}#", $youtubeurl, $id);
return (strlen($id[0])==11) ? $id[0] : false;
}
// Return current page URL
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>

Robert Hedrick

By Robarbh - July 21, 2022

cms 3.56 php 7.4

Robert Hedrick

By daniel - July 21, 2022

Hi Robert,

I believe if you change this line:

while (($string{$length} != " ") AND ($length > 0)) {

To this:

while (($string[$length] != " ") AND ($length > 0)) {

It should get rid of the error.

Can you try that out and let me know if it works?

Thanks!

Daniel
Technical Lead
interactivetools.com

By Robarbh - July 22, 2022

Thank You It works 

Robert Hedrick