Skip to content

Commit 33c6732

Browse files
committed
Merge branch 'master' into throw-exception-object
2 parents d5e05f0 + 6965f4a commit 33c6732

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1082
-435
lines changed

.github/actions/zts/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:zts
1+
FROM php:8.1-zts
22

33
WORKDIR /tmp
44

.github/workflows/build.yml

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build and Lint
22
on:
3+
schedule:
4+
# runs every monday at midnight
5+
- cron: "0 0 * * 1"
36
push:
47
branches:
58
- master
@@ -12,8 +15,9 @@ jobs:
1215
strategy:
1316
matrix:
1417
os: [ubuntu-latest, macos-latest, windows-latest]
15-
php: ['8.0', '8.1']
18+
php: ["8.0", "8.1"]
1619
rust: [stable, nightly]
20+
clang: ["14"]
1721
phpts: [ts, nts]
1822
exclude:
1923
# ext-php-rs requires nightly Rust when on Windows.
@@ -24,6 +28,8 @@ jobs:
2428
phpts: ts
2529
- os: ubuntu-latest
2630
phpts: ts
31+
env:
32+
CARGO_TERM_COLOR: always
2733
steps:
2834
- name: Checkout code
2935
uses: actions/checkout@v3
@@ -34,52 +40,67 @@ jobs:
3440
env:
3541
phpts: ${{ matrix.phpts }}
3642
- name: Setup Rust
37-
uses: actions-rs/toolchain@v1
43+
uses: dtolnay/rust-toolchain@master
3844
with:
3945
toolchain: ${{ matrix.rust }}
40-
override: true
4146
components: rustfmt, clippy
42-
- name: Setup LLVM & Clang
47+
- run: rustup show
48+
- name: Cache cargo dependencies
49+
uses: Swatinem/rust-cache@v2
50+
# Uncomment the following if statement if caching nightly deps
51+
# ends up causing too much cache invalidation.
52+
# if: matrix.rust == 'stable'
53+
with:
54+
# increment this manually to force cache eviction
55+
prefix-key: "v0-rust"
56+
# LLVM & Clang
57+
- name: Cache LLVM and Clang
58+
id: cache-llvm
59+
uses: actions/cache@v3
4360
if: "!contains(matrix.os, 'windows')"
61+
with:
62+
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
63+
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
64+
- name: Setup LLVM & Clang
4465
id: clang
4566
uses: KyleMayes/install-llvm-action@v1
67+
if: "!contains(matrix.os, 'windows')"
4668
with:
47-
version: '13.0'
48-
directory: ${{ runner.temp }}/llvm
69+
version: ${{ matrix.clang }}
70+
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
71+
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
4972
- name: Configure Clang
5073
if: "!contains(matrix.os, 'windows')"
5174
run: |
52-
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV
75+
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
5376
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
77+
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
5478
- name: Configure Clang (macOS only)
5579
if: "contains(matrix.os, 'macos')"
5680
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
81+
# Build
5782
- name: Build
5883
env:
59-
EXT_PHP_RS_TEST:
84+
EXT_PHP_RS_TEST: ""
6085
run: cargo build --release --all-features --all
86+
# Test & lint
6187
- name: Test inline examples
62-
uses: actions-rs/cargo@v1
63-
with:
64-
command: test
65-
args: --release --all --all-features
88+
run: cargo test --release --all --all-features
6689
- name: Run rustfmt
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: fmt
70-
args: --all -- --check
90+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
91+
run: cargo fmt --all -- --check
7192
- name: Run clippy
72-
uses: actions-rs/cargo@v1
73-
with:
74-
command: clippy
75-
args: --all -- -D warnings
76-
if: matrix.rust == 'stable'
93+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
94+
run: cargo clippy --all -- -D warnings
95+
# Docs
96+
- name: Run rustdoc
97+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
98+
run: cargo rustdoc -- -D warnings
7799
- name: Build with docs stub
78-
if: "contains(matrix.os, 'ubuntu') && matrix.php == '8.1'"
100+
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.1'
79101
env:
80-
DOCS_RS:
81-
run:
82-
cargo clean && cargo build
102+
DOCS_RS: ""
103+
run: cargo clean && cargo build
83104
build-zts:
84105
name: Build with ZTS
85106
runs-on: ubuntu-latest

