<commit_before>--TEST--
Test adding / removing items
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php

include dirname(__FILE__) . '/zeromq_test_helper.inc';

/* Create socket, request-reply pattern (reply socket) */
$z = create_client();
$s = create_server();

/* create handle */
$fp = fsockopen("tcp://localhost:5566");
usleep(1000);

$poll   = new ZMQPoll();
$obj_id = $poll->add($z, ZMQ::POLL_IN);
$fp_id  = $poll->add($fp, ZMQ::POLL_IN | ZMQ::POLL_OUT);

var_dump($obj_id, $fp_id, $poll->count());

$a = array();
$b = array();
$poll->poll($a, $b, 100);
var_dump($a, $b);

fclose($fp);

var_dump($poll->poll($a, $b, 100));
var_dump($poll->getLastErrors());

$poll->remove($fp_id);

$poll->clear();
var_dump($poll->count());

--EXPECTF--
string(34) "o:%s"
string(3) "r:%d"
int(2)
array(1) {
  [0]=>
  resource(%d) of type (stream)
}
array(1) {
  [0]=>
  resource(%d) of type (stream)
}
int(1)
array(1) {
  [0]=>
  string(3) "r:%d"
}
int(0)<commit_msg>Lets see if this is a timing issue<commit_after>--TEST--
Test adding / removing items
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php

include dirname(__FILE__) . '/zeromq_test_helper.inc';

/* Create socket, request-reply pattern (reply socket) */
$z = create_client();
$s = create_server();

/* create handle */
$fp = fsockopen("tcp://localhost:5566");
usleep(1000);

$poll   = new ZMQPoll();
$obj_id = $poll->add($z, ZMQ::POLL_IN);
$fp_id  = $poll->add($fp, ZMQ::POLL_IN | ZMQ::POLL_OUT);

var_dump($obj_id, $fp_id, $poll->count());

$a = array();
$b = array();
$poll->poll($a, $b, 1000);
var_dump($a, $b);

fclose($fp);

var_dump($poll->poll($a, $b, 1000));
var_dump($poll->getLastErrors());

$poll->remove($fp_id);

$poll->clear();
var_dump($poll->count());

--EXPECTF--
string(34) "o:%s"
string(3) "r:%d"
int(2)
array(1) {
  [0]=>
  resource(%d) of type (stream)
}
array(1) {
  [0]=>
  resource(%d) of type (stream)
}
int(1)
array(1) {
  [0]=>
  string(3) "r:%d"
}
int(0)
{'fraction_non_alphanumeric': 0.2526210683974039, 'fraction_numerical': 0.027958062905641536, 'mean_word_length': 4.758620689655173, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '898829', 'n_tokens_mistral': 891, 'n_tokens_neox': 857, 'n_words': 172}