-
PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Hello! We recently upgraded from Zen-Cart 1.5.6a to 1.5.8 and PHP 7.3.33 to 8.0. We are now having an issue with the search function.
It works fine when searching single words, but searching anything with a space gives a blank page with the error: “WARNING: An Error occurred, please let us know!”. The issue is the same for both the public-facing search and the admin search. In an admin search the error message is: "WARNING: An Error occurred, please let us know! If you were entering information, please press the BACK button in your browser and re-check the information you have entered to be sure you entered valid data." Searching multiple words does not result in an error message when we use quotes around the phrase, however it does not give any results for key words unless they are entered exactly as they appear in the product.
We are currently running MySQL 10.3.38-MariaDB-log.
We checked the error logs and see the following (example case searching the phrase “two words”, with some info redacted for privacy):
[11-Feb-2023 16:00:31 America/XXXXX] Request URI: /index.php?main_page=search_result&search_in_description=1&keyword=two+words, IP address: X.X.X.X, Language id 1
#1 trigger_error() called at [/home/XXXXX/public_html/includes/classes/db/mysql/query_factory.php:667]
#2 queryFactory->show_error() called at [/home/XXXXX/public_html/includes/classes/db/mysql/query_factory.php:634]
#3 queryFactory->set_error() called at [/home/XXXXX/public_html/includes/classes/db/mysql/query_factory.php:275]
#4 queryFactory->Execute() called at [/home/XXXXX/public_html/includes/classes/split_page_results.php:105]
#5 splitPageResults->__construct() called at [/home/XXXXX/public_html/includes/modules/pages/search_result/header_php.php:459]
#6 require(/home/XXXXX/public_html/includes/modules/pages/search_result/header_php.php) called at [/home/XXXXX/public_html/index.php:35]
--> PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'OR pd.products_name LIKE '%words%' OR p.products_model LIKE '%words%' OR m...' at line 1 :: select count(distinct p.products_id) as total FROM (products p LEFT JOIN manufacturers m USING(manufacturers_id), products_description pd, categories c, products_to_categories p2c ) LEFT JOIN meta_tags_products_description mtpd ON (mtpd.products_id= p2c.products_id AND mtpd.language_id = 1) WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND ( ( pd.products_name LIKE '%two%' OR p.products_model LIKE '%two%' OR m.manufacturers_name LIKE '%two%' OR mtpd.metatags_keywords LIKE '%two%' OR mtpd.metatags_description LIKE '%two%' OR pd.products_description LIKE '%two%') AND ( OR pd.products_name LIKE '%words%' OR p.products_model LIKE '%words%' OR m.manufacturers_name LIKE '%words%' OR mtpd.metatags_keywords LIKE '%words%' OR mtpd.metatags_description LIKE '%words%' OR pd.products_description LIKE '%words%') )) ==> (as called by) /home/XXXXX/public_html/includes/classes/split_page_results.php on line 105 <== in /home/XXXXX/public_html/includes/classes/db/mysql/query_factory.php on line 667.
We haven't modified any of the files that are mentioned in the error log. We're not sure where to look next at this stage... any help would be greatly appreciated!
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
getting the same in sites with up-to-the-minute 1.5.8
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
i am unclear if you did the upgrade correctly. i would replace these 2 files with these current live files:
https://github.com/zencart/zencart/b...ons_search.php
https://github.com/zencart/zencart/b...ge_results.php
you can click on the raw button towards the top or the copy icon a couple of icons over to get a copy of said file.
replace those 2 files, and let us know if that resolves the problem.
in your error log, the sql statement does have an extra `or` which is causing the problem. but on my version on v158, it does not include that extra or.
best.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
We are using the functions_search.php from two weeks ago and split_page_results from four months ago on github.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Not seeing this when testing current contents of github (pre-1.5.8a).
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
carlwhat
Replacing those 2 files resolved the issue and everything works perfectly now. Many thanks!
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Search is not working properly in my fresh install of 1.5.8a. My installation specifics are at the end of this post.
I downloaded a new copy on Jan 21 and I have 2 fresh installs...one with no mods and the other with zca_bootstrap. These are my fallback troubleshooting installs to make sure any changes I make to my plug-in are not what is causing any issues I run into.
This search:
Code:
https://localhost/zencart-1.5.8a_unmodified/index.php?main_page=search_result&keyword=.+or+-&search_in_description=1&categories_id=&inc_subcat=1&manufacturers_id=&pfrom=100&pto=200&dfrom=&dto=
#1 - returns every single product in the catalog...regardless of price.
#2 - I had to put in a period or dash in the text box...leaving it blank is not allowed and putting a single space in makes it look like the search is empty. Being empty or allowing spaces should be allowed. If I want to do a price range search, I want it to return all products in that price range.
#3 - Same issue if you select a single manufacturer...text box can't be blank or have a single space. What if I want to see all of that manufacturers products? I know, there are other tools for doing that but those tools disappear on mobile devices or smaller screens now.
#4 - Same issue when selecting a category...
Where and how do I allow the text box to be empty or contain a space? I have mods on my 1.5.7d cart which are highly dependent on the search mechanism...those mods are useless in 1.5.8a unless I fix whatever is causing this behavior.
I will try the two files on github that are mentioned above. I just wanted the community to know that this is still an issue since I downloaded the 1.5.8a on Jan 21.
Thanks.
Server Host: localhost (127.0.0.1)
Database: zc158a_ezfeeds_jce_bootstrap
Store Home: C:/xampp/htdocs/zencart-1.5.8a_ezfeeds_jce_bootstrap/
Server OS: Windows NT DESKTOP-4B8U62U 10.0 build 19045 (Windows 10) AMD64
Server Date: 01/30/2024 10:24:55
Server Up Time: Unsupported
HTTP Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.0.23
PHP Version: 8.0.23 (Zend: 4.0.23)
PHP File Uploads: On
Upload Max Size: 512M
PHP Memory Limit: -1
POST Max Size: 1024M
Database Engine: MySQL 10.4.25-MariaDB
Database Host: localhost (127.0.0.1)
Database Date: 01/30/2024 10:24:55
Database Data Size: 831 kB
Database Index Size: 788 kB
MySQL Slow Query Log Status: Off
MySQL Slow Query Log File: DESKTOP-4B8U62U-slow.log
MySQL Mode: NO_ZERO_IN_DATE, NO_ZERO_DATE, NO_ENGINE_SUBSTITUTION
View the database configuration variables
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
I downloaded and installed the new files from github and they broke my install...white screen of death.
I saved the original files and will reinstall them.
I will dig in to see what is causing this...appreciate any and all help.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
just as fyi, i can confirm that on v158a, the page:
index.php?main_page=search_result&keyword=.+or+-&search_in_description=1&categories_id=&inc_subcat=1&manufacturers_id=&pfrom=100 &pto=200&dfrom=&dto=
returns all products.
on the v200-alpha, the query returns all products from 100-200 and ones that are marked call for price.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
carlwhat
just as fyi, i can confirm that on v158a, the page:
index.php?main_page=search_result&keyword=.+or+-&search_in_description=1&categories_id=&inc_subcat=1&manufacturers_id=&pfrom=100 &pto=200&dfrom=&dto=
returns all products.
on the v200-alpha, the query returns all products from 100-200 and ones that are marked call for price.
Thanks for confirming.
I will download 2.0 and put relevant files in 1.5.8a to see if it corrects.
What are the relevant files?
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
....
What are the relevant files?
oh my....
if only it was 1 file...
i think you are looking for a world of hurt here... and if i were to point you in the direction of which files are necessary, i would get caught up into more than i would like to chew right now...
and then there is the potential wrist slap for directing people to use code not yet released....
the difference in searching between 158a and 200 are vast, a new class file and the like (of which i am a fan)... but whether that class file is automatically loaded or you need some load config files to get that class loaded, i can not say... far too much work/time for me to dig into at the moment...
perhaps someone else could help... the code is all out on github, but for me to help... well, this is a task for someone with more time and inclination...
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Well $%^^...that puts a damper on my upgrade.
I appreciate your honesty and insight.
I'll dig in to the 1.5.8a files and see where it leads me.
I built a good search engine for mass moving of products. Maybe I can adapt it for my purposes until 2.0 releases.
Thanks.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
I think I figured out why the pricing search isn't working.
If you use 0 for the from price and 25 for the to price, it fails every time.
But if you use 0.00 - 25.00, it returns products in that price range.
So, something has to be put in the header_php.php to account for no decimals being used on the input page.
I.E. if $pfrom or $pto do not contain a decimal, then put .00 on the end of them so everything will work.
I'll be trying to figure out where that needs to happen, but, if anyone knows where to do it, I'd appreciate the info.
I did verify this test on a fresh install with no modifications...as long as you use decimals, it works.
Thanks.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
...
I'll be trying to figure out where that needs to happen, but, if anyone knows where to do it, I'd appreciate the info.
...
Thanks.
mike eel!!
you did the hard work, i'll do the easy part....
try replacing this file with the version in this link.
in my development suite, taking a v158a release and replacing that file gives the expected results.
as to what else may be disturbed by that change, i will leave it to you to figure out...
actually, in looking at the file, the only thing changed was the bug that you found that was addressed. and another addition for sanitizing sale_category.
i think no problems...
the change is on line 120, you need an added ?
PHP Code:
//from
if (isset($_GET[$key]) && !preg_match('/^\d+(\.\d+)/', $_GET[$key])) {
//to
if (isset($_GET[$key]) && !preg_match('/^\d+(\.\d+)?/', $_GET[$key])) {
let us know if that works.
best.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Thanks. I would have never figured that out since I am vaguely familiar with that coding.
I'll plugin the change after breakfast.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
carlwhat
mike eel!!
you did the hard work, i'll do the easy part....
try replacing
this file with the version in this link.
in my development suite, taking a v158a release and replacing that file gives the expected results.
as to what else may be disturbed by that change, i will leave it to you to figure out...
actually, in looking at the file, the only thing changed was the bug that you found that was addressed. and another addition for sanitizing sale_category.
i think no problems...
the change is on line 120, you need an added ?
PHP Code:
//from
if (isset($_GET[$key]) && !preg_match('/^\d+(\.\d+)/', $_GET[$key])) {
//to
if (isset($_GET[$key]) && !preg_match('/^\d+(\.\d+)?/', $_GET[$key])) {
let us know if that works.
best.
The missing ? definitely fixed the issue in the unmodified install.
It helps in my plugin, but, the pagination disappears when I go to the second page of the results.
I'm not finished with merging all of my changes yet, so, I'll wait and see how it works after that is done.
Thanks again.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
Search is not working properly in my fresh install of 1.5.8a. My installation specifics are at the end of this post.
I downloaded a new copy on Jan 21 and I have 2 fresh installs...one with no mods and the other with zca_bootstrap. These are my fallback troubleshooting installs to make sure any changes I make to my plug-in are not what is causing any issues I run into.
This search:
Code:
https://localhost/zencart-1.5.8a_unmodified/index.php?main_page=search_result&keyword=.+or+-&search_in_description=1&categories_id=&inc_subcat=1&manufacturers_id=&pfrom=100&pto=200&dfrom=&dto=
#1 - returns every single product in the catalog...regardless of price.
#2 - I had to put in a period or dash in the text box...leaving it blank is not allowed and putting a single space in makes it look like the search is empty. Being empty or allowing spaces should be allowed. If I want to do a price range search, I want it to return all products in that price range.
#3 - Same issue if you select a single manufacturer...text box can't be blank or have a single space. What if I want to see all of that manufacturers products? I know, there are other tools for doing that but those tools disappear on mobile devices or smaller screens now.
#4 - Same issue when selecting a category...
Any further joy on this?
I am also struggling with the search on 158a and am experiencing issues #1 and #2 as listed here.
I've replaced the suggested files but am getting some odd results.
My gripe is getting search by price range to work as it should.
After replacing the files, in some instances it appears to work as it should.
In another test though where I entered a price range, it only shows products with a '+' in the title!
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Further to this.
I am specifically testing to find products on my site with a price of $48.
With the init_sanitise fix in place I'm getting results like this -
(In all these tests I have something in the keywords)-
From $48 to $48 - I get all appropriately priced products with a '+' in the title
From $40 to $48 - same result
From $0 to $48 - it seems to work as it should.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
royaldave
Further to this.
I am specifically testing to find products on my site with a price of $48.
With the init_sanitise fix in place I'm getting results like this -
(In all these tests I have something in the keywords)-
From $48 to $48 - I get all appropriately priced products with a '+' in the title
From $40 to $48 - same result
From $0 to $48 - it seems to work as it should.
Try putting 0.00 and 48.00 for the search.
If it works, you are missing the aforementioned question mark in sanitize file.
Mine started working after I updated the sanitize file.
Good luck.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
Try putting 0.00 and 48.00 for the search.
If it works, you are missing the aforementioned question mark in sanitize file.
Mine started working after I updated the sanitize file.
Good luck.
I have tried that. Updating the sanitize makes it better, but it doesn't work 100%.
As per my examples above, if I do 48 to 48 it only shows products with a '+' in the title (why?)
Same for 46 to 48, and 47 to 48.
However if I do 45 to 48 it works as it should! And also 0 to 48.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Hmmm...not sure what's happening.
I will try your scenario on my unmodified installs after breakfast.
The search mechanism could use some improvements like checkboxes for sale price, regular price, free shipping, in stock,, and anything else that would limit the customers ability to get the product. It would help store owners too.
I may try to work on improvements after I finish updating my cart.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
royaldave
I have tried that. Updating the sanitize makes it better, but it doesn't work 100%.
As per my examples above, if I do 48 to 48 it only shows products with a '+' in the title (why?)
Same for 46 to 48, and 47 to 48.
However if I do 45 to 48 it works as it should! And also 0 to 48.
In my unmodified 1.5.8a install...except for the init_sanitize.php modification.
I typed in 45 to 50 in just the price range text boxes to see what items show up in that price range...and to verify if I have a $48 item in my cart.
I had four $50s (one sale priced), two $49.99 items, and one $45.00 item.
Next, I searched $50 to $50, $49 to $50, $45 to $45, and $49.99 to $49.99 and all yielded the expected results.
I took it one step further and compared all of these results against the prices in the database price and sale price information.
The catalog search mechanism is picking up everything it is supposed to in my case.
Sale prices are the determining / overriding factor with regards to showing them in the search results...which is good. So, If you are expecting to see a $48 normally priced item with a sale price that is out of your search range, then you are not going to see it in the results.
Make sure you have a $48 non-sale item and a $48 sale item in your cart (thanks Capt Obvious...LOL). Then, repeat the test I just did.
If you are still having issues, report it here and someone will hopefully help you. I don't see a problem with the search engine.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
You're right.
I did a fresh install and it works (with the init_sanitise amendment of course).
I think multisite is interfering with the search. And it's probably been a problem for a long time because my live 157 install is showing the same!
Damn! Have I never tested this before???
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
royaldave
You're right.
I did a fresh install and it works (with the init_sanitise amendment of course).
I think multisite is interfering with the search. And it's probably been a problem for a long time because my live 157 install is showing the same!
Damn! Have I never tested this before???
Actually I take back what I just said. I've gone back to the fresh install and am getting inconsistent results. Some queries work better than others, but I still feel there's something not right about searching in a price range.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
What is multisite and is your fresh install on it?
I am out of ideas...can anyone else shead any light on this?
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Multisite is a plugin that allows multiple domain names/templates to point to one zencart install - and it allows you to choose which categories are listed on each domain.
The "cat_filter" in this plugin immediately jumps out as the likely culprit - however when I say fresh install I do mean unzipping the zencart.zip and not making any amendments.
I really tied myself in knots with this the other night and need a fresh pair of eyes to go over it again in case my thinking was not correct - so will come back to this.
I think previously I've removed the price from/to from the search page (and always the dates) and re-introduced them to my 157 install. I'm quite happy to remove them again to get my 158 install live and I will come back to this.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Good plan.
I have been upgrading since Jan 21...I finally resolved all of my log errors and issues yesterday!
Next...file taxes.
Good luck.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
OK, my 158 upgrade has worked fine so I'm back to investigating this.
I have freshly unzipped the 158 onto my server at home and am getting the same results.
Without updating the init_sanitize file, doing a price range without the .00 added to the price values causes the search to basically ignore that criteria and display all matching products at any price.
However even with the .00 added, doing my from:48.00 to:48.00 or from:47.00 to:48.00 will display nothing that should match - except products that have a '+' in the title will show up!
When I update the init_sanitize file as recommended all it means I can get the same results by entering from:48 to:48 - ie I don't need the .00 anymore.
It's a strange one.
Maybe it's an issue with my DB - but everything else works!
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
OK, I have kind of worked out the problem here.
This section of code in header_php.php in modules/search_result
if (DISPLAY_PRICE_WITH_TAX == 'true') {
if ($pfrom) {
$where_str .= " AND (p.products_price_sorter * IF(gz.geo_zone_id IS null, 1, 1 + (tr.tax_rate / 100)) >= :price)";
$where_str = $db->bindVars($where_str, ':price', $pfrom, 'float');
}
if ($pto) {
$where_str .= " AND (p.products_price_sorter * IF(gz.geo_zone_id IS null, 1, 1 + (tr.tax_rate / 100)) <= :price)";
$where_str = $db->bindVars($where_str, ':price', $pto, 'float');
}
} else {
if ($pfrom) {
$where_str .= " and (p.products_price_sorter >= :price)";
$where_str = $db->bindVars($where_str, ':price', $pfrom, 'float');
}
if ($pto) {
$where_str .= " and (p.products_price_sorter <= :price)";
$where_str = $db->bindVars($where_str, ':price', $pto, 'float');
}
}
What is P.products_price_sorter all about?
If I replace that with p.products_price I get the desired result!
Actually now i know what the issue is - not too long ago I decided to increase all products with a $45 price tag to $48 and I did a quick and dirty sql query in admin to change the price. I didn't realise there was this price_sorter field so my sql query didn't take care of it. What's it for anyway?
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Price sorter is the sale price...
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
Price sorter is the sale price...
I see, well I won't be doing that again..
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
The search by date function is broken as well.
In my unmodified cart, I changed the first graphic card due date to a couple of months out and made it zero balance.
It shows up on the Upcoming Products list just fine, but when you search for 03/14/2024 to 05/15/2024, nothing comes back.
It is definitely buggy.
I'll see what I can figure out, but if someone knows the fix for this, I'd appreciate it.
-
2 Attachment(s)
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Modifying the includes/modules/pages/search_result/header_php.php file fixed my date search problems and empty breadcrumb issues as well.
Search for "mikeel100" in the attached header_php.zip file and you can see the changes I made.
I also modified includes/init_includes/overrides/init_add_crumbs.php...see the zip file.
Keep in mind, these attached files are from my customized cart where I have added center boxes for All Products, Upcoming, Price Range, Free Shipping, and Best Sellers. All of my center and sideboxes are pulled from a function I developed that totally bypasses modules and modules/sideboxes.
All of the changes I made to these files may not work for you. It's a start though...and I hope it helps someone.
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
This constant, ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM, in the init_add_crumbs files has to be in YOUR_TEMPLAGE/lang.english
'ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM' => '01/01/1900',
$dfrom = ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM has to be set in any link leading to New Products. In my case, it is in my custom function. You should find or put similar code in the modules and sideboxes new products files.
PHP Code:
case ADVANCED_SEARCH_HEADING_NEW_PRODUCTS:
$dto = date('m/d/Y');
if (SHOW_NEW_PRODUCTS_LIMIT == 0) {
$dfrom = ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM;
} else {
$dfrom = strtotime ( '-' . SHOW_NEW_PRODUCTS_LIMIT . ' day' , strtotime ( $date ) ) ;
$dfrom = date('m/d/Y', $dfrom );
}
-
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
In trying fix an issue with the search engine where price from and price to do not go into the text boxes all the time, I've hit a snag that I can't explain and don't understand.
My understanding of the process is that it starts in tpl_search_default.php and uses the $sData values from modules/pages/search/header_php.php...like so.
PHP Code:
$sData['pto'] = (isset($_GET['pto']) ? zen_output_string($_GET['pto']) : '');
For troubleshooting purposes, I changed the above code to the code below...using 1000, '1000', and "1000" at many different points in my testing.
PHP Code:
$sData['pto'] = 1000;
In tpl_search_default.php, line 37, I tested if $sData['pto'] was available and correct...like so.
PHP Code:
<?php print_r('$sData[pto] before sanitizing = ' . $sData['pto'] . '<br>'); //this is not making it's way into zen_draw_input_field('pto', $sData['pto'], 'id="pto"'); below
?>
<div id="searchPriceTo"><label for="pto"><?php echo ENTRY_PRICE_TO; ?></label><?php echo zen_draw_input_field('pto', $sData['pto'], 'id="pto"'); ?></div>
It is available and correct but it is not getting into the text box.
So I moved on to verifying function zen_draw_input_field in the html_output.php file.
Around line 585, I tested for $value ($sData...).
PHP Code:
print_r('VALUE = ' . $value);
$field = '<input type="' . zen_output_string($type) . '" name="' . zen_sanitize_string(zen_output_string($name)) . '"';
if (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && $reinsert_value == true) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
print_r('FIELD = ' . $field . ' | VALUE = ' . $value);
$value is still correct and available but it still isn't inside of the text box...but it should be, right? The empty text box appears at is should...other than being empty.
My confusion comes here while anylizing the above code. Why would you use $name in any part of this if statement below? The goal is to set $field .= ' value=" to the $value...not the $name, right?
PHP Code:
if (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && $reinsert_value == true) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
}
So, I changed $name to $value and the text box now has the correct value in it.
Now, I'm reluctant to leave it this way because this function is WIDELY used throughout the programming.
My question, is this a good fix and a BUG?
I have no idea where the search engine NOTIFY system is located nor do I understand how the "watcher class" system works...so I couldn't analyze it.
I would appreciate some insight and help please.