Skip to content

Commit 65eac86

Browse files
committed
The ext/json is always available since PHP 8.0
The HAVE_JSON symbol is removed with PHP 8.4.0+.
1 parent e14ab77 commit 65eac86

File tree

8 files changed

+3
-134
lines changed

8 files changed

+3
-134
lines changed

build/config/config.m4

+1-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if test "$PHP_PHALCON" = "yes"; then
77
PHP_STRING=$($PHP_CONFIG --version)
88
AC_MSG_CHECKING(PHP version)
99

10-
if test $PHP_VERSION -lt 70401; then
10+
if test $PHP_VERSION -lt 80000; then
1111
AC_MSG_ERROR(PHP version $PHP_STRING is not supported)
1212
fi
1313

@@ -39,23 +39,6 @@ if test "$PHP_PHALCON" = "yes"; then
3939
[[#include "php_config.h"]]
4040
)
4141

42-
AC_CHECK_DECL(
43-
[HAVE_JSON],
44-
[
45-
AC_CHECK_HEADERS(
46-
[ext/json/php_json.h],
47-
[
48-
PHP_ADD_EXTENSION_DEP([phalcon], [json])
49-
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
50-
],
51-
,
52-
[[#include "main/php.h"]]
53-
)
54-
],
55-
,
56-
[[#include "php_config.h"]]
57-
)
58-
5942
CPPFLAGS=$old_CPPFLAGS
6043

6144
PHP_INSTALL_HEADERS([ext/phalcon], [php_phalcon.h])

build/phalcon/config.m4

+1-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if test "$PHP_PHALCON" = "yes"; then
77
PHP_STRING=$($PHP_CONFIG --version)
88
AC_MSG_CHECKING(PHP version)
99

10-
if test $PHP_VERSION -lt 70401; then
10+
if test $PHP_VERSION -lt 80000; then
1111
AC_MSG_ERROR(PHP version $PHP_STRING is not supported)
1212
fi
1313

@@ -39,23 +39,6 @@ if test "$PHP_PHALCON" = "yes"; then
3939
[[#include "php_config.h"]]
4040
)
4141

42-
AC_CHECK_DECL(
43-
[HAVE_JSON],
44-
[
45-
AC_CHECK_HEADERS(
46-
[ext/json/php_json.h],
47-
[
48-
PHP_ADD_EXTENSION_DEP([phalcon], [json])
49-
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
50-
],
51-
,
52-
[[#include "main/php.h"]]
53-
)
54-
],
55-
,
56-
[[#include "php_config.h"]]
57-
)
58-
5942
CPPFLAGS=$old_CPPFLAGS
6043

6144
PHP_INSTALL_HEADERS([ext/phalcon], [php_phalcon.h])

build/phalcon/phalcon.zep.c

-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"ext-igbinary": "*",
3232
"ext-imagick": "*",
3333
"ext-intl": "*",
34-
"ext-json": "*",
3534
"ext-libxml": "*",
3635
"ext-mbstring": "*",
3736
"ext-msgpack": "*",

composer.lock

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/config.m4

-17
Original file line numberDiff line numberDiff line change
@@ -660,23 +660,6 @@ if test "$PHP_PHALCON" = "yes"; then
660660
[[#include "php_config.h"]]
661661
)
662662

663-
AC_CHECK_DECL(
664-
[HAVE_JSON],
665-
[
666-
AC_CHECK_HEADERS(
667-
[ext/json/php_json.h],
668-
[
669-
PHP_ADD_EXTENSION_DEP([phalcon], [json])
670-
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
671-
],
672-
,
673-
[[#include "main/php.h"]]
674-
)
675-
],
676-
,
677-
[[#include "php_config.h"]]
678-
)
679-
680663
CPPFLAGS=$old_CPPFLAGS
681664

682665
PHP_INSTALL_HEADERS([ext/phalcon], [php_PHALCON.h])

ext/config.w32

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ if (PHP_PHALCON != "no") {
55
ADD_SOURCES(configure_module_dirname + "/kernel", "main.c memory.c exception.c debug.c backtrace.c object.c array.c string.c fcall.c require.c file.c operators.c math.c concat.c variables.c filter.c iterator.c exit.c time.c", "phalcon");
66
/* PCRE is always included on WIN32 */
77
AC_DEFINE("ZEPHIR_USE_PHP_PCRE", 1, "Whether PHP pcre extension is present at compile time");
8-
if (PHP_JSON != "no") {
9-
ADD_EXTENSION_DEP("phalcon", "json");
10-
AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time");
11-
}
128
ADD_SOURCES(configure_module_dirname + "/phalcon/annotations", "scanner.c parser.c", "phalcon");
139
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model", "orm.c", "phalcon");
1410
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model/query", "scanner.c parser.c", "phalcon");

ext/kernel/string.c

-36
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
#include <ext/pcre/php_pcre.h>
3636
#endif
3737

38-
#if defined ZEPHIR_USE_PHP_JSON && ZEPHIR_USE_PHP_JSON
3938
#include <ext/json/php_json.h>
40-
#endif
4139

4240
#include "kernel/main.h"
4341
#include "kernel/memory.h"
@@ -1128,8 +1126,6 @@ void zephir_preg_match(zval *return_value, zval *regex, zval *subject, zval *mat
11281126

11291127
#endif /* ZEPHIR_USE_PHP_PCRE */
11301128

1131-
#if defined ZEPHIR_USE_PHP_JSON && ZEPHIR_USE_PHP_JSON
1132-
11331129
int zephir_json_encode(zval *return_value, zval *v, int opts)
11341130
{
11351131
smart_str buf = { 0 };
@@ -1162,38 +1158,6 @@ int zephir_json_decode(zval *return_value, zval *v, zend_bool assoc)
11621158
return SUCCESS;
11631159
}
11641160

1165-
#else
1166-
1167-
int zephir_json_encode(zval *return_value, zval *v, int opts)
1168-
{
1169-
zval zopts;
1170-
zval *params[2];
1171-
1172-
ZVAL_NULL(&zopts);
1173-
ZVAL_LONG(&zopts, opts);
1174-
1175-
params[0] = v;
1176-
params[1] = &zopts;
1177-
1178-
return zephir_return_call_function(return_value, SL("json_encode"), NULL, 0, 2, params);
1179-
}
1180-
1181-
int zephir_json_decode(zval *return_value, zval *v, zend_bool assoc)
1182-
{
1183-
zval zassoc;
1184-
zval *params[2];
1185-
1186-
ZVAL_NULL(&zassoc);
1187-
ZVAL_BOOL(&zassoc, assoc);
1188-
1189-
params[0] = v;
1190-
params[1] = &zassoc;
1191-
1192-
return zephir_return_call_function(return_value, SL("json_decode"), NULL, 0, 2, params);
1193-
}
1194-
1195-
#endif /* ZEPHIR_USE_PHP_JSON */
1196-
11971161
void zephir_md5(zval *return_value, zval *str)
11981162
{
11991163
PHP_MD5_CTX ctx;

0 commit comments

Comments
 (0)