3

I am getting hundreds of from ANSI.php. Here is an example:

/usr/share/pear/File/ANSI.php on line 553 Notice: Undefined offset: 75 in 
/usr/share/pear/File/ANSI.php on line 555 Notice: Undefined offset: 76 in 
/usr/share/pear/File/ANSI.php on line 553 Notice: Undefined offset: 76 in 
/usr/share/pear/File/ANSI.php on line 555 Notice: Undefined offset: 77 in
/usr/share/pear/File/ANSI.php on line 555 Notice: Trying to get property of non-object in
/usr/share/pear/File/ANSI.php on line 496 Notice: Trying to get property of non-object in  

This is generating from:

$ansi->appendString($ssh->read());

Everything is working. I suspect the old machines I am working with are giving ANSI.php a hard time.

Is there a way i can disable just the error messages from ANSI.PHP and keep the others? Unless someone has a way of fixing the error.

4
  • I don't know ansi lib but can you make sure that $ssh->read() is a string? like $ansi->appendString((string)$ssh->read()); Commented Sep 10, 2017 at 6:37
  • So I swapped in $ansi->appendString((string)$ssh->read()); Same results. Commented Sep 10, 2017 at 7:36
  • What about $str = $ssh->read(); if (!empty($str)) { $ansi->appendString($str); } Commented Sep 10, 2017 at 8:01
  • $Str would always have a value because i dont have a clear() and the connection is established. so there is always something there to read. I did what you suggested just to be sure and it had the same results. The filter is a great idea, I think we just need a to filter out illegal chars perhaps. Commented Sep 10, 2017 at 8:24

1 Answer 1

1

Simplest Solution (Sub-Optimal)

I guess the simplest way to suppress the errors would be to use the error suppression operator @. eg.

@$ansi->appendString($str);

Optimal Solution (Possibly)

There have been two commits to phpseclib since the latest release (1.0.7 and 2.0.6, as of this post) that fixed issues with File/ANSI.php:

https://github.com/phpseclib/phpseclib/commit/5c792f6bc1fa8a5d26b43fb8200191c073637e15 https://github.com/phpseclib/phpseclib/commit/84d1628cb7734134b1ba80545b38985025942b79

More info:

https://github.com/phpseclib/phpseclib/issues/1161 https://github.com/phpseclib/phpseclib/issues/1150

Kinda makes me wonder if one of those might fix the issue for you.

Fallback to Optimal Solution

If the previously mentioned "optimal solution" doesn't fix the issue for you then it would be nice to fix the problem at the source. What'd help me do that would be a copy of the data you got before you passed it to $ansi->appendString(). To make it so the characters don't get garbled because they're extended ASCII maybe hex encode it. eg. echo bin2hex($ssh->read()); or something.

Sign up to request clarification or add additional context in comments.

1 Comment

It sounds like this is a known issue that may be released in the next stable. I can wait for that and the @$ansi should be fine until then. unfortunately a lot of data is confidential and I can only post ambiguous or redacted sections otherwise I would give you the HEX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.