Xpajun Posted January 7, 2010 Posted January 7, 2010 What shoud i do? it's comming up when im trying to log in. Please help! A start would be to read through this post - there are a number of things you can do to stop the warnings all are listed in this post ;) My store is currently running Phoenix 1.0.3.0 I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary
MrPhil Posted January 7, 2010 Posted January 7, 2010 Warning: Cannot modify header information - headers already sent by (output started at /path_to_admin/includes/classes/language.php:87) in /path_to_admin/includes/functions/general.php Once you fix the things putting out the earlier error messages, that "header" problem will go away. Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /path_to_shop/includes/functions/general.php on line 1129 It sounds like you changed ereg('^pattern',... to preg_match('^pattern',..., i.e., forgot to enclose the pattern in delimiters such as / or #: preg_match('/^pattern/',.... If it was originally "eregi", it would be now preg_match('/^pattern/i',....
Guest Posted January 7, 2010 Posted January 7, 2010 error when trying to email from the store contact form Warning: preg_match() [function.preg-match]: Unknown modifier '/' in /home/designus/public_html/rc2/includes/functions/validations.php on line 97 I also get this error in the pink bar on the contact page Your E-Mail Address does not appear to be valid - please make any necessary corrections. This is the line if (preg_match("/$tld_pattern/i", $top_level_domain) == 0) { I copied the exact code listed at github for this admin/includes/functions/validation.php file.
Guest Posted January 7, 2010 Posted January 7, 2010 and to be totally honest the PCRE engine is being loaded where not necessary. If you just want to check if a string is present you don't use preg_match you use the much faster strpos. if ( false !== strpos( $gv_result['products_model'], 'GIFT' ) ) { Nice, FWR Media, that works.
steve_s Posted January 7, 2010 Posted January 7, 2010 error when trying to email from the store contact form Warning: preg_match() [function.preg-match]: Unknown modifier '/' in /home/designus/public_html/rc2/includes/functions/validations.php on line 97 I also get this error in the pink bar on the contact page This is the line if (preg_match("/$tld_pattern/i", $top_level_domain) == 0) { I copied the exact code listed at github for this admin/includes/functions/validation.php file. Hi replace code in admin/includes/functions/validation.php with code below will also work on shop side to <?php /* $Id: validations.php 1739 2007-12-20 00:52:16Z hpdl $ Open Source E-Commerce Solutions Copyright (c) 2003 osCommerce, http://www.oscommerce.com Released under the GNU General Public License */ //////////////////////////////////////////////////////////////////////////////////////////////// // // Function : tep_validate_email // // Arguments : email email address to be checked // // Return : true - valid email address // false - invalid email address // // Description : function for validating email address that conforms to RFC 822 specs // // This function is converted from a JavaScript written by // Sandeep V. Tamhankar ([email protected]). The original JavaScript // is available at http://javascript.internet.com // // Sample Valid Addresses: // // [email protected] // [email protected] // "first last"@host.com // "first@last"@host.com // [email protected] // first.last@[123.123.123.123] // // Invalid Addresses: // // first [email protected] // // //////////////////////////////////////////////////////////////////////////////////////////////// function tep_validate_email($email) { $valid_address = true; $mail_pat = '/^(.+)@(.+)$/i'; $valid_chars = "[^] \(\)<>@,;:\.\\\"\[]"; $atom = "$valid_chars+"; $quoted_user='(\"[^\"]*\")'; $word = "($atom|$quoted_user)"; $user_pat = "/^$word(\.$word)*$/i"; $ip_domain_pat='/^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$/i'; $domain_pat = "/^$atom(\.$atom)*$/i"; if (preg_match($mail_pat, $email, $components)) { $user = $components[1]; $domain = $components[2]; // validate user if (preg_match($user_pat, $user)) { // validate domain if (preg_match($ip_domain_pat, $domain, $ip_components)) { // this is an IP address for ($i=1;$i<=4;$i++) { if ($ip_components[$i] > 255) { $valid_address = false; break; } } } else { // Domain is a name, not an IP if (preg_match($domain_pat, $domain)) { /* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD and that there's a hostname preceding the domain or country. */ $domain_components = explode(".", $domain); // Make sure there's a host name preceding the domain. if (sizeof($domain_components) < 2) { $valid_address = false; } else { $top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]); // Allow all 2-letter TLDs (ccTLDs) if (preg_match('/^[a-z][a-z]$/i', $top_level_domain) != 1) { $tld_pattern = ''; // Get authorized TLDs from text file $tlds = file(DIR_WS_INCLUDES . 'tld.txt'); while (list(,$line) = each($tlds)) { // Get rid of comments $words = explode('#', $line); $tld = trim($words[0]); // TLDs should be 3 letters or more if (preg_match('/^[a-z]{3,}$/i', $tld) == 1) { $tld_pattern .= '^' . $tld . '$|'; } } // Remove last '|' $tld_pattern = substr($tld_pattern, 0, -1); if (preg_match("/$tld_pattern/i", $top_level_domain) == 0) { $valid_address = false; } } } } else { $valid_address = false; } } } else { $valid_address = false; } } else { $valid_address = false; } if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') { if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) { $valid_address = false; } } return $valid_address; } ?> Steve
Guest Posted January 8, 2010 Posted January 8, 2010 Hi replace code in admin/includes/functions/validation.php with code below will also work on shop side to <?php /* $Id: validations.php 1739 2007-12-20 00:52:16Z hpdl $ Open Source E-Commerce Solutions Copyright (c) 2003 osCommerce, http://www.oscommerce.com Released under the GNU General Public License */ //////////////////////////////////////////////////////////////////////////////////////////////// // // Function : tep_validate_email // // Arguments : email email address to be checked // // Return : true - valid email address // false - invalid email address // // Description : function for validating email address that conforms to RFC 822 specs // // This function is converted from a JavaScript written by // Sandeep V. Tamhankar ([email protected]). The original JavaScript // is available at http://javascript.internet.com // // Sample Valid Addresses: // // [email protected] // [email protected] // "first last"@host.com // "first@last"@host.com // [email protected] // first.last@[123.123.123.123] // // Invalid Addresses: // // first [email protected] // // //////////////////////////////////////////////////////////////////////////////////////////////// function tep_validate_email($email) { $valid_address = true; $mail_pat = '/^(.+)@(.+)$/i'; $valid_chars = "[^] \(\)<>@,;:\.\\\"\[]"; $atom = "$valid_chars+"; $quoted_user='(\"[^\"]*\")'; $word = "($atom|$quoted_user)"; $user_pat = "/^$word(\.$word)*$/i"; $ip_domain_pat='/^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$/i'; $domain_pat = "/^$atom(\.$atom)*$/i"; if (preg_match($mail_pat, $email, $components)) { $user = $components[1]; $domain = $components[2]; // validate user if (preg_match($user_pat, $user)) { // validate domain if (preg_match($ip_domain_pat, $domain, $ip_components)) { // this is an IP address for ($i=1;$i<=4;$i++) { if ($ip_components[$i] > 255) { $valid_address = false; break; } } } else { // Domain is a name, not an IP if (preg_match($domain_pat, $domain)) { /* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD and that there's a hostname preceding the domain or country. */ $domain_components = explode(".", $domain); // Make sure there's a host name preceding the domain. if (sizeof($domain_components) < 2) { $valid_address = false; } else { $top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]); // Allow all 2-letter TLDs (ccTLDs) if (preg_match('/^[a-z][a-z]$/i', $top_level_domain) != 1) { $tld_pattern = ''; // Get authorized TLDs from text file $tlds = file(DIR_WS_INCLUDES . 'tld.txt'); while (list(,$line) = each($tlds)) { // Get rid of comments $words = explode('#', $line); $tld = trim($words[0]); // TLDs should be 3 letters or more if (preg_match('/^[a-z]{3,}$/i', $tld) == 1) { $tld_pattern .= '^' . $tld . '$|'; } } // Remove last '|' $tld_pattern = substr($tld_pattern, 0, -1); if (preg_match("/$tld_pattern/i", $top_level_domain) == 0) { $valid_address = false; } } } } else { $valid_address = false; } } } else { $valid_address = false; } } else { $valid_address = false; } if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') { if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) { $valid_address = false; } } return $valid_address; } ?> Steve Same errors Steve. I compared the files and it is the same one from github I was using. Other ideas?
Kennith Posted January 8, 2010 Posted January 8, 2010 My host havent updated to 5.3 yet but eventually they will I would like to bee one steep ahead and start fixing these errors but are the fixes backward compatibly in other words can my shop run on PHP 5.2.xx if I make the changes now?
Guest Posted January 8, 2010 Posted January 8, 2010 It seems a shop will run on at least 5.2.12 which is what I'm using now. The only problem is the one I just posted. I checked the order process and checks and paypal will work. I don't know about the other ones.
steve_s Posted January 8, 2010 Posted January 8, 2010 Same errors Steve. I compared the files and it is the same one from github I was using. Other ideas? I would suggest follow through all of his posts and make all amendements, this might be down to includes/functions/general.php I also used simple search and replace to find any other files that had ereg or eregi and split and amended them to the relevant preg ones Steve
EvilDragon Posted January 14, 2010 Posted January 14, 2010 Yeah i have problems with the clean install from github, let me know what i can do to help. Scott Same problem here. Updated to PHP 5.3.1 today and it doesn't keep any osCsid. It's changing with every click, so nobody can actually buy something... :/ Any idea yet how to fix that?
EvilDragon Posted January 14, 2010 Posted January 14, 2010 I fixed it :) To anybody else having problems with the oscid: Check this thread and make sure you fix the cookie path! I just found out that phpbb 3 had problems with php 5.3 and sessions as well and it turns out cookie handling is a bit different. While wrong paths did work with older php Versions, they don't work anymore with the latest one.
dlyxzen Posted January 20, 2010 Posted January 20, 2010 hey guys, i have gone through these pages and fixed many pages of mine but one still remains with problems and i cant work it out ! Deprecated: Function eregi() is deprecated in /data/http/squashcity.com.au/includes/functions/validations.php on line 91 I am getting this error among others with different lines on validations.php How the hell do i fix it ?!?!! thanks dlyxzen
MrPhil Posted January 20, 2010 Posted January 20, 2010 You fix it the same way you fix all the other "eregi" problems. Is this the offending line? if (eregi('^[a-z]{3,}$', $tld) == 1) { Replace it with if (preg_match('/^[a-z]{3,}$/i', $tld) == 1) { If this is the line with the problem: if (eregi("$tld_pattern", $top_level_domain) == 0) { it's fixed with if (preg_match("/$tld_pattern/i", $top_level_domain) == 0) { Note that if $tld_pattern may contain slashes / , you can pick some other character such as # or : to use. Or, you add a line to modify $tld_pattern to escape slashes: / turns into \/ (that's a backslash \ followed by a slash /). Obviously you never looked in the referenced github pages, as you would have found both fixes there.
brickie Posted February 10, 2010 Posted February 10, 2010 As Matt pointed out, you would replace ereg with preg_match, preg does not exist!! so if (ereg('^[0-9]$', $char)) $rand_value .= $char; becomes if (preg_match('^[0-9]$', $char)) $rand_value .= $char; Also as has been pointed out elsewhere, a work around (till v6 at least) is: In includes/application_top.php and admin/includes/application_top.php find: //set the level of error reporting error_reporting(E_ALL & ~E_NOTICE); replace with: //set the level of error reporting error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); thanks. works a treat with latest xampp and osc 2.2r2a thanks also to germ who pointed me to this link :thumbsup:
mosp Posted February 17, 2010 Posted February 17, 2010 Try to replace whos_online.php eregi with this one: <?php if (preg_match('/^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)/', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> It works for me. Regards
MrPhil Posted March 29, 2010 Posted March 29, 2010 I see that there's a lot of changes on the github version; let's hope RC3 or (better yet) Gold appears Real Soon Now. I know I've said this before, but it bears repeating: Release Candidates should freeze all development and only fix bugs. At some point you've got to get 2.2 reasonably stable and Gold out the door. Then you put in all the PHP 5.3/6.0 changes, security patches, MySQL 5 changes, and various bug and stability fixes into 2.3 alpha 1. If you don't want to add new features, that's fine, but 2.x needs to stay actively maintained until 3.0 has been Gold for a while. I can't understand why the developers keep cramming more stuff into 2.2 RC3. Anyway, I was looking through the PHP list of deprecated functions (and other stuff), and was wondering if all of it is to be addressed soon. ereg(), etc. is taken care of. The compatibility layer takes care of register globals going away, and the long array names going away (except $HTTP_POST_FILES, which are handled elsewhere). $HTTP_USER_AGENT, $HTTP_ACCEPT_ENCODING, $DOCUMENT_ROOT, and $REMOTE_ADDR need to be changed to $_SERVER[name]. I think $PHP_SELF is handled OK. Will get_cfg_var('safe_mode') cause an error in either 5.3 or 6.0? I think the magic_quotes_gpc stuff will be OK, but I can't swear to it. call_user_method(name, object, parms...) I think is going to blow up at some point -- replace by call_user_func(array(object, name), parms...)? I see that session_register(), session_unregister(), and session_is_registered() all conflict with built-in PHP functions that are deprecated anyway as of 5.3. Does anyone know of any problems with continuing to use these names? Finally, it looks like mysql_escape_string() is adequately handled. Does anyone know if these items are on the list to be handled soon (preferably 2.3 alpha 1)?
azvareth Posted April 22, 2010 Posted April 22, 2010 Hi! I recently downloaded the latest Apache, php-5.3.2-Win32-VC9-x86.msi, and latest mySQL... I followed every applications install instructions / wizards - and get slowly everything to work well together. Finally I downloaded oscommerce-3.0a5.zip (I assume this is the latest package). The reason I setup the server that way and can't degrade is that my webhost/hotel is running the same config and they are not likely to change their configuration. I installed it but during setup I got lots of ereg/i <something>, but I guess it did install anyway, but the warning still continued to show ecspecially in database.php... I was wondering... (as I read all fixes here and there, I came to the conclusion that I am not skilled enough to fix it), is it possible to "redefine" this ereg whatever so that the oscommerceApp for a moment at least can behave in a functional manner. like: IFDEF <name> UNDEF <name> DEF <name = "call this function()/class()/object() whatever instead"> ENDIF and then make an include from every file that use this ereg/i stuff. If not possible, does anyone have made an automated patch script or something that match the errors and then fix them? if so, would you be kind souls and share this with n00b Lamers like myself? by the way: the latest error that was shown to me looked like this: (I was trying to copy and paste but I could not so I link to an partial image) the error is one page long... ohhh! and last, I am new to Apache, I am new to PHP, I am new to mySQL, I am new to oscommerce - the only reason to install it was to see if I could sell something (secondhand...), and if oscommerce was good to use for that.
MrPhil Posted April 22, 2010 Posted April 22, 2010 DO NOT, I repeat, DO NOT use osC version 3 unless you are an EXPERT programmer. It is only "alpha" level -- very early test version subject to much revision. Besides, this is the 2.2 section of the discussions (you're in the wrong place). 2.2 RC2a is the current (and probably final) version 2 release. No, there are no automated fixes or redefines you can do. If you had read the discussions on "ereg" and PHP 5.3, you would know that the arguments to the function also have to be changed.
azvareth Posted April 22, 2010 Posted April 22, 2010 and finally I see that I am in the wrong forum part... this (above) should be moved to version 3 part I guess... //Sorry! [late edit] No, there are no automated fixes or redefines you can do. If you had read the discussions on "ereg" and PHP 5.3, you would know that the arguments to the function also have to be changed. I did understood it loosely (I am not an expert programmer so...), and what I meant was to use the older version, by copy the code from old PHP releases and include/merge them in to oscommerce and bypass the newer version (but I guess you thought of that already). - no more comments from me here, i go to the right place if I can find it... thanks for your reply!
Dennisra Posted May 6, 2010 Posted May 6, 2010 This is in admin/modules.php for USPS shipping: //USPS 4.0 if (tep_not_null($action)) { switch ($action) { case 'save': while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { if( is_array( $value ) ){ $value = implode( ", ", $value); $value = ereg_replace (", --none--", "", $value); } tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'"); } tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'])); break; case 'install': //USPS 4.0 I have replaced: $value = ereg_replace (", --none--", "", $value); with this: $value = preg_replace ("/, --none--/", "", $value); and although it gets rid of the errors the USPS shipping module still does not work. Have I placed the deliminators correctly? What is the correct placement?
ivanibam Posted June 9, 2010 Posted June 9, 2010 hi i'm new here..and i would like to ask regarding the function of my "add to cart" and "create new account" the account was created but there is a deprecated warning said "Deprecated: Function ereg_replace() is deprecated in C:\xampp\htdocs\oscommerce-2.2rc2a\VoodooPC\includes\functions\general.php on line 61" the following line is written " $string = ereg_replace(' +', ' ', trim($string));" also there is more problem such as if (eregi($mail_pat, $email, $components)) { if (eregi($user_pat, $user)) { if (eregi($ip_domain_pat, $domain, $ip_components)) { if (eregi($domain_pat, $domain)) { if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) { if (eregi('^[a-z]{3,}$', $tld) == 1) { if (eregi("$tld_pattern", $top_level_domain) == 0) { if (ereg('^[0-9]$', $char)) $rand_value .= $char; I really need it to work, cos it's for my school project and i'm testing it in the localhost.. thanks alot..
Guest Posted June 9, 2010 Posted June 9, 2010 Cupi, Try this: http://addons.oscommerce.com/info/7394 Chris
ivanibam Posted June 9, 2010 Posted June 9, 2010 Cupi, Try this: http://addons.oscommerce.com/info/7394 Chris its very helpful Chris..thanks a lot. I manage to decrease the problem of having deprecated things again..but still got problem about warning signs such as: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\oscommerce-2.2rc2a\VoodooPC\includes\classes\email.php on line 522 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\oscommerce-2.2rc2a\VoodooPC\includes\classes\email.php:522) in C:\xampp\htdocs\oscommerce-2.2rc2a\VoodooPC\includes\functions\general.php on line 33 and comes up new problem appear in my product listing.. Warning: substr() expects parameter 3 to be long, string given in C:\xampp\htdocs\oscommerce-2.2rc2a\VoodooPC\includes\modules\new_products.php on line 36 but the checkout works amazingly perfect to give me the confirmation of the transaction for the customer..thanks alot btw..i just need a little help about those two problem i mention above...
Nestorin Posted July 22, 2010 Posted July 22, 2010 First, thanks to all you. Great notes!!!! On the comment... "As Matt pointed out, you would replace ereg with preg_match, preg does not exist!! so if (ereg('^[0-9]$', $char)) $rand_value .= $char; becomes if (preg_match('^[0-9]$', $char)) $rand_value .= $char; ------------------------------------ Take care -------- On if (preg_match('^[0-9]$', $char)) $rand_value .= $char Must be if (preg_match('^[0-9]$^', $char)) $rand_value .= $char Agregate de delimiter "^" after "$"
Guest Posted July 22, 2010 Posted July 22, 2010 While this thread stumbles along somewhat aimlessly trying to figure out of to make your current RC2a websites PHP 5.3 compliant, everyone COULD just download the patch notes and the drop on top files for RC2a and spend the time you use posting here to do other things. :-" http://addons.oscommerce.com/info/7394 Chris
Recommended Posts
Archived
This topic is now archived and is closed to further replies.