Skip to content

Commit 2169df9

Browse files
committed
use zend_update_property_long.
1 parent 01c54a7 commit 2169df9

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

examples/namespace/http_server.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2+
ini_set("swoole.use_namespace", "1");
23
use Swoole\Http\Server;
34
use Swoole\Http\Request;
45
use Swoole\Http\Response;
56

67
$serv = new Server('127.0.0.1', 9501);
78

89
$serv->on('Request', function(Request $req, Response $resp) {
9-
var_dump($req->header);
10+
var_dump($req->header, get_class($req));
1011
$resp->end("<h1>Hello Swoole</h1>");
1112
});
1213

examples/redis/subscribe.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: htf
5-
* Date: 16-1-29
6-
* Time: 下午1:07
7-
*/
2+
$client = new swoole_redis;
3+
4+
$client->on('message', function (swoole_redis $client, $result) {
5+
var_dump($result);
6+
static $more = false;
7+
if (!$more and $result[0] == 'message')
8+
{
9+
echo "subscribe new channel\n";
10+
$client->subscribe('msg_1', 'msg_2');
11+
$client->unsubscribe('msg_0');
12+
$more = true;
13+
}
14+
});
15+
16+
$client->connect('127.0.0.1', 6379, function (swoole_redis $client, $result) {
17+
echo "connect\n";
18+
$client->subscribe('msg_0');
19+
});

swoole_http_client.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,7 @@ static PHP_METHOD(swoole_http_client, __construct)
837837
swoole_set_property(getThis(), 0, hcc);
838838
hcc->request_header = headers;
839839

840-
zval *ztype;
841-
SW_MAKE_STD_ZVAL(ztype);
842-
Z_LVAL_P(ztype) = SW_SOCK_TCP | SW_FLAG_ASYNC;
843-
zend_update_property(swoole_client_class_entry_ptr, getThis(), ZEND_STRL("type"), ztype TSRMLS_CC);
840+
zend_update_property_long(swoole_client_class_entry_ptr, getThis(), ZEND_STRL("type"), SW_SOCK_TCP | SW_FLAG_ASYNC TSRMLS_CC);
844841

845842
RETURN_TRUE;
846843
}

0 commit comments

Comments
 (0)