Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Location
    Victor Harbor, SA
    Posts
    11
    Plugin Contributions
    0

    Default [Not a core ZC bug] Search returning invalid keyword error

    Zen 1.38a running on php 5.2.9 and MySql 5.081 Community

    The search in the store continually returned "Invalid keyword" messages no matter what the input.
    I searched but could find no reference.

    After a day and a half of frustration and eventually with the help of the Debug Error Logging Utility - thank you, DrByte - I found the following error every time the search was run:
    [18-Nov-2009 20:42:34] PHP Warning: preg_split() [<a href='function.preg-split'>function.preg-split</a>]: Unknown modifier '+'
    in /home/<mysite>/public_html/includes/functions/functions_general.php on line 235

    This is the code there:
    $pieces = preg_split('[[:space:]]+', $search_str);

    Did some research and finally added '/' delimiters around the left square bracket and the plus sign and the error went away and the search functioned as it should.

    The code now looks like this:
    $pieces = preg_split('/[[:space:]]+/', $search_str);

    The file was the stock standard 1.38a one so I'm guessing it's some setting in php or something, causing this.

    Hope this might be of some help to someone.

    grantgee.
    Last edited by grantgee; 18 Nov 2009 at 10:22 PM.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Search returning invalid keyword error

    Actually, someone has edited your original file.

    v1.3.8a contains the following:
    Code:
        $pieces = split('[[:space:]]+', $search_str);
    (note the use of the split() function instead of preg_split() )

    I wonder if you've got some addon installed that has altered the file.

    I know PHP 5.3 deprecates the use of split() in favor of preg_split, but as you've seen, doing that requires the addition of delimiters in the call, as you posted.

    The official PHP 5.3 patch for Zen Cart v1.3.8 already includes the appropriate delimiters.
    .

    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.

  3. #3
    Join Date
    Jul 2007
    Location
    Victor Harbor, SA
    Posts
    11
    Plugin Contributions
    0

    Default Re: Search returning invalid keyword error

    Quote Originally Posted by DrByte View Post
    Actually, someone has edited your original file.
    Yes, you are right, DrByte.
    I was mistaken and the original file does indeed use "Split".
    No wonder no-one else had the problem!
    Not sure how it happened because none of the addons touched it but I do remembering replacing some splits for a Drupal problem on php 5.3 and I may have nuked all the splits in the wrong folder!
    Oh well, all else seems okay - running like a clock.
    Thanks,
    grantgee

 

 

Similar Threads

  1. v154 [Not a bug] /** CDN for jQuery core **/
    By rbarbour in forum Bug Reports
    Replies: 10
    Last Post: 4 Mar 2015, 03:24 AM
  2. [Not a ZC core bug] Swedish Weekday in product_info
    By FrilansReklam in forum Bug Reports
    Replies: 2
    Last Post: 27 Feb 2013, 07:39 PM
  3. v150 [Not a ZC core bug] ckeditor.php addon calls insecure site
    By The Other Air Force in forum Bug Reports
    Replies: 0
    Last Post: 22 Mar 2012, 03:53 AM
  4. Search/Advanced Search not returning results
    By scottfr in forum Setting Up Categories, Products, Attributes
    Replies: 11
    Last Post: 6 Apr 2011, 06:08 AM
  5. Search and Advanced search not returning results
    By paisore in forum General Questions
    Replies: 6
    Last Post: 4 Nov 2010, 03:43 PM

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