Commit Graph

276 Commits

Author SHA1 Message Date
Tobias Bengtsson
58a5e1bcd3 Switch back to using version for bindgen 2022-06-07 14:43:42 +02:00
Tobias Bengtsson
ccb81f0cd6
Merge pull request #143 from TobiasBengtsson/fix-clippy-useless-transmute
Fix clippy errors in nightly - useless transmute, useless ref-deref in Windows build
2022-06-07 14:42:57 +02:00
Tobias Bengtsson
993b79ed3f Fix clippy error in Windows build 2022-06-07 13:17:55 +02:00
Tobias Bengtsson
a110c1710c Fix clippy error in nightly - useless transmute 2022-06-07 12:22:23 +02:00
Tobias Bengtsson
b93571e377
Merge pull request #141 from TobiasBengtsson/fix-lifetime-clippy-ci
Fix clippy warning, unused lifetime parameter
2022-06-07 09:22:36 +02:00
Tobias Bengtsson
ab85298b37 Fix clippy warning, unused lifetime parameter 2022-05-30 16:14:32 +02:00
David Cole
faa452ecd1
Added tomlrs-php to examples 2022-03-31 01:52:46 +13:00
David Cole
664981f4fb
Windows support (#128)
* Preliminary Windows support

* Start work on cross-platform build script

* Fix compilation on macOS

* Updated README, tidied up build script

* Check linker version before starting compilation

It doesn't seem like it's possible to change the linker from within the
build script, however, we can retrieve the linker in use and give the
user a suggestion if the linker will not work.

* Switch to using Github repository for bindgen

* Split Windows and Unix implementations into two files

* Fix building on Windows

* Remove `reqwest` and `zip` as dependencies on Unix

* Fix guide tests on Windows

* Started work on Windows CI

* runs -> run

* Use preinstalled LLVM on Windows

* Debugging for Windows CI

* Switch to upstream `rust-bindgen` master branch

* Switch to `rust-lld` for Windows linking

* Don't compile `cargo-php` on Windows

* Switch to using skeptic for tests

* cargo-php: Disable stub generation, fix ext install/remove

The plan is to replace the stub generation by generating them with PHP
code. This is cross-platform and means we don't need to worry about ABI.
We also don't need to embed information into the library.

* cargo-php: Fix on unix OS

* Fix clippy lint

* Updated README

* Re-add CI for Unix + PHP 8.0

* Fix building on thread-safe PHP

* Tidy up build scripts

* Use dynamic lookup on Linux, test with TS Windows

* Define `ZTS` when compiling PHP ZTS

* Combine Windows and Unix CI, fix linking for Win32TS

* Fix exclusions in build CI

* rust-toolchain -> rust

* Set LLVM version

* Only build docs.rs on Ubuntu PHP 8.1

* Fix build on Linux thread-safe

* Update guide example
2022-03-18 16:36:51 +13:00
David Cole
7520720558 Release 0.7.4 2022-03-17 23:57:56 +13:00
David Cole
4468656563
Add ability to pass modifier function for classes (#127) 2022-03-08 15:01:16 +13:00
David Cole
75ea32346c
Fix CI on macOS (#126)
* Attempt to fix CI on macOS by not installing LLVM

* Download LLVM even on macOS

* Only set LIBCLANG_PATH on non-macOS

* Fix yaml

* Try to set SDK path for macOS

* Multi-line run

* Clippy lint

* Only check docs on PHP 8.1

* When running with docs stub, use PHP 8.1

* Only build docs on Ubuntu

* Remove `macos-ci` branch from actions

* Trigger actions
2022-03-06 16:01:27 +13:00
David Cole
a3fbc24aa3 Updated clap, closes #125 2022-03-05 13:03:39 +13:00
David Cole
9c8dd7cd05 Fix cargo-php 2022-02-25 12:37:36 +13:00
David Cole
8a1fecd431 Updated docs.rs bindings 2022-02-24 22:47:56 +13:00
David Cole
a9e1dad59f Add bindings for php_printf 2022-02-24 22:45:32 +13:00
David Cole
16c456de7d 'Fixed' lifetimes for array conversions
Not 100% sure why we were using higher-ranked trait bounds for this. It
doesn't really make sense to me all these months later.
2022-02-22 12:08:35 +13:00
David Cole
a776d3eaae Fix CI on macOS + docs stubs 2022-02-22 11:24:39 +13:00
David Cole
a09b8474bb Merge branch 'zval_shallow_clone' 2022-02-22 11:14:34 +13:00
Torsten Dittmann
32e2af0ba5
Merge pull request #119 from glyphpoch/fix_request_start_shutdown_funcs
Fix request_(startup|shutdown)_function in ModuleBuilder
2022-01-13 23:49:24 +01:00
Torsten Dittmann
08de883aed
Merge pull request #120 from TorstenDittmann/patch-1
readme: fix link to guide
2022-01-10 13:43:23 +01:00
Torsten Dittmann
2315fa6bc1
readme: fix link to guide 2021-12-30 14:29:59 +01:00
glyphpoch
cbc802fbf2 Fix request_(startup|shutdown)_function in ModuleBuilder
Request specific builder methods were assigning to the wrong fields,
overwriting the MINIT/MSHUTDOWN functions, instead of RINIT/RSHUTDOWN.
2021-12-27 22:03:34 +00:00
Joe Hoyle
910400a1b2
Fix is_true() / is_false() in Zval (#116)
Looks like a copy/pasta
2021-12-14 20:46:15 +13:00
David Cole
f9528f07a8 Add shallow_clone to Zval 2021-12-13 22:43:34 +13:00
David Cole
705be68882 Release v0.7.3 2021-12-13 21:34:44 +13:00
David Cole
1f546b2c71
Add functions to check for numerical and/or sequential keys (#115) 2021-12-13 19:58:02 +13:00
David Cole
3598d9cb71 Add FromZval and FromZvalMut implementations for Zval 2021-12-12 21:11:02 +13:00
David Cole
54c6c64fa6
Create properties hashmap once instead of on each call (#114)
This adds `once_cell` as a dependency, however, it is used for both
handlers and properties. Better to be 'safe' than sorry ;)
2021-12-11 23:54:21 +13:00
vkill
745cd132aa
Upgrade dep clap to 3.0.0-rc.0 (#113) 2021-12-09 21:32:03 +13:00
David Cole
06db954912 Release v0.7.2 2021-11-27 13:00:06 +13:00
David Cole
051e469a44 Print full error when using anyhow 2021-11-24 23:11:26 +13:00
David Cole
c274417c42
Updated README with new opus-php link 2021-11-24 22:25:17 +13:00
David Cole
55cc255ba2 CLI: v0.1.2 2021-11-23 19:02:02 +13:00
David Cole
24fab173f1 Add executor globals to allowed bindings for CLI 2021-11-23 19:01:33 +13:00
David Cole
8c1509f62a
Fix registering constants when using expressions (#112) 2021-11-23 19:01:04 +13:00
David Cole
8d37afc510
Make ClassMetadata: Send + Sync (#111)
This wasn't the case because of `PhantomData<T>` inside the metadata.
Replacing this with `PhantomData<AtomicPtr<T>>` ensures that the
metadata will always be `Send + Sync`.
2021-11-23 18:59:09 +13:00
David Cole
c12dde1866
Add feature to convert anyhow errors to PHP exceptions (#110) 2021-11-23 18:03:25 +13:00
David Cole
6fd31621f2
Add preliminary PHP 8.1 support (#109)
* Bump PHP API version, remove flags removed from PHP API

See following commits:
- 70195c3561
- b5746a4c7f

* Add PHP 8.1 to CI

* Clippy lint

* Fix PHP 8.1 support with new features
2021-11-21 20:00:51 +13:00
David Cole
0a0293acc9 Release v0.7.1 2021-11-21 17:36:17 +13:00
David Cole
d9e40ea4d2
Ensure CLI-Extension compatibility (#108)
* Change describe types to C ABI, check ext-php-rs version

Rust doesn't have a stable ABI so the describe function and types are
now C ABI compatible, however, the internal types `Cow`, `Vec`, `Option`
aren't.

Check `ext-php-rs` versions to check compatibility between the CLI and
the extension.

* CLI requires 0.7.1

* Bump versions

* Replace standard library types with ABI-stable replacements

* Change option type
2021-11-21 17:27:12 +13:00
David Cole
fa05703c08 Release v0.7.0 2021-11-20 14:33:41 +13:00
David Cole
6df362b714
Added CLI crate for stubs, installation and removal (#107)
* started work on stub generator

* Worked on stub CLI tool

* Unused import

* Account for namespaces in function and class names

* Add support for docblocks on structs

* Push Rust comments to stubs

* Add indentation to stub generation

* Add CLI application to install and generate stubs

This time CLI application is defined on user side, called with `cargo
run -- ..args..`

* Export anyhow result

* Add constants to stub file

* Removed stub symbols

No longer required as we are now building while also linking to PHP.
Keeping the stubs causes the stubs to override the real symbols in the
extension.

* Fix stubs for real this time

Removed stub symbols as they were being included in the extension
dylib, fix by loading the PHP executable as a dylib, loading the
required symbols globally.

* Maybe actually fix stubs this time

* Forgot to remove PHP binary loading

* let's give this another go... cargo subcommand

Now called via `cargo php <install,stubs>`.

* Added `remove` command

* Tidied up cargo-php, commented, set up CI

* Fix return types with non-ident types

* define namespace ordering

* Fix tests, replace `Self` when in outer context

* Moved allowed bindings into separate file

* Update guide with CLI instructions
2021-11-20 14:19:02 +13:00
David Cole
bedade8bb3
Fix builds on aarch64 Linux (#106) 2021-11-14 16:01:00 +13:00
David Cole
d74b5d54b7 Clean up clippy lints 2021-11-05 23:45:58 +13:00
David Cole
d0d05678b3 Replace box with in-struct object when building class 2021-11-05 23:41:30 +13:00
David Cole
88b84b9a17
Disable serialization and unserialization on classes (#105)
* Disable serialization and unserialization on classes

Classes that have associated Rust types cannot be serialized for
obvious reasons so these need to be disabled. Disabling these actions
changes in PHP 8.1 to use a flag, so that will need to be solved with
PHP 8.1 support. Closes #97

* update docs stubs
2021-10-19 02:10:02 +13:00
David Cole
b92202c89b Release v0.6.0 2021-10-10 23:21:39 +13:00
David Cole
7812b7ff1e Test docs.rs stub file in lint build 2021-10-10 22:57:38 +13:00
David Cole
b47f8ba160
Allow ZendClassObject as self parameter (#103)
* Allow `ZendClassObject` as `self` parameter

* Fixed tests

* Updated guide

* Updated changelog
2021-10-10 22:46:26 +13:00
David Cole
466c1658e3
Refactor module paths (#101)
* Refactor module layout

* Fixed documentation tests

* Removed skel, moved macro crate

* Ignore folders for crate publish

* Fix builder for zts

* Add `rustfmt.toml`, wrap all comments #96

* Fixed up documentation links, tidied up

* Add `Zend` prefix to callable and hashtable

* Updated guide types

* Updated changelog
2021-10-10 17:51:55 +13:00