Blog Comments - Error : Array to string conversion

edited October 2013 in Modules
Hi Admin,

I encountered this "Array to String conversion" error in Blog Comments section when i tried to publish a comment.

"Severity: Notice

Message: Array to string conversion

Filename: core/MY_Model.php

Line Number: 2737"

please help me with this...

Comments

  • edited 6:14PM
    Is this with FUEL version 1.0 or FUEL 0.93?
  • edited 6:14PM
    its 0.9.3
  • edited 6:14PM
    Hmm... I'm having trouble replicating the issue. What version of PHP are you running?

    If it's early on in your project, I'd be curious if this is still an issue for you in 1.0. 1.0 has all the big modules like the blog separated out into their own repos:
    https://github.com/daylightstudio/FUEL-CMS/tree/1.0
    https://github.com/daylightstudio/FUEL-CMS-Blog-Module
    http://docs.getfuelcms.com

    1.0 hasn't officially been released yet (am hoping soon), but we are using it exclusively internally and have been for a while.
  • edited 6:14PM
    my PHP version is 5.4.7

    I changed the blog layouts to match my template. but dint put my hands on any Blog related php code.

    will try with the version 1.0
  • edited 6:14PM
    Hi encountered another issue with the URL

    http://localhost/projects/ILT-Fuel/ilt_fuel/index.php??fuel/dashboard

    i dont know what i did wrong with the URL "index.php??fuel/"
  • edited 6:14PM
    And you were doing the publish/unpublish in the admin in the comment edit screen correct? And this is still 0.93 or did you update it to 1.0?

    That URL issue looks like a mod_rewrite / .htaccess issue. What is the value of your "RewriteBase" in your main .htaccess file.
  • edited 6:14PM
    Still on 0.93 only and did publishing comments,

    and the URL issue caused by changing "$config['enable_query_strings'] = FALSE;" to TRUE.
    .htaccess - RewriteBase /
  • edited 6:14PM
    I believe that particular issue is fixed in the 1.0 beta. The fix was to change the following in the MY_Model::lazy_load method:
    if ($cache_key == '') { if (is_array($where)) { $cache_key = implode('_', array_keys($where)); } else { $cache_key = str_replace(' ', '_', $where).'_'.$model; } }
    TO:
    if ($cache_key == '') { $model_str = ''; if (is_array($model)) { $model_str = key($model); $model_str .= current($model); } elseif (is_string($model)) { $model_str = $model; } if (is_array($where)) { $cache_key = implode('_', array_keys($where)).'_'.$model_str; } else { $cache_key = str_replace(' ', '_', $where).'_'.$model_str; } }

    Also, 1.0 is on the latest stable build of CI which has the "allow_get_array" configuration parameter (which is probably what you are needing).
  • edited 6:14PM
    yup that fixed the COMMENTS issue.

    And please help me with that QUERY_STRING issue

    Here is my htaccess file,

    Options +FollowSymLinks

    RewriteEngine On
    RewriteBase /


    Order Deny,Allow
    Deny From All


    # Allow asset folders through
    RewriteRule ^(fuel/modules/(.+)?/assets/(.+)) - [L]

    # Protect application and system files from being viewed
    RewriteRule ^(fuel/install/.+|fuel/crons/.+|fuel/data_backup/.+|fuel/codeigniter/.+|fuel/modules/.+|fuel/application/.+|\.git.+) - [F,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule .* index.php?/$1 [L]

    Options -Indexes
  • edited 6:14PM
    What happens if you remove the question mark after index.php from the following:
    RewriteRule .* index.php?/$1 [L]
  • edited 6:14PM
    And this "??fuel" occurs only when i'm on Dashboard and log in pages..

    from other admin page links the URL is fine..

    tried changing Rewritebase too... still no luck with that..

    Pls pls help me with this asap.. i'm closer to deliver the product to client
  • edited 6:14PM
    Still the same happens after removing the " ? "
  • edited 6:14PM
    Fixed URL issue by editing fuel_header.php

    Modified line 95 with the following code

    "str_replace('??', '?/',fuel_url($url))"

    will it cause any problem !!!??
  • edited 6:14PM
    Normally I'd discourage making any updates to the core files, however, since this is in .93, there are no more changes planned for that branch so if it works for you and your project, I'd say keep it.
  • edited 6:14PM
    Hi
    Tried the Latest FUEL version, and again encountered the same QUERY_STRING "??" problem when i set $config['uri_protocol'] = 'QUERY_STRING'; $config['enable_query_strings'] = TRUE; in config.php

    And may i change "?" to "/" in SITE_URL function located at "codeigniter/core/config.php"

    this
    "return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);"

    to this

    "return $this->slash_item('base_url').$this->item('index_page').'/'.$this->_uri_string($uri);"

    Because when enabling QUERY_STRING it adds up a "?" before the uri string in CI config, and this with our "?" in fuel htaccess/config file leads to "??" 404 page.

    I hope you can give me a solution to this without changing the CI config file.
  • edited 6:14PM
    I'm curious what are you needing that parameter set to TRUE for? If you are wanting access to the query string parameters, you should be able to do that already because the $config['allow_get_array'] is set to TRUE in FUEL 1.0. What you are seeing is the standard behavior for the site_url function.
Sign In or Register to comment.