PHP 5.4 Illegal string offset
<p>help me understand.</p>

<p>The plug has not been updated for a long time _http://market.osclass.org/plugins/attributes/real-state-attributes_6</p>

<p>In the transition to PHP 5.4 is presented error.</p>

<p>Help, to deal with the error:</p>

<blockquote>
  <p>Warning: Illegal string offset 'pk_i_id' in C:\OpenServer\domains\oc-classrus.loc\oc-content\plugins\realestate_attributes\conf.php on line 109</p>
  
  <p>Warning: Illegal string offset 's_name' in C:\OpenServer\domains\oc-classrus.loc\oc-content\plugins\realestate_attributes\conf.php on line 109</p>
  
  <p>Warning: Illegal string offset 'pk_i_id' in C:\OpenServer\domains\oc-classrus.loc\oc-content\plugins\realestate_attributes\conf.php on line 109</p>
  
  <p>Warning: Illegal string offset 's_name' in C:\OpenServer\domains\oc-classrus.loc\oc-content\plugins\realestate_attributes\conf.php on line 109</p>
</blockquote>

<h1>Line 109</h1>

<pre><code>$data[$locale['pk_c_code']] = array('pk_i_id' =&gt; $c['pk_i_id'], 's_name' =&gt; $c['s_name']);
</code></pre>

<p>File</p>

