Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ext/json is always available since PHP 8.0 #16524

Open
wants to merge 1 commit into
base: 5.0.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
The ext/json is always available since PHP 8.0
The HAVE_JSON symbol is removed with PHP 8.4.0+ in
php_config.h.
petk committed Feb 3, 2024
commit 27a389361d715e734cee469a2859d2c91b3238ec
19 changes: 1 addition & 18 deletions build/config/config.m4
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ if test "$PHP_PHALCON" = "yes"; then
PHP_STRING=$($PHP_CONFIG --version)
AC_MSG_CHECKING(PHP version)

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

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

AC_CHECK_DECL(
[HAVE_JSON],
[
AC_CHECK_HEADERS(
[ext/json/php_json.h],
[
PHP_ADD_EXTENSION_DEP([phalcon], [json])
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
],
,
[[#include "main/php.h"]]
)
],
,
[[#include "php_config.h"]]
)

CPPFLAGS=$old_CPPFLAGS

PHP_INSTALL_HEADERS([ext/phalcon], [php_phalcon.h])
19 changes: 1 addition & 18 deletions build/phalcon/config.m4
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ if test "$PHP_PHALCON" = "yes"; then
PHP_STRING=$($PHP_CONFIG --version)
AC_MSG_CHECKING(PHP version)

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

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

AC_CHECK_DECL(
[HAVE_JSON],
[
AC_CHECK_HEADERS(
[ext/json/php_json.h],
[
PHP_ADD_EXTENSION_DEP([phalcon], [json])
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
],
,
[[#include "main/php.h"]]
)
],
,
[[#include "php_config.h"]]
)

CPPFLAGS=$old_CPPFLAGS

PHP_INSTALL_HEADERS([ext/phalcon], [php_phalcon.h])
38 changes: 0 additions & 38 deletions build/phalcon/phalcon.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@
"ext-igbinary": "*",
"ext-imagick": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-msgpack": "*",
3 changes: 1 addition & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions ext/config.m4
Original file line number Diff line number Diff line change
@@ -660,23 +660,6 @@ if test "$PHP_PHALCON" = "yes"; then
[[#include "php_config.h"]]
)

AC_CHECK_DECL(
[HAVE_JSON],
[
AC_CHECK_HEADERS(
[ext/json/php_json.h],
[
PHP_ADD_EXTENSION_DEP([phalcon], [json])
AC_DEFINE([ZEPHIR_USE_PHP_JSON], [1], [Whether PHP json extension is present at compile time])
],
,
[[#include "main/php.h"]]
)
],
,
[[#include "php_config.h"]]
)

CPPFLAGS=$old_CPPFLAGS

PHP_INSTALL_HEADERS([ext/phalcon], [php_PHALCON.h])
4 changes: 0 additions & 4 deletions ext/config.w32
Original file line number Diff line number Diff line change
@@ -5,10 +5,6 @@ if (PHP_PHALCON != "no") {
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");
/* PCRE is always included on WIN32 */
AC_DEFINE("ZEPHIR_USE_PHP_PCRE", 1, "Whether PHP pcre extension is present at compile time");
if (PHP_JSON != "no") {
ADD_EXTENSION_DEP("phalcon", "json");
AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time");
}
ADD_SOURCES(configure_module_dirname + "/phalcon/annotations", "scanner.c parser.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model", "orm.c", "phalcon");
ADD_SOURCES(configure_module_dirname + "/phalcon/mvc/model/query", "scanner.c parser.c", "phalcon");
36 changes: 0 additions & 36 deletions ext/kernel/string.c
Original file line number Diff line number Diff line change
@@ -35,9 +35,7 @@
#include <ext/pcre/php_pcre.h>
#endif

#if defined ZEPHIR_USE_PHP_JSON && ZEPHIR_USE_PHP_JSON
#include <ext/json/php_json.h>
#endif

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

#endif /* ZEPHIR_USE_PHP_PCRE */

#if defined ZEPHIR_USE_PHP_JSON && ZEPHIR_USE_PHP_JSON

int zephir_json_encode(zval *return_value, zval *v, int opts)
{
smart_str buf = { 0 };
@@ -1162,38 +1158,6 @@ int zephir_json_decode(zval *return_value, zval *v, zend_bool assoc)
return SUCCESS;
}

#else

int zephir_json_encode(zval *return_value, zval *v, int opts)
{
zval zopts;
zval *params[2];

ZVAL_NULL(&zopts);
ZVAL_LONG(&zopts, opts);

params[0] = v;
params[1] = &zopts;

return zephir_return_call_function(return_value, SL("json_encode"), NULL, 0, 2, params);
}

int zephir_json_decode(zval *return_value, zval *v, zend_bool assoc)
{
zval zassoc;
zval *params[2];

ZVAL_NULL(&zassoc);
ZVAL_BOOL(&zassoc, assoc);

params[0] = v;
params[1] = &zassoc;

return zephir_return_call_function(return_value, SL("json_decode"), NULL, 0, 2, params);
}

#endif /* ZEPHIR_USE_PHP_JSON */

void zephir_md5(zval *return_value, zval *str)
{
PHP_MD5_CTX ctx;