We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Undefined offset: 1 function.text.php | Forum

Topic location: Forum home » Support » General Questions
natalie gain
natalie gain Oct 16 '18

Hi, i got this error, can you pls help me fix it?


[Tue Oct 16 13:47:40 2018] [ow_core_log] [Notice] Message: Undefined offset: 1 File: /var/www/html/ow_smarty/plugin/function.text.php Line:10


<?php


function smarty_function_text($params, $smarty, $prefix)

{

    // Reserved params

    $keys = array(

        "key", "escape"

    );

    

    list($prefix, $key) = explode('+', $params["key"]);

    $out = OW::getLanguage()->text($prefix, $key, array_diff_key($params, array_flip($keys)));

    

    if ( isset($params["escape"]) )

    {

        // Load built in smarty modifier

        $smarty->loadPlugin("smarty_modifier_escape");

        

        // Call built in smarty modifier 

        $out = smarty_modifier_escape($out, $params["escape"]);

    }

                

    return $out;

}

The Forum post is edited by natalie gain Oct 16 '18
AppXprt
AppXprt Oct 16 '18
Sounds like you're accessing an array with an undefined index / key.

Which line is line 10?
natalie gain
natalie gain Oct 16 '18
  line 10: list($prefix, $key) = explode('+', $params["key"]);

thank you very much

Mike
Mike Oct 16 '18

It seems a plugin is calling the {text key="yourplugin+mystrin" } smarty function without the "key" parameter.


Is there any stacktrace with this message? Then you could locate the error and fix it.


Otherwise you would have to search for ever {text and check if the key parameter is given.