darp Posted June 5, 2010 Share Posted June 5, 2010 There are a few functions that just seem to be clones of an existing function. Here is an example found in session.php. function tep_session_destroy() { return session_destroy(); } Is tep_session_destroy() any better than session_destroy()? Does wrapping it in a tep_ function make it more secure against hackers or something? I wonder about tep_db_query() and a couple of others too. Why not a simple query? Just wondering Link to comment Share on other sites More sharing options...
germ Posted June 5, 2010 Share Posted June 5, 2010 osC started out as "The Exchange Project" (I think!) and they just coded functions with the "tep" prefix (initials from "The Exchange Project"). It's not any more secure - it's just the way they coded it originally. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
darp Posted June 5, 2010 Author Share Posted June 5, 2010 I realize that, but why put a function inside a function and not alter, add or modify it? Link to comment Share on other sites More sharing options...
germ Posted June 5, 2010 Share Posted June 5, 2010 osC started out as "The Exchange Project" (I think!) and they just coded functions with the "tep" prefix (initials from "The Exchange Project"). It's not any more secure - it's just the way they coded it originally. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
♥FWR Media Posted June 5, 2010 Share Posted June 5, 2010 Wrapping standard php functions can be very beneficial, both longer term ( php version changes ) and for purposes of capturing data. example mysql_query() vs tep_db_query(); If the script wanted to count and examine the queries used .. using the php function it is impossible .. by wrapping it we can log the numbers of queries .. the query itself and other data. You gave the example of session_destroy() .. in this case we are doing nothing additional to it .. BUT .. php could change the workings of this function which a wrapper could handle .. php could change the functionality which means that osCommerce needs to change the wrapper function not a "billion" lines in the core code .. the benefits of wrapping is huge. Disclaimer -- this is not intended to be a full description of the benefits of wrapping core functions, just a few examples. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
♥FWR Media Posted June 5, 2010 Share Posted June 5, 2010 As an additional example .. it "could" be an arguable reason to wrap virtually ALL php functions. Example strpos() Taking the old php4 function we could have had a wrapper like .. function tep_strpos( $target, $string, $case_sensitive = false ) { if ( false === $case_sensitive ) { return strpos( $string, $target ); } $target = strtolower( $target ); $string = strtolower( $string ); return strpos( $string, $target ); } this way the introduction by ZEND of stripos would have had no effect to the core code. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
darp Posted June 6, 2010 Author Share Posted June 6, 2010 Thanks FWR. That makes good sense. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.