|
Comments for: vaska20050722
| Message # 1510840: |
|
Date: 11/29/08 09:09
By: nikosch Subject: more Bugs and Tips #2 First, there is a closing bracket missing in this line: if (is_array($post) { Second, you should return the original value (return $post), if mq is turned off. Otherwise you need another if-clause to be sure, if mq was off or your parameterset simply was empty. Much more interesting: This function only works with arrays up to 1 dimension. Look what happens else: <? set_magic_quotes_runtime (1); $myArray = array (1 => array (1 , 2)); print_r (magicQuotes($myArray)); // outputs: Array ( [1] => Array ) // stripslashes uses the String representation of Array here ?> use this instead: <? function magicQuotes($value) { if (get_magic_quotes_gpc()) { return magicQuotesRecursive($value); } return $value; } function magicQuotesRecursive($value) { if (is_array($value)) { return array_map('magicQuotesRecursive' , $value); } return stripslashes($value); } ?> The second function is only for not repeating the if (get_magic_quotes_gpc()) clause. #4 Use the error_reporting always together with ini_set('display_errors', 1); to be sure, that errors will be displayed. |
Previous Message | Next Message |
| Comments: | ||
| more Bugs and Tips | nikosch | 11/29/08 09:09 |
| SQL Injections | Allison M Nighswander | 10/05/08 23:47 |
| I'm basically disagreeing with everything. | Cthulhu | 07/01/08 17:30 |
| Magic quotes are eeevil. | Marnen Laibow-Koser | 06/20/07 17:17 |
| Trying to connect to MySQL database | Emmanuel Sey | 08/13/05 09:14 |
| RE: Bug in tip #1 | vaaaska | 08/10/05 11:49 |
| Why 10 when only 5? | Kim | 08/09/05 16:46 |
| Bug in tip #1 | Casper | 08/08/05 16:43 |
| locating files in subfolders | Jvandal | 08/02/05 11:26 |
| i want to learn | yinka | 08/01/05 11:21 |
| RE: tutorial php | Arun Mishra | 07/29/05 07:08 |
| check box selection | arthur | 07/27/05 03:58 |
| tutorial php | lukman | 07/26/05 23:06 |
| Its Cool | Mohammed Mizan Uddin | 07/26/05 01:41 |
| I'm not sure... | Toby | 07/25/05 13:12 |
| Tip 5, better information. | Mike Willbanks | 07/25/05 10:03 |
| What about magic_quotes_sybase? | Sergey Bres | 07/25/05 09:48 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


