Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 42
  1. #21
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,136
    Plugin Contributions
    11

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    Steve,
    I imagine you already have, but I can't resist asking if you did a winmerge of the old and new just in case.

  2. #22
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    Thanks for the interest.

    This is exactly what I have in the live shop code:

    PHP Code:
           while (list($key$value) = each($_GET)) {
          if (
    is_array($value)) trigger_error('GET param found to be array: ' print_r($valuetrue) . '  --- contents of GET: ' print_r($_GETtrue));//steve looking for reason, as per http://www.zen-cart.com/forum/showthread.php?t=176804
            //if ( (strlen($value) > 0) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {//steve original line 
        
    if ( (!in_array($key$exclude_array)) && (strlen($value) > 0) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {//steve this line edited to stop debug error as per http://www.zen-cart.com/forum/showthread.php?p=1070316#post1070316
              
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) { 
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #23
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    Its odd that this error is not triggered always..?
    just got another, the first one since the 17th...
    Can I do further testing or just forget it?

    [25-Oct-2011 23:12:41] PHP Notice: GET param found to be array: Array
    (
    [0] => 210
    )
    --- contents of GET: Array
    (
    [main_page] => index
    [action] => notify
    [notify] => Array
    (
    [0] => 210
    )

    )
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  4. #24
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,136
    Plugin Contributions
    11

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    I've never known it to block a sale.
    But, as I stated earlier, we've had no problems on any site since changing to the suggested fix.
    Sorry I can't be of more help.

  5. #25

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    From my experience, this has to do with the "notify" stuff, I am using the Caixa sermepa module and kept having troubles of orders paid but not showing up on my shop.

    Do not use the "notify" option, I do not know how your module works but you should be able to disable this.

    Won't change anything to the way the program works, you will be notified for each order anyway but your bank will stop trying to send you a mail for this.

    In my case, this was where the problem was: the notification url in the module.

    Hope this help!


  6. #26
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    I get this error across all payment modules.
    It could be a week between occurrences so no obvious pattern.

    I do use Advanced Shipper so in effect it has the same shipping module in use every time so you could throw mud at that but the developer says not guilty (and is to be trusted).
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  7. #27
    Join Date
    Dec 2011
    Posts
    2
    Plugin Contributions
    0

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    The issue is that you are on PHP 5.3 and that changed the way that strlen handles arrays.

    Before 5.3 strlen would return the word array for any array - hence feeding a string into the function - from 5.3 it returns NULL instead and strlen fails.

    I had the same problem and fixed it by counting the elements in the array instead.

    so:

    PHP Code:
        if ( (!in_array($key$exclude_array)) && (strlen($value))> 0) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {//steve this line edited to stop debug error as per http://www.zen-cart.com/forum/showthread.php?p=1070316#post1070316
              
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) { 
    would become

    PHP Code:
        if ( (!in_array($key$exclude_array)) && (count($value) > 0) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
              if ( (
    SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) { 
    This assuming that you know you are always getting an array returned. If not then you would need to test if it was an array or a string earlier and set a flag to test against

  8. #28
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    I had the same problem and fixed it by counting the elements in the array instead.
    Thanks for sharing that.
    Maybe I'll be able to sleep at night now with no fear of random debugs in the morning!
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  9. #29
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    Quote Originally Posted by Aureanus View Post
    This assuming that you know you are always getting an array returned.
    Therein is the problem. It is almost NEVER getting an array. The ONLY time it gets an array is when the product-notifications screen is presented. The zillion other times that the function is used there is no array passed at all.
    I submit that your proposed fix is likely to cause the entire function to not return the right results, thus preventing normal operation of the majority of cases where this function is called.
    Thus, its NOT SAFE to be used on live sites, unless of course you want to encounter lost sales and poor customer experience while shopping.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #30
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: PHP Warning: strlen() expects parameter 1 to be string

    Thus, its NOT SAFE to be used on live sites, unless of course you want to encounter lost sales and poor customer experience while shopping.
    Assuming that the php version is causing this as Aureanus asserts, I (for one) would be happy to trial a fix...I still get these irritating errors most days.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. v153 PHP Warning: addslashes() expects parameter 1 to be string
    By BlackOrchidCouture in forum General Questions
    Replies: 2
    Last Post: 17 Sep 2014, 10:47 PM
  2. PHP Warning: addslashes() expects parameter 1 to be string, array given
    By schoolboy in forum All Other Contributions/Addons
    Replies: 11
    Last Post: 10 May 2013, 02:19 PM
  3. v139e PHP Warning: strlen() expects parameter 1 to be string, array given in
    By irishshopper in forum Basic Configuration
    Replies: 4
    Last Post: 7 Mar 2013, 08:06 PM
  4. v139h PHP Warning: strip_tags() expects parameter 1 to be string, array given
    By BlessIsaacola in forum General Questions
    Replies: 1
    Last Post: 6 Mar 2012, 01:32 PM
  5. v150 PHP Warning: strlen() expects parameter 1 to be string, array given
    By caffeitalia in forum General Questions
    Replies: 1
    Last Post: 1 Feb 2012, 03:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR