Posted by batigolix on November 29, 2011 at 8:40pm
5 followers
Jump to:
| Project: | Basic |
| Version: | 7.x-2.0-rc3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I get the following error on enabling the Basic theme on my D7 website
Notice: Uninitialized string offset: 0 in basic_id_safe() (regel 120 van /var/www/d7/sites/all/themes/basic/template.php
It refers to is
<?php
function basic_id_safe($string) {
// Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
$string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
// If the first character is not a-z, add 'n' in front.
if (!ctype_lower($string{0})) { // Don't use ctype_alpha since its locale aware.
$string = 'id'. $string;
}
return $string;
}
?>
Comments
#1
Also am seeing this error. After a little research found that there are some new functions in D7 that handle cleaning up classes. Replacing the above function with this seems to do this trick:
<?phpfunction basic_id_safe($string) {
// Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
$string = drupal_html_id($string);
return $string;
}
?>
References: http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ht... and http://drupal.org/node/624046
#2
Thanks. It's helps me
#3
thanks. pushed to dev.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.