Skip to content

Commit

Permalink
Merge branch 'main' into 0.3x
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Feb 21, 2023
2 parents e66925e + 97e3b89 commit bd7c6d0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

This **libuv ffi** implementation is based on PHP extension [ext-uv](https://github.com/amphp/ext-uv). All **ext-uv 0.3.0** _tests and functions_ been implemented, except **uv_queue_work**.

- Functionality works as expected under `Windows` _PHP 7.4, 8.0, 8.1, 8.2_.
- `Linux` all functions and tests completes, but failing by way of `2`, _segmentation fault (core dumped)_ after completing, issues around current **destruct/shutdown** routine implementations and usage of **FFI::free** on _libuv_ C structures.
- `macOS` most functions and tests completes, but failing by way of `4`, implementation issues around **uv_spawn**, **uv_ip4_addr** and **uv_signal**.

**All functionality is interdependent on [zend-ffi](https://github.com/symplely/zend-ffi).**
- Functionality works as expected under _`Windows`_, _`Linux`_, and _`Apple macOS`_, **PHP 7.4 to 8.2**.
- All functionality is interdependent on [zend-ffi](https://github.com/symplely/zend-ffi).

The actual threading feature of `uv_queue_work` in **ext-uv 0.3.0** is on pause. Getting native PThreads working with FFI, needs a lot more investigation and more likely C development of PHP source code. Seems someone else has started something similar <https://github.com/mrsuh/php-pthreads>.

Expand Down Expand Up @@ -55,7 +52,8 @@ opcache.jit_buffer_size=8M
ffi.enable="true"

; List of headers files to preload, wildcard patterns allowed. `ffi.preload` has no effect on Windows.
;ffi.preload=path/to/vendor/symplely/uv-ffi/headers/uv_your-OS-platform_vendor.h
; replace `your-platform` with: windows, centos7, centos8+, macos, pi, ubuntu18.04, or ubuntu20.04
;ffi.preload=path/to/vendor/symplely/uv-ffi/headers/uv_your-platform_generated.h

;opcache.preload==path/to/vendor/symplely/uv-ffi/preload.php
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require": {
"php": ">7.4",
"ext-ffi": "*",
"symplely/zend-ffi": "~0.12.1"
"symplely/zend-ffi": "~0.12.2"
},
"autoload": {
"files": [
Expand Down
2 changes: 1 addition & 1 deletion preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function uv_ffi_loader()

$vendor_dir = 'vendor' . \DS . 'symplely' . \DS . 'uv-ffi';
if (\file_exists($vendor_dir) && (\IS_WINDOWS || \IS_MACOS)) {
$vendor_code = \str_replace('.h', '_vendor.h', $code);
$vendor_code = \str_replace('.h', '_generated.h', $code);
if (!\file_exists($vendor_code)) {
$file = \str_replace(
'FFI_LIB ".',
Expand Down
2 changes: 1 addition & 1 deletion tests/004-uv_write-no-memory_leak.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--TEST--
Check for uv_write has no memory leak
--SKIPIF--
<?php if (!extension_loaded("ffi") || (getenv('GITHUB_ACTIONS') !== false && '\\' !== \DIRECTORY_SEPARATOR && (float) \phpversion() < 8.2)) print "skip"; ?>
<?php if (!extension_loaded("ffi") || (getenv('GITHUB_ACTIONS') !== false && \PHP_OS === 'Linux' && (float) \phpversion() < 8.0)) print "skip"; ?>
--FILE--
<?php
require 'vendor/autoload.php';
Expand Down
2 changes: 1 addition & 1 deletion tests/800.1-uv_signal.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $stdio[] = uv_stdio_new($out, UV::CREATE_PIPE | UV::WRITABLE_PIPE);
$flags = 0;
$process = uv_spawn(
uv_default_loop(),
"php",
PHP_BINARY,
array('-r', 'echo "World!" . PHP_EOL; sleep(100);'),
$stdio,
__DIR__,
Expand Down
2 changes: 1 addition & 1 deletion tests/800.1-uv_spawn.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $stdio[] = uv_stdio_new($out, UV::CREATE_PIPE | UV::WRITABLE_PIPE);

uv_spawn(
uv_default_loop(),
"php",
PHP_BINARY,
array('-r', "var_dump(getenv('KEY'));"),
$stdio,
__DIR__,
Expand Down

0 comments on commit bd7c6d0

Please sign in to comment.