php.net |  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: -
Votes:1
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:
Package:
Bug Type:
Summary:
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
Description:
------------
The sample script (Example #2) from your web page:
"https://www.php.net/manual/en/expect.examples-usage.php" 
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 "https://www.php.net/manual/en/function.expect-expectl.php" 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:
"https://www.php.net/manual/en/expect.examples-usage.php"


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


=>
$uname provid

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


=>
$uname does not provide a result!

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 02:01:23 2021 UTC