<pre><code>&lt;?php if (!defined('OC_ADMIN') || OC_ADMIN!==true) exit('Access is not allowed.');
/*
 *      OSCLass – software for creating and publishing online classified
 *                           advertising platforms
 *
 *                        Copyright (C) 2010 OSCLASS
 *
 *       This program is free software: you can redistribute it and/or
 *     modify it under the terms of the GNU Affero General Public License
 *     as published by the Free Software Foundation, either version 3 of
 *            the License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful, but
 *         WITHOUT ANY WARRANTY; without even the implied warranty of
 *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *             GNU Affero General Public License for more details.
 *
 *      You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
?&gt;

&lt;?php
if(Params::getParam('plugin_action')!='') {
    if(Params::getParam('plugin_action')=="type_delete") {
        if(Params::getParam('id')!="") {
            ModelRealEstate::newInstance()-&gt;deletePropertyType( Params::getParam('id') ) ;
        }
    } else if(Params::getParam('plugin_action')=="type_add") {
        $dataItem = array();
        $request = Params::getParamsAsArray();
        foreach ($request as $k =&gt; $v) {
            if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                $dataItem[$m[1]][$m[2]] = $v;
            }
        }
        // insert locales
        $lastId = ModelRealEstate::newInstance()-&gt;getLastPropertyTypeId();
        $lastId = $lastId['pk_i_id'] + 1 ;
        foreach ($dataItem as $k =&gt; $_data) {
            ModelRealEstate::newInstance()-&gt;insertPropertyType($lastId, $k, $_data['property_type']);
        }
    } else if(Params::getParam('plugin_action')=="type_edit") {
        $property_type = Params::getParam('property_type');
        foreach($property_type as $k =&gt; $v) {
            foreach($v as $kj =&gt; $vj) {
                ModelRealEstate::newInstance()-&gt;replacePropertyType($k, $kj, $vj);
            }
        }
    }
}
?&gt;

&lt;div id="settings_form" style="border: 1px solid #ccc; background: #eee; "&gt;
    &lt;div style="padding: 20px;"&gt;
        &lt;div style="float: left; width: 50%;"&gt;
            &lt;fieldset&gt;
                &lt;legend&gt;&lt;?php _e('Property types', 'realestate_attributes'); ?&gt;&lt;/legend&gt;
                    &lt;form name="propertys_form" id="propertys_form" action="&lt;?php echo osc_admin_base_url(true);?&gt;" method="GET" enctype="multipart/form-data" &gt;
                    &lt;input type="hidden" name="page" value="plugins" /&gt;
                    &lt;input type="hidden" name="action" value="renderplugin" /&gt;
                    &lt;input type="hidden" name="file" value="realestate_attributes/conf.php" /&gt;
                    &lt;input type="hidden" name="section" value="types" /&gt;
                    &lt;input type="hidden" name="plugin_action" value="type_edit" /&gt;
                &lt;div class="tabber"&gt;
                &lt;?php $locales = osc_get_locales();
                    $property_type = ModelRealEstate::newInstance()-&gt;getPropertyTypes(false) ;
                    $data = array();
                    foreach ($property_type as $c) {
                        $data[$c['fk_c_locale_code']][] = array('pk_i_id' =&gt; $c['pk_i_id'], 's_name' =&gt; $c['s_name']);
                    }
                    $default = current($data);
                    if(is_array($default)) {
                    foreach($default as $d) {
                        $data['new'][] = array('pk_i_id' =&gt; $d['pk_i_id'], 's_name' =&gt; '');
                    }}
                ?&gt;
                    &lt;?php foreach($locales as $locale) {?&gt;
                        &lt;div class="tabbertab"&gt;
                            &lt;h2&gt;&lt;?php echo $locale['s_name']; ?&gt;&lt;/h2&gt;
                                &lt;ul&gt;
                                &lt;?php
                                    if(count($data)&gt;0) {
                                        foreach(isset($data[$locale['pk_c_code']])?$data[$locale['pk_c_code']]:$data['new'] as $property_type) { ?&gt;
                                            &lt;li&gt;&lt;input name="property_type[&lt;?php echo  $property_type['pk_i_id'];?&gt;][&lt;?php echo  $locale['pk_c_code'];?&gt;]" id="&lt;?php echo $property_type['pk_i_id'];?&gt;" type="text" value="&lt;?php echo  $property_type['s_name'];?&gt;" /&gt; &lt;a href="&lt;?php echo osc_admin_base_url(true);?&gt;?page=plugins&amp;action=renderplugin&amp;file=realestate_attributes/conf.php?plugin_action=type_delete&amp;id=&lt;?php echo  $property_type['pk_i_id'];?&gt;" &gt;&lt;button&gt;&lt;?php _e('Delete', 'realestate_attributes'); ?&gt;&lt;/button&gt;&lt;/a&gt; &lt;/li&gt;
                                        &lt;?php };
                                    }; ?&gt;
                                &lt;/ul&gt;
                        &lt;/div&gt;
                        &lt;?php }; ?&gt;
                        &lt;button type="submit"&gt;&lt;?php _e('Edit', 'realestate_attributes'); ?&gt;&lt;/button&gt;
                    &lt;/form&gt;
                &lt;/div&gt;
            &lt;/fieldset&gt;
        &lt;/div&gt;
        &lt;div style="float: left; width: 50%;"&gt;
            &lt;fieldset&gt;
                &lt;legend&gt;&lt;?php _e('Add new property types', 'realestate_attributes'); ?&gt;&lt;/legend&gt;
                &lt;form name="propertys_form" id="propertys_form" action="&lt;?php echo osc_admin_base_url(true); ?&gt;" method="GET" enctype="multipart/form-data" &gt;
                    &lt;input type="hidden" name="page" value="plugins" /&gt;
                    &lt;input type="hidden" name="action" value="renderplugin" /&gt;
                    &lt;input type="hidden" name="file" value="realestate_attributes/conf.php" /&gt;
                    &lt;input type="hidden" name="plugin_action" value="type_add" /&gt;

                    &lt;div class="tabber"&gt;
                    &lt;?php $locales = osc_get_locales();
                        $data = array();
                        foreach ($property_type as $c) {
                            $data[$locale['pk_c_code']] = array('pk_i_id' =&gt; $c['pk_i_id'], 's_name' =&gt; $c['s_name']);
                        }
                    ?&gt;
                    &lt;?php foreach($locales as $locale) {?&gt;
                        &lt;div class="tabbertab"&gt;
                            &lt;h2&gt;&lt;?php echo $locale['s_name']; ?&gt;&lt;/h2&gt;
                            &lt;input name="&lt;?php echo  $locale['pk_c_code'];?&gt;#property_type" id="property_type" type="text" value="" /&gt;
                        &lt;/div&gt;
                    &lt;?php }; ?&gt;
                    &lt;/div&gt;
                    &lt;button type="submit" &gt;&lt;?php _e('Add new', 'realestate_attributes'); ?&gt;&lt;/button&gt;
                &lt;/form&gt;
            &lt;/fieldset&gt;
        &lt;/div&gt;
        &lt;div style="clear: both;"&gt;&lt;/div&gt;                                        
    &lt;/div&gt;
&lt;/div&gt;
&lt;div id="settings_form" style="border: 1px solid #ccc; background: #eee; "&gt;
    &lt;div style="padding: 20px;"&gt;
        &lt;div style="float: left; width: 100%;"&gt;
            &lt;fieldset style="border: 1px solid #ff0000;"&gt;
                &lt;legend&gt;&lt;?php _e('Warning', 'realestate_attributes'); ?&gt;&lt;/legend&gt;
                &lt;p&gt;
                    &lt;?php _e('Deleting property types may end in errors. Some of those property types could be attached to some actual items', 'realestate_attributes') ; ?&gt;.
                &lt;/p&gt;
            &lt;/fieldset&gt;
        &lt;/div&gt;
        &lt;div style="clear: both;"&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>