mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Current, broken PHP 7 port...
This commit is contained in:
parent
605a20a568
commit
4332fe7aa1
16
php_uv.h
16
php_uv.h
@ -39,9 +39,7 @@
|
||||
#include "php_network.h"
|
||||
#include "php_streams.h"
|
||||
|
||||
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)
|
||||
#include "ext/sockets/php_sockets.h"
|
||||
#endif
|
||||
|
||||
#include <Zend/zend.h>
|
||||
#include <Zend/zend_compile.h>
|
||||
@ -134,7 +132,7 @@ typedef struct {
|
||||
#ifdef ZTS
|
||||
void ***thread_ctx;
|
||||
#endif
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
int type;
|
||||
uv_os_sock_t sock;
|
||||
union {
|
||||
@ -167,7 +165,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
int is_ipv4;
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
union {
|
||||
struct sockaddr_in ipv4;
|
||||
struct sockaddr_in6 ipv6;
|
||||
@ -177,7 +175,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int locked;
|
||||
enum php_uv_lock_type type;
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
union {
|
||||
uv_rwlock_t rwlock;
|
||||
uv_mutex_t mutex;
|
||||
@ -186,7 +184,7 @@ typedef struct {
|
||||
} php_uv_lock_t;
|
||||
|
||||
typedef struct {
|
||||
int resource_id;
|
||||
zend_resource *resource_id;
|
||||
int fd;
|
||||
zval *stream;
|
||||
int flags;
|
||||
@ -201,11 +199,7 @@ typedef struct {
|
||||
#define PHP_UV_STDIO_RESOURCE_NAME "uv_stdio"
|
||||
|
||||
|
||||
#if PHP_VERSION_ID>=50399
|
||||
#define PHP_UV_LIST_INSERT(type, handle) zend_list_insert(type, handle TSRMLS_CC)
|
||||
#else
|
||||
#define PHP_UV_LIST_INSERT(type, handle) zend_list_insert(type, handle)
|
||||
#endif
|
||||
#define PHP_UV_LIST_INSERT(type, handle) Z_RES_P(zend_list_insert(type, handle))
|
||||
|
||||
|
||||
/* File/directory stat mode constants*/
|
||||
|
@ -11,5 +11,6 @@ $async = uv_async_init($loop, function($async){
|
||||
uv_async_send($async);
|
||||
|
||||
uv_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello
|
||||
|
@ -6,9 +6,7 @@ $loop = uv_default_loop();
|
||||
$timer = uv_timer_init();
|
||||
|
||||
$i = 0;
|
||||
uv_timer_start($timer, 10, 10, function($timer)
|
||||
use (&$i) {
|
||||
|
||||
uv_timer_start($timer, 10, 10, function($timer) use (&$i) {
|
||||
echo "count: {$i}" . PHP_EOL;
|
||||
$i++;
|
||||
|
||||
|
@ -11,8 +11,7 @@ uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||||
throw new Exception("read error");
|
||||
}
|
||||
|
||||
uv_fs_close(uv_default_loop(), $stream, function(){
|
||||
});
|
||||
uv_fs_close(uv_default_loop(), $stream, function() { });
|
||||
} else {
|
||||
echo $data ;
|
||||
}
|
||||
@ -27,8 +26,7 @@ uv_fs_open(uv_default_loop(),FIXTURE_PATH, UV::O_RDONLY, 0, function($r){
|
||||
throw new Exception("read error");
|
||||
}
|
||||
|
||||
uv_fs_close(uv_default_loop(), $stream, function(){
|
||||
});
|
||||
uv_fs_close(uv_default_loop(), $stream, function() { });
|
||||
} else {
|
||||
echo $data;
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result){
|
||||
|
||||
uv_run();
|
||||
|
||||
--EXPECT--
|
||||
0
|
||||
--EXPECTF--
|
||||
Resource id #%d
|
||||
|
@ -12,5 +12,5 @@ uv_fs_rmdir(uv_default_loop(), DIRECTORY_PATH, function($result){
|
||||
|
||||
uv_run();
|
||||
|
||||
--EXPECT--
|
||||
0
|
||||
--EXPECTF--
|
||||
Resource id #%d
|
||||
|
@ -5,9 +5,8 @@ Check for fs_send_file
|
||||
define("FIXTURE_PATH", dirname(__FILE__) . "/fixtures/hello.data");
|
||||
|
||||
uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($read_fd) {
|
||||
$std_err = 1; // phpt doesn't catch stdout as uv_fs_sendfile uses stdout directly.
|
||||
uv_fs_sendfile(uv_default_loop(),$std_err, $read_fd, 0, 6, function($result){
|
||||
});
|
||||
$std_err = STDERR; // phpt doesn't catch stdout as uv_fs_sendfile uses stdout directly.
|
||||
uv_fs_sendfile(uv_default_loop(), $std_err, $read_fd, 0, 6, function($result) { });
|
||||
});
|
||||
|
||||
uv_run();
|
||||
|
@ -12,7 +12,6 @@ uv_poll_start($poll, UV::READABLE, function($poll, $stat, $ev, $socket){
|
||||
uv_poll_stop($poll);
|
||||
$pp = uv_poll_init(uv_default_loop(), $conn);
|
||||
uv_poll_start($pp, UV::WRITABLE, function($poll, $stat, $ev, $conn) use (&$pp) {
|
||||
|
||||
uv_poll_stop($poll);
|
||||
uv_fs_write(uv_default_loop(), $conn, "OK", -1, function($conn, $nwrite){
|
||||
fclose($conn);
|
||||
@ -30,7 +29,6 @@ EOF;
|
||||
if ($stat == 0) {
|
||||
uv_read_start($client, function($client, $nread, $buffer) {
|
||||
echo "$buffer\n";
|
||||
//var_dump($buffer);
|
||||
uv_close($client);
|
||||
});
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ uv_spawn(uv_default_loop(), "php", array('-r','echo "WORLD";'), $stdio, dirname(
|
||||
|
||||
}, $flags);
|
||||
|
||||
uv_read_start($out, function($out, $nread, $buffer) {
|
||||
uv_read2_start($out, function($out, $nread, $buffer, $stat){
|
||||
echo $buffer;
|
||||
|
||||
uv_close($out, function() { });
|
||||
|
@ -4,12 +4,7 @@ Check for uv_chdir
|
||||
<?php
|
||||
uv_chdir(); // don't SEGV
|
||||
|
||||
if(uv_chdir(dirname(__FILE__))) {
|
||||
echo "OK\n";
|
||||
} else {
|
||||
echo "FAILED: expected uv_chdir to return true";
|
||||
}
|
||||
|
||||
uv_chdir(dirname(__FILE__));
|
||||
if (uv_cwd() == dirname(__FILE__)) {
|
||||
echo "OK";
|
||||
} else {
|
||||
@ -20,4 +15,3 @@ if (uv_cwd() == dirname(__FILE__)) {
|
||||
|
||||
Warning: uv_chdir() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
OK
|
||||
OK
|
||||
|
2
uv.c
2
uv.c
@ -190,7 +190,7 @@ static int php_uv_class_init(TSRMLS_D)
|
||||
zend_declare_class_constant_long(uv_class_entry, "HTTP_RESPONSE", sizeof("HTTP_RESPONSE")-1, HTTP_RESPONSE TSRMLS_CC);
|
||||
#endif
|
||||
|
||||
#define PHP_UV_ERRNO_GEN(name, msg_notused) zend_declare_class_constant_long(uv_class_entry, #name, sizeof(#name)-1, UV_##name TSRMLS_CC);
|
||||
#define PHP_UV_ERRNO_GEN(name, msg_notused) zend_declare_class_constant_long(uv_class_entry, ZEND_STRL(#name), UV_##name);
|
||||
UV_ERRNO_MAP(PHP_UV_ERRNO_GEN)
|
||||
#undef PHP_UV_ERRNO_GEN
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user