.github/workflows/docs.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
name: Deploy documentation
22
on:
33
workflow_dispatch:
4+
# runs every monday at midnight
5+
schedule:
6+
- cron: "0 0 * * 1"
47
push:
58
branches:
69
- master
710

811
jobs:
912
docs:
1013
name: Build and Deploy
11-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: ["ubuntu-latest"]
18+
php: ["8.0"]
19+
clang: ["14"]
20+
mdbook: ["latest"]
1221
steps:
1322
- name: Checkout code
1423
uses: actions/checkout@v3
1524
- name: Setup PHP
1625
uses: shivammathur/setup-php@v2
1726
with:
18-
php-version: 8.0
27+
php-version: ${{ matrix.php }}
1928
- name: Setup Rust
20-
uses: actions-rs/toolchain@v1
29+
uses: dtolnay/rust-toolchain@nightly
30+
- name: Cache LLVM and Clang
31+
id: cache-llvm
32+
uses: actions/cache@v3
2133
with:
22-
toolchain: nightly
23-
override: true
34+
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
35+
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
2436
- name: Setup LLVM & Clang
2537
uses: KyleMayes/install-llvm-action@v1
2638
with:
27-
version: 11.0
28-
directory: ${{ runner.temp }}/llvm-11.0
39+
version: ${{ matrix.clang }}
40+
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
41+
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
2942
- name: Install mdbook
3043
uses: peaceiris/actions-mdbook@v1
3144
with:
32-
mdbook-version: latest
45+
mdbook-version: ${{ matrix.mdbook }}
3346
- name: Build guide
3447
run: mdbook build guide
3548
- name: Publish docs

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
Cargo.lock
33
/.vscode
44
/.idea
5-
expand.rs
5+
/tmp
6+
expand.rs

CHANGELOG.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,125 @@
11
# Changelog
22

