1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Warning: preg_split() expects parameter 2 to be string, array

Discussion in 'Community' started by bharvey63, Nov 9, 2009.

  1. bharvey63

    bharvey63 New Member

    Level: Community
    Warning: preg_split() expects parameter 2 to be string, array given in /home/bharvey/txtspecials.com/libraries/joomla/utilities/simplecrypt.php on line 190

    This occurs when three things are in effect:

    1) use the "redirect" submission plugin

    2) select the option to "Append jump url with data"

    3) have a dropdown box

    It happens because the dropdown box's name has array brackets appended to it, so a name like "ST" translates to "__ST[]"

    I would like to fix this - any leads?

    Regards,

    -B
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Are you running the most recent nightly build or SVN?

    -- hugh
     
  3. nine007

    nine007 Member

    Level: Community
    Same error

    Hallo there

    I get that same error with latest svn.
     
  4. bharvey63

    bharvey63 New Member

    Level: Community
    I'm running 2.0rc3

    Regards,

    -B
     
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Update to the latest nightly build.

    -- hugh
     
  6. goinsouth

    goinsouth New Member

    Level: Community
    I'm still getting that error with the SVN from 11/11. Same conditions as described by bharvey.
     
  7. fedepia

    fedepia Active Member Staff Member

    Level: Community
    just for know... are you running php 5.3 ?? If so.. that could be the problem
     
  8. goinsouth

    goinsouth New Member

    Level: Community
    The site is running php 5.2.9.
     
  9. mister_l

    mister_l New Member

    Level: Community
    Hi there,

    I get the following error messages on the frontend when I display a table (just following the tutorial...):

    Warning: Parameter 2 to plgContentEmailCloak() expected to be a reference, value given in C:\xampp\htdocs\joomla15\libraries\joomla\event\dispatcher.php on line 136

    Warning: Parameter 2 to plgContentLoadModule() expected to be a reference, value given in C:\xampp\htdocs\joomla15\libraries\joomla\event\dispatcher.php on line 136

    Warning: Parameter 2 to plgContentPagebreak() expected to be a reference, value given in C:\xampp\htdocs\joomla15\libraries\joomla\event\dispatcher.php on line 136


    I get this with the latest Nightly Build: com_fabrik_2.0rc3_19-11-2009.zip

    Any ideas what I can do to get rid of these warnings?

    Thanks!
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Doesn't look like a Fabrik problem, never seen those warnings before.

    Is this using the {fabrik ...} content plugin?

    -- hugh
     
  11. goinsouth

    goinsouth New Member

    Level: Community
    But what about the original topic of this thread?

    The preg_split() warning.

    That does seem to be a Fabrik issue. What can be done?
     
  12. mister_l

    mister_l New Member

    Level: Community
    Sorry to 'interfere' with your thread, I thought my problem is a similar issue. Will start a new thread.
     
  13. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Are you actually specifying a jump URL?

    I can't replicate this, either way - even with dropdowns on the form, it redirects and appends the jump data.

    BTW, are you running a recent nightly build or SVN? I seem to recall fixing this a while back ...

    -- hugh


     
  14. goinsouth

    goinsouth New Member

    Level: Community
    In my case, the data is appended, but the warning still appears.

    I'm running the SVN from 11/11.

    And looking upthread, it seems that others running more or less current versions are having this problem.
     
  15. bharvey63

    bharvey63 New Member

    Level: Community
    My site (Dreamhost) is running:

    PHP 4.4.9 (cli) (built: Sep 17 2008 12:02:18)

    I do agree though that this might be a Joomla "bug". I guess the question is whether or not having square brackets in field name should be "legal".

    I think it's worth bringing this up on the Joomla dev forum. Agreed?

    -B
     
  16. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Ah, PHP v4. I'd strongly suggest switching to PHP5. We (Fabrik) don't support PHP4 any more (it's a dead language, not even supported by the PHP authors any more), and as time goes by, I suspect more and more PHP5 vs PHP4 errors are going to creep in to J!.

    See if you host can bump you up to at least 5.1.x, preferably 5.2.x. I'd avoid 5.3 for the moment, until we / Joomla have had a little more time to sort out some issues with it.

    As for [] in HTML field names, it's perfectly legal. Just means you have multiple HTML elements with the same name, and they get submitted as an array.

    -- hugh
     
  17. bharvey63

    bharvey63 New Member

    Level: Community
    simplecrypt.php

    Point taken on both the brackets and php version. Now it comes down to the "simplecrypt.php" function. I'll look at the source and try to figure out the best fix and/or upgrade.

    Many thanks for the quick feedback...

    -B
     
  18. bharvey63

    bharvey63 New Member

    Level: Community
    Followup:

    Here's the offending line in simplecrypt() line 190:

    $ac = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY);

    Changing it to either this:

    $ac = preg_split('//', "$s", -1, PREG_SPLIT_NO_EMPTY);

    or this:

    $ac = preg_split('//', (string) $s, -1, PREG_SPLIT_NO_EMPTY);

    suppresses the warning message but in both cases, it still "thinks" it's an array, i.e. my form won;t work properly. I don't think PHP 5 would be different, but it's worth checking. (anyone?)

    So, working around this, the question is:

    1) How to get preg_split to not treat $s as an array?

    2) How to not call simplecrypt at all (if possible and reasonable)?

    Regards,

    -B
     
  19. bharvey63

    bharvey63 New Member

    Level: Community
    More followup:

    Even this:

    print "State: " . $_GET['___State'] . "<p>";

    prints "State: array" on the page, In other words, php is VERY aggressive about treating the string as an array. So, not that this is Fabrik's fault, but it seems that suffixing a string with "[]" is just asking for trouble.

    Any ideas?

    -B
     
  20. bharvey63

    bharvey63 New Member

    Level: Community
    More:

    Actual php version is 5.2.9 (shell runs 4 but phpinfo says PHP Version 5.2.9)

    explode("",$_GET['___State']) would probably work, but doesn't take "" as a delimiter....

    Brick walls everywhere I turn (no offense to you folks, your support has been great, but this php issue is killing me)
     

Share This Page