|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80935 PECL/Expect 0.4.0 $match[0] does not provide any result
Submitted: 2021-04-04 19:43 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: benjamin dot lugger at gmail dot com Assigned:
Status: Open Package: expect (PECL)
PHP Version: 7.3.27 OS: Linux pi 5.10.17-v7l+ #1403
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: benjamin dot lugger at gmail dot com
New email:
PHP Version: OS:


 [2021-04-04 19:43 UTC] benjamin dot lugger at gmail dot com
The sample script (Example #2) from your web page:
has been used.

It works  under php5 and expect 0.3.3 but not under php7 and expect 0.4.0.

It should be easy to reproduce the issue. Just issue the script on a linux system. I have worked with expect 0.3.3 and prior versions since about 8 years. I never had any issues. I was pretty happy to see 0.4.0 with support of php7 but it really has some issues!

In your documentation "" you write: "If match is provided, then it is filled with the result of search. The matched string can be found in match[0]. The match substrings (according to the parentheses) in the original pattern can be found in match[1], match[2], and so on, up to match[9] (the limitation of libexpect)."

This does not work in the current version. The result of search does not fill "match". §match[0] is not filled!

Test script:
Your own script does not work:

Expected result:
case UNAME:
$uname .= $match[0];
print "Result: $uname";

$uname provid

Actual result:
case UNAME:
$uname .= $match[0];
print "Result: $uname";

$uname does not provide a result!


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 06:01:34 2024 UTC