RE: [PEAR-CVS] cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php

From: Date: Fri, 02 Jan 2004 01:06:55 +0000
Subject: RE: [PEAR-CVS] cvs: pear /DB/DB common.php ibase.php mssql.php mysql.php mysql4.php oci8.php odbc.php pgsql.php sybase.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15261@lists.php.net to get a copy of this message
> From: Alan Knowles [mailto:alan@akbkhome.com] > Sent: Friday, January 02, 2004 1:42 AM > >+ * Quotes a string so it can be safely used in a query. > >+ * > >+ * It will return the string with single quotes around. > >+ * > >+ * This method gets overridden if the DBMS being used has a quote() > >+ * method in its sub-class. Those overriding methods contain notes > >+ * about which data types should be used to handle BOOLEAN data in > >+ * each DBMS. > > > > > It looks like this is not what this method is now doing. > if the > > + if (is_int($str) || is_double($str)) { > + return $str; > > I would expect this to return '$str'; > .. I asked it to be quoted, but In the above code it didnt get quoted... > > I'm not keen to see quote do this much magic, - adding an extra method > called typequote, or something for this would infer that it does more > that just quote strings. > > It also means there is considerably less code for general quoting.. Yes I also think that this is not a wise move. The purpose of quote() is to quote (and escape iirc) a string. If you pass it an integer it doesn't change the fact that I expect it to be treated like an integer. Moreover certain RDBMS even allow quoting for integers, so people might have even used quote() to protect against sql injection. Regards, Lukas

« previous php.pear.cvs (#15261) next »