Skip to content

Commit

Permalink
fix php8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Dec 22, 2023
1 parent 66e9f8b commit dbe46ec
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ C++ wrapper for Zend API

## Requirements

- PHP 7.2 or later
- PHP 8.0 or later
- Linux/MacOS/Windows
- GCC 4.8 or later
- Composer
Expand All @@ -35,7 +35,7 @@ phpx create cpp_ext

## Generate ArgInfo & Function Entires
```shell
php script/gen_stub.php your_stub_dir
php bin/gen_stub.php your_stub_dir
```

## Build extension
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ cd console && \
echo "composer update" && \
composer update && \
cd ../ && \
/usr/bin/env php -d phar.readonly=off script/pack.php
/usr/bin/env php -d phar.readonly=off bin/pack.php
4 changes: 2 additions & 2 deletions include/phpx.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ extern "C" {
#include "php_streams.h"
#include "php_network.h"

#if PHP_VERSION_ID < 70200
#error "only supports PHP7 or later."
#if PHP_VERSION_ID < 80000
#error "only supports PHP8 or later."
#endif

#include "zend_interfaces.h"
Expand Down
2 changes: 0 additions & 2 deletions phpinfo.php

This file was deleted.

44 changes: 23 additions & 21 deletions src/function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ Variant http_build_query(const Variant &data, const char *prefix, const char *ar

size_t prefix_len = prefix != nullptr ? strlen(prefix) : 0;

#if PHP_VERSION_ID < 80000
auto retval =
#endif
php_url_encode_hash_ex(HASH_OF(_data.ptr()),
&formstr,
prefix,
prefix_len,
NULL,
0,
NULL,
0,
(_data.isObject() ? _data.ptr() : NULL),
(char *) arg_sep,
enc_type);
#if PHP_VERSION_ID < 80000
if (retval == FAILURE) {
if (formstr.s) {
smart_str_free(&formstr);
}
return false;
}
#if PHP_VERSION_ID >= 80300
auto _arg_sep = zend_string_init(arg_sep, strlen(arg_sep), 0);
php_url_encode_hash_ex(HASH_OF(_data.ptr()),
&formstr,
prefix,
prefix_len,
NULL,
NULL,
_arg_sep,
enc_type);
zend_string_release(_arg_sep);
#else
php_url_encode_hash_ex(HASH_OF(_data.ptr()),
&formstr,
prefix,
prefix_len,
NULL,
0,
NULL,
0,
(_data.isObject() ? _data.ptr() : NULL),
(char *) arg_sep,
enc_type);
#endif

if (!formstr.s) {
Expand Down

0 comments on commit dbe46ec

Please sign in to comment.