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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 04:01:27 2024 UTC