Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
5.8k views
in Technique[技术] by (71.8m points)

php - Fatal error: Uncaught TypeError: Cannot access offset of type string on string in

previous question:Fatal error: Uncaught TypeError: filter_var(): Argument #3 ($options) must be of type array

Thanks to the help of some of you I was able to fix part of my site, I put the old questions at the beginning of the post in case you need to look at the previous Bugs to answer me better.

Now there are these new errors, I would be grateful if you would give me further help. Thanks in advance.

I assume these are the latest site troubleshooting bugs..

A PHP Error was encountered
Severity: Warning

Message: Array to string conversion

Filename: helpers/smiley_helper.php

Line Number: 211
_______________________________________________________________________________
/**
 * Parse Smileys
 *
 * Takes a string as input and swaps any contained smileys for the actual image
 *
 * @access  public
 * @param   string  the text to be parsed
 * @param   string  the URL to the folder containing the smiley images
 * @return  string
 */
if ( ! function_exists('parse_smileys'))
{
    function parse_smileys($str = '', $image_url = '', $smileys = NULL)
    {
        if ($image_url == '')
        {
            return $str;
        }

        if ( ! is_array($smileys))
        {
            if (FALSE === ($smileys = _get_smiley_array()))
            {
                return $str;
            }
        }

        // Add a trailing slash to the file path if needed
        $image_url = preg_replace("/(.+?)/*$/", "\1/",  $image_url);

        foreach ($smileys as $key => $val)
        {
[Line 211]  $str = str_replace($key, "<img src="".$image_url.$smileys[$key][0]."" width="".$smileys[$key][1]."" height="".$smileys[$key][2]."" alt="".$smileys[$key][3]."" style="border:0;" />", $str);
        }

        return $str;
    }
}
_______________________________________________________________________________

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in
D:xamppphtdocsapplicationmodules
ewscontrollers
ews.php:171
Stack trace:
_______________________________________________________________________________
#0 D:xamppphtdocsapplicationmodules
ewscontrollers
ews.php(32): News->getNews()
    /**
     * Default to page 1
     */
    public function index()
    {
        requirePermission("view");

        if($this->config->item('news_internal'))
[Line 32]   $this->getNews();

        if($this->config->item('news_external'))
            foreach($this->plugins->getNews() as $plugin=>$data)
                if($data != false)
                    $this->news_articles = array_merge($this->news_articles, $data);

        usort($this->news_articles, array($this, "sortByDate"));

        // Show the page
        $this->displayPage();
    }
_______________________________________________________________________________
#1 D:xamppphtdocssystemcoreCodeIgniter.php(356): News->index()
/*
 * ------------------------------------------------------
 *  Call the requested method
 * ------------------------------------------------------
 */
[Line 356] call_user_func_array(array(&$CI, $method), $params);

    // Mark a benchmark end point
    $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
_______________________________________________________________________________
#2 D:xamppphtdocsindex.php(228): require_once('D:\xamppp\htdoc...')
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
[Line 228]require_once BASEPATH.'core/CodeIgniter.php';
_______________________________________________________________________________
#3 {main} thrown in D:xamppphtdocsapplicationmodules
ewscontrollers
ews.php on line 171

        // For each key we need to add the special values that we want to print
        foreach($this->news_articles as $key => $article)
        {
[Line 171]  $this->news_articles[$key]['headline'] = langColumn($article['headline']);
            $this->news_articles[$key]['content'] = langColumn($article['content']);
            $this->news_articles[$key]['date'] = date("Y/m/d", $article['timestamp']);
            $this->news_articles[$key]['author'] = $this->user->getNickname($article['author_id']);
            $this->news_articles[$key]['link'] = ($article['comments'] == -1)? '' : "href='javascript:void(0)' onClick='Ajax.showComments(".$article['id'].")'";
            $this->news_articles[$key]['comments_id'] = "id='comments_".$article['id']."'";
            $this->news_articles[$key]['comments_button_id'] = "id='comments_button_".$article['id']."'";
            $this->news_articles[$key]['tags'] = $this->news_model->getTags($article['id']);
        }
_______________________________________________________________________________



与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...