Skip to content

Commit e37b830

Browse files
committed
Avoid magic quotes deprecation notice on PHP 7.4
Fixes #786.
1 parent 04e83eb commit e37b830

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

qa-include/qa-base.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,11 @@ function qa_gpc_to_string($string)
11671167
{
11681168
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
11691169

1170-
return get_magic_quotes_gpc() ? stripslashes($string) : $string;
1170+
// get_magic_quotes_gpc always returns false from PHP 5.4; this avoids deprecation notice on PHP 7.4+
1171+
if (qa_php_version_below('5.4.0'))
1172+
return get_magic_quotes_gpc() ? stripslashes($string) : $string;
1173+
else
1174+
return $string;
11711175
}
11721176

11731177

@@ -1180,7 +1184,11 @@ function qa_string_to_gpc($string)
11801184
{
11811185
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
11821186

1183-
return get_magic_quotes_gpc() ? addslashes($string) : $string;
1187+
// get_magic_quotes_gpc always returns false from PHP 5.4; this avoids deprecation notice on PHP 7.4+
1188+
if (qa_php_version_below('5.4.0'))
1189+
return get_magic_quotes_gpc() ? addslashes($string) : $string;
1190+
else
1191+
return $string;
11841192
}
11851193

11861194

0 commit comments

Comments
 (0)