Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Question about some of the tep_ functions


darp

Recommended Posts

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

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

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

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...