3+
## Version 0.9.0
4+
5+
- ci+docs: honour PHP_CONFIG & rebuild automatically when env vars change by @julius [#210]
6+
- chore: Update generated FFI bindings with bindgen 0.63 by @ptondereau [#211]
7+
8+
**BC changes**
9+
- feat: allows ZendStr to contain null bytes by @julius [#202]
10+
11+
**Migration**
12+
See: [#202]
13+
14+
[#202]: https://github.com/davidcole1340/ext-php-rs/pull/202
15+
[#210]: https://github.com/davidcole1340/ext-php-rs/pull/210
16+
[#211]: https://github.com/davidcole1340/ext-php-rs/pull/211
17+
18+
19+
## Version 0.8.3
20+
21+
- build: Check docs warnings in CI by @davidcole1340 in [#180]
22+
- fix: Fixes inifinte loop in ClassEntry::instance_of() by @ju1ius in [#188]
23+
- fix: Fix binary slice lifetimes by @davidcole1340 in [#181]
24+
- build: Fixes CI workflow configuration by @ju1ius in [#195]
25+
- feat: Add get_id() and hash() methods on ZendObject by @ju1ius in [#196]
26+
- docs: Describes restrictions on generic parameters for `php_class` by @ju1ius in [#194]
27+
- feat: Add instance_of() and get_class_entry() methods on ZendObject by @ju1ius in [#197]
28+
29+
[#180]: https://github.com/davidcole1340/ext-php-rs/pull/180
30+
[#188]: https://github.com/davidcole1340/ext-php-rs/pull/188
31+
[#181]: https://github.com/davidcole1340/ext-php-rs/pull/181
32+
[#195]: https://github.com/davidcole1340/ext-php-rs/pull/195
33+
[#196]: https://github.com/davidcole1340/ext-php-rs/pull/196
34+
[#194]: https://github.com/davidcole1340/ext-php-rs/pull/194
35+
[#197]: https://github.com/davidcole1340/ext-php-rs/pull/197
36+
37+
## Version 0.8.2
38+
39+
- Update changelog for latest versions by @striezel in [#161]
40+
- fix building docs on docs.rs by @davidcole1340 in [#165]
41+
- Add some standard zend interfaces by @nikeee in [#164]
42+
- Correct parameter name. by @denzyldick in [#168]
43+
- fix describe when using `#[implements]` by @davidcole1340 in [#169]
44+
- Add example that shows how to implement an interface by @nikeee in [#167]
45+
- add `before` flag to `#[php_startup]` by @davidcole1340 in [#170]
46+
- add ability to define abstract methods by @davidcole1340 in [#171]
47+
- chore(cli): Bump Clap for CLI tool by @ptondereau in [#177]
48+
- fix type links in docs.rs by @davidcole1340 in [#179]
49+
50+
[#161]: https://github.com/davidcole1340/ext-php-rs/pull/161
51+
[#165]: https://github.com/davidcole1340/ext-php-rs/pull/165
52+
[#164]: https://github.com/davidcole1340/ext-php-rs/pull/164
53+
[#168]: https://github.com/davidcole1340/ext-php-rs/pull/168
54+
[#169]: https://github.com/davidcole1340/ext-php-rs/pull/169
55+
[#167]: https://github.com/davidcole1340/ext-php-rs/pull/167
56+
[#170]: https://github.com/davidcole1340/ext-php-rs/pull/170
57+
[#171]: https://github.com/davidcole1340/ext-php-rs/pull/171
58+
[#177]: https://github.com/davidcole1340/ext-php-rs/pull/177
59+
[#179]: https://github.com/davidcole1340/ext-php-rs/pull/179
60+
61+
## Version 0.8.1
62+
63+
- 404 /guide doesn't exists. by @denzyldick in [#149]
64+
- Fixed some typos by @denzyldick in [#148]
65+
- Fix a few typos by @striezel in [#150]
66+
- fix causes of some clippy warnings by @striezel in [#152]
67+
- fix more causes of clippy warnings by @striezel in [#157]
68+
- attempt to fix errors related to clap by @striezel in [#158]
69+
- ci: run clippy only on stable Rust channel by @striezel in [#159]
70+
- update actions/checkout in GitHub Actions workflows to v3 by @striezel in
71+
[#151]
72+
- Add ability to set function name on php_function macro by @joehoyle in [#153]
73+
- Specify classes as fully-qualified names in stubs by @joehoyle in [#156]
74+
- Support marking classes as interfaces by @joehoyle in [#155]
75+
- Support marking methods as abstract by @joehoyle in [#154]
76+
- Add php-scrypt as a example project by @PineappleIOnic in [#146]
77+
- Fix ini file duplication and truncation when using cargo-php command by
78+
@roborourke in [#136]
79+
- Allow passing --yes parameter to bypass prompts by @roborourke in [#135]
80+
81+
[#135]: https://github.com/davidcole1340/ext-php-rs/pull/135
82+
[#136]: https://github.com/davidcole1340/ext-php-rs/pull/136
83+
[#146]: https://github.com/davidcole1340/ext-php-rs/pull/146
84+
[#148]: https://github.com/davidcole1340/ext-php-rs/pull/148
85+
[#149]: https://github.com/davidcole1340/ext-php-rs/pull/149
86+
[#150]: https://github.com/davidcole1340/ext-php-rs/pull/150
87+
[#151]: https://github.com/davidcole1340/ext-php-rs/pull/151
88+
[#152]: https://github.com/davidcole1340/ext-php-rs/pull/152
89+
[#153]: https://github.com/davidcole1340/ext-php-rs/pull/153
90+
[#154]: https://github.com/davidcole1340/ext-php-rs/pull/154
91+
[#155]: https://github.com/davidcole1340/ext-php-rs/pull/155
92+
[#156]: https://github.com/davidcole1340/ext-php-rs/pull/156
93+
[#157]: https://github.com/davidcole1340/ext-php-rs/pull/157
94+
[#158]: https://github.com/davidcole1340/ext-php-rs/pull/158
95+
[#159]: https://github.com/davidcole1340/ext-php-rs/pull/159
96+
97+
## Version 0.8.0
98+
99+
- Windows support by @davidcole1340 in [#128]
100+
- Support for binary slice to avoid extra allocation by @TobiasBengtsson in
101+
[#139]
102+
- Bump dependencies by @ptondereau in [#144]
103+
104+
[#128]: https://github.com/davidcole1340/ext-php-rs/pull/128
105+
[#139]: https://github.com/davidcole1340/ext-php-rs/pull/139
106+
[#144]: https://github.com/davidcole1340/ext-php-rs/pull/144
107+
108+
## Version 0.7.4
109+
110+
- Fix is_true() / is_false() in Zval by @joehoyle in [#116]
111+
- readme: fix link to guide by @TorstenDittmann in [#120]
112+
- Fix request_(startup|shutdown)_function in ModuleBuilder by @glyphpoch in
113+
[#119]
114+
- Fix CI on macOS by @davidcole1340 in [#126]
115+
- Add ability to pass modifier function for classes by @davidcole1340 in [#127]
116+
117+
[#116]: https://github.com/davidcole1340/ext-php-rs/pull/116
118+
[#119]: https://github.com/davidcole1340/ext-php-rs/pull/119
119+
[#120]: https://github.com/davidcole1340/ext-php-rs/pull/120
120+
[#126]: https://github.com/davidcole1340/ext-php-rs/pull/126
121+
[#127]: https://github.com/davidcole1340/ext-php-rs/pull/127
122+
3123
## Version 0.7.3
4124

5125
- Upgrade `clap` to `3.0.0-rc3`. [#113]

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
55
homepage = "https://github.com/davidcole1340/ext-php-rs"
66
license = "MIT OR Apache-2.0"
77
keywords = ["php", "ffi", "zend"]
8-
version = "0.8.0"
8+
version = "0.9.0"
99
authors = ["David Cole <[email protected]>"]
1010
edition = "2018"
1111
categories = ["api-bindings"]
@@ -17,15 +17,14 @@ parking_lot = "0.12.1"
1717
cfg-if = "1.0"
1818
once_cell = "1.8.0"
1919
anyhow = { version = "1", optional = true }
20-
ext-php-rs-derive = { version = "=0.8.0", path = "./crates/macros" }
20+
ext-php-rs-derive = { version = "=0.9.0", path = "./crates/macros" }
2121

2222
[dev-dependencies]
2323
skeptic = "0.13"
2424

2525
[build-dependencies]
2626
anyhow = "1"
27-
# bindgen = { version = "0.59" }
28-
bindgen = "0.60"
27+
bindgen = "0.63"
2928
cc = "1.0"
3029
skeptic = "0.13"
3130

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ Check out one of the example projects:
163163
- [opus-php](https://github.com/davidcole1340/opus-php) - Audio encoder for the
164164
Opus codec in PHP.
165165
- [tomlrs-php](https://github.com/jphenow/tomlrs-php) - TOML data format parser.
166+
- [php-scrypt](https://github.com/appwrite/php-scrypt) - PHP wrapper for the
167+
scrypt password hashing algorithm.
166168

167169
## Contributions
168170

allowed_bindings.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
// exist in the bindings file. Which ever script include!s the bindings must
55
// define the `bind` macro. This allows us to have the list in string format
66
// inside the build script and in macro format inside the CLI crate.
7+
//
8+
// NOTE TO EDITORS:
9+
// When updating this file, you must re-generate the `docsrs_bindings.rs`
10+
// file used by docs.rs to build documentation. To perform this:
11+
//
12+
// $ cargo clean
13+
// $ cargo build
14+
// $ cp target/debug/build/ext-php-rs-e2cb315d27898d01/out/bindings.rs
15+
// docsrs_bindings.rs
16+
// $ git add . && git commit -m "update docs.rs bindings"
17+
//
18+
// The hash after `ext-php-rs-` in the bindings path may change. There should
19+
// be two folders beginning with `ext-php-rs-` in `target/debug/build`, so
20+
// check both for the presense of the bindings file.
721

822
bind! {
923
HashTable,
@@ -29,6 +43,8 @@ bind! {
2943
// ext_php_rs_zend_object_release,
3044
// ext_php_rs_zend_string_init,
3145
// ext_php_rs_zend_string_release,
46+
// ext_php_rs_is_kown_valid_utf8,
47+
// ext_php_rs_set_kown_valid_utf8,
3248
object_properties_init,
3349
php_info_print_table_end,
3450
php_info_print_table_header,
@@ -49,6 +65,13 @@ bind! {
4965
zend_ce_type_error,
5066
zend_ce_unhandled_match_error,
5167
zend_ce_value_error,
68+
zend_ce_traversable,
69+
zend_ce_aggregate,
70+
zend_ce_iterator,
71+
zend_ce_arrayaccess,
72+
zend_ce_serializable,
73+
zend_ce_countable,
74+
zend_ce_stringable,
5275
zend_class_entry,
5376
zend_declare_class_constant,
5477
zend_declare_property,

0 commit comments

Comments
 (0)