Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Array Key WARNING #1856

Open
vansari opened this issue Oct 21, 2022 · 1 comment
Open

Undefined Array Key WARNING #1856

vansari opened this issue Oct 21, 2022 · 1 comment

Comments

@vansari
Copy link

vansari commented Oct 21, 2022

Hi,

is it possible that we can check if the key exists or can we coalesce to false if it doesnt exists?

if (!$this->window_size_client_to_server[$client_channel]) {

@terrafrost
Copy link
Member

Before considering your PR's I'd like to better understand why this is needed. Can you tell me what version of phpseclib you're using and could you provide the full log files? You can get them by doing define('NET_SSH2_LOGGING', 2) at the top of your file and then echo $ssh->getLog(); after you get the error.

The thing is... when phpseclib opens a channel the server should respond with an OPEN_CONFIRMATION packet that should set that variable:

case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION:
list(
$this->server_channels[$channel],
$window_size,
$this->packet_size_client_to_server[$channel]
) = Strings::unpackSSH2('NNN', $response);
if ($window_size < 0) {
$window_size &= 0x7FFFFFFF;
$window_size += 0x80000000;
}
$this->window_size_client_to_server[$channel] = $window_size;

If the server tries to open a channel on the client (phpseclib) then phpseclib will respond with an OPEN_FAILURE response unless the CHANNEL_OPEN request is for auth-agent or auth-agent@openssh.com.

If phpseclib is sending channel data for a channel that has not been opened then that's a bug which this code (1) doesn't fix and (2) sweeps under the rug and makes it harder to spot.

So instead of trying to address the symptoms I'd rather we consider the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants