| @@ 287-293 (lines=7) @@ | ||
| 284 | return $replacement; |
|
| 285 | break; |
|
| 286 | ||
| 287 | case 'inet': |
|
| 288 | if ($replacement == 'null' || $replacement == '') |
|
| 289 | return 'null'; |
|
| 290 | if (!isValidIP($replacement)) |
|
| 291 | smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 292 | //we don't use the native support of mysql > 5.6.2 |
|
| 293 | return sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($replacement))); |
|
| 294 | ||
| 295 | case 'array_inet': |
|
| 296 | if (is_array($replacement)) |
|
| @@ 246-251 (lines=6) @@ | ||
| 243 | return $replacement; |
|
| 244 | break; |
|
| 245 | ||
| 246 | case 'inet': |
|
| 247 | if ($replacement == 'null' || $replacement == '') |
|
| 248 | return 'null'; |
|
| 249 | if (inet_pton($replacement) === false) |
|
| 250 | smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 251 | return sprintf('\'%1$s\'::inet', pg_escape_string($replacement)); |
|
| 252 | ||
| 253 | case 'array_inet': |
|
| 254 | if (is_array($replacement)) |
|