You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print('<pre><<< ERROR >>> Need PHP 4.3+! Current version is ' . PHP_VERSION . '</pre>');
35
35
exit(1);
36
36
}
37
-
37
+
if (!defined('PHP_MAJOR_VERSION')) {
38
+
define('PHP_MAJOR_VERSION', (int)$phpversion[0]);
39
+
}
40
+
if (!defined('PHP_MINOR_VERSION')) {
41
+
define('PHP_MINOR_VERSION', (int)$phpversion[1]);
42
+
}
38
43
39
44
$stringTest = " the quick <b>brown</b> fox jumps <i>over</i> the lazy dog and eat <span>lorem ipsum</span><br/> Valar morghulis <br/>\n\rабыр\nвалар дохаэрис ";
40
45
$regexPattern = '/[\s,]+/';
@@ -919,22 +924,24 @@ function test_09_Json_Encode()
919
924
return$emptyResult;
920
925
}
921
926
922
-
$obj = newstdClass();
923
-
$obj->fieldStr = 'value';
924
-
$obj->fieldInt = 123456;
925
-
$obj->fieldFloat = 123.456;
926
-
$obj->fieldArray = array(123456);
927
-
$obj->fieldNull = null;
928
-
$obj->fieldBool = false;
929
927
$data = array(
930
928
$stringTest,
931
929
123456,
932
930
123.456,
933
931
array(123456),
934
932
null,
935
933
false,
936
-
$obj,
937
934
);
935
+
if (PHP_MAJOR_VERSION >=5) {
936
+
$obj = newstdClass();
937
+
$obj->fieldStr = 'value';
938
+
$obj->fieldInt = 123456;
939
+
$obj->fieldFloat = 123.456;
940
+
$obj->fieldArray = array(123456);
941
+
$obj->fieldNull = null;
942
+
$obj->fieldBool = false;
943
+
$data[] = $obj;
944
+
}
938
945
939
946
$count = $testsLoopLimits['09_json_encode'];
940
947
$time_start = get_microtime();
@@ -955,22 +962,25 @@ function test_10_Json_Decode()
955
962
return$emptyResult;
956
963
}
957
964
958
-
$obj = newstdClass();
959
-
$obj->fieldStr = 'value';
960
-
$obj->fieldInt = 123456;
961
-
$obj->fieldFloat = 123.456;
962
-
$obj->fieldArray = array(123456);
963
-
$obj->fieldNull = null;
964
-
$obj->fieldBool = false;
965
965
$data = array(
966
966
$stringTest,
967
967
123456,
968
968
123.456,
969
969
array(123456),
970
970
null,
971
971
false,
972
-
$obj,
973
972
);
973
+
if (PHP_MAJOR_VERSION >=5) {
974
+
$obj = newstdClass();
975
+
$obj->fieldStr = 'value';
976
+
$obj->fieldInt = 123456;
977
+
$obj->fieldFloat = 123.456;
978
+
$obj->fieldArray = array(123456);
979
+
$obj->fieldNull = null;
980
+
$obj->fieldBool = false;
981
+
$data[] = $obj;
982
+
}
983
+
974
984
foreach ($dataas$key => $value) {
975
985
$data[$key] = json_encode($value);
976
986
}
@@ -994,22 +1004,24 @@ function test_11_Serialize()
994
1004
return$emptyResult;
995
1005
}
996
1006
997
-
$obj = newstdClass();
998
-
$obj->fieldStr = 'value';
999
-
$obj->fieldInt = 123456;
1000
-
$obj->fieldFloat = 123.456;
1001
-
$obj->fieldArray = array(123456);
1002
-
$obj->fieldNull = null;
1003
-
$obj->fieldBool = false;
1004
1007
$data = array(
1005
1008
$stringTest,
1006
1009
123456,
1007
1010
123.456,
1008
1011
array(123456),
1009
1012
null,
1010
1013
false,
1011
-
$obj,
1012
1014
);
1015
+
if (PHP_MAJOR_VERSION >=5) {
1016
+
$obj = newstdClass();
1017
+
$obj->fieldStr = 'value';
1018
+
$obj->fieldInt = 123456;
1019
+
$obj->fieldFloat = 123.456;
1020
+
$obj->fieldArray = array(123456);
1021
+
$obj->fieldNull = null;
1022
+
$obj->fieldBool = false;
1023
+
$data[] = $obj;
1024
+
}
1013
1025
1014
1026
$count = $testsLoopLimits['11_serialize'];
1015
1027
$time_start = get_microtime();
@@ -1030,22 +1042,25 @@ function test_12_Unserialize()
1030
1042
return$emptyResult;
1031
1043
}
1032
1044
1033
-
$obj = newstdClass();
1034
-
$obj->fieldStr = 'value';
1035
-
$obj->fieldInt = 123456;
1036
-
$obj->fieldFloat = 123.456;
1037
-
$obj->fieldArray = array(123456);
1038
-
$obj->fieldNull = null;
1039
-
$obj->fieldBool = false;
1040
1045
$data = array(
1041
1046
$stringTest,
1042
1047
123456,
1043
1048
123.456,
1044
1049
array(123456),
1045
1050
null,
1046
1051
false,
1047
-
$obj,
1048
1052
);
1053
+
if (PHP_MAJOR_VERSION >=5) {
1054
+
$obj = newstdClass();
1055
+
$obj->fieldStr = 'value';
1056
+
$obj->fieldInt = 123456;
1057
+
$obj->fieldFloat = 123.456;
1058
+
$obj->fieldArray = array(123456);
1059
+
$obj->fieldNull = null;
1060
+
$obj->fieldBool = false;
1061
+
$data[] = $obj;
1062
+
}
1063
+
1049
1064
foreach ($dataas$key => $value) {
1050
1065
$data[$key] = serialize($value);
1051
1066
}
@@ -1268,13 +1283,6 @@ function test_24_XmlRpc_Encode()
1268
1283
return$emptyResult;
1269
1284
}
1270
1285
1271
-
$obj = newstdClass();
1272
-
$obj->fieldStr = 'value';
1273
-
$obj->fieldInt = 123456;
1274
-
$obj->fieldFloat = 123.456;
1275
-
$obj->fieldArray = array(123456);
1276
-
$obj->fieldNull = null;
1277
-
$obj->fieldBool = false;
1278
1286
$data = array(
1279
1287
// XmlRpc don't like html tags (php-7.2 + libxmlrpc-epi)
1280
1288
base64_encode($stringTest),
@@ -1283,8 +1291,17 @@ function test_24_XmlRpc_Encode()
1283
1291
array(123456),
1284
1292
null,
1285
1293
false,
1286
-
$obj,
1287
1294
);
1295
+
if (PHP_MAJOR_VERSION >=5) {
1296
+
$obj = newstdClass();
1297
+
$obj->fieldStr = 'value';
1298
+
$obj->fieldInt = 123456;
1299
+
$obj->fieldFloat = 123.456;
1300
+
$obj->fieldArray = array(123456);
1301
+
$obj->fieldNull = null;
1302
+
$obj->fieldBool = false;
1303
+
$data[] = $obj;
1304
+
}
1288
1305
1289
1306
$count = $testsLoopLimits['24_xmlrpc_encode'];
1290
1307
$time_start = get_microtime();
@@ -1305,13 +1322,6 @@ function test_25_XmlRpc_Decode()
1305
1322
return$emptyResult;
1306
1323
}
1307
1324
1308
-
$obj = newstdClass();
1309
-
$obj->fieldStr = 'value';
1310
-
$obj->fieldInt = 123456;
1311
-
$obj->fieldFloat = 123.456;
1312
-
$obj->fieldArray = array(123456);
1313
-
$obj->fieldNull = null;
1314
-
$obj->fieldBool = false;
1315
1325
$data = array(
1316
1326
// XmlRpc don't like html tags (php-7.2 + libxmlrpc-epi)
1317
1327
base64_encode($stringTest),
@@ -1320,8 +1330,18 @@ function test_25_XmlRpc_Decode()
0 commit comments