|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-09-11 12:29 UTC] michael@php.net
[2015-09-11 12:33 UTC] michael@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: michael
[2015-09-11 12:33 UTC] michael@php.net
[2021-04-06 10:19 UTC] git@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
Description: ------------ Trying to parse result from mulriline response. Php tring to allocate icredible memory size PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 18446744073709531321 bytes) in ... on line 38 Test script: --------------- ini_set ("expect.timeout", 10); ini_set ("expect.loguser", "Off"); $stream = expect_popen("ssh user@host"); while (true) { switch (expect_expectl ($stream, array ( array ("password:", PASSWORD), // SSH is asking for password array ("yes/no)?", YESNO), // SSH is asking whether to store the host entry array ("~$ ", SHELL, EXP_EXACT), // We've got the shell! ))) { case PASSWORD: fwrite ($stream, "pwd\n"); break; case YESNO: fwrite ($stream, "yes\n"); break; case SHELL: fwrite ($stream, "uname -a\n"); while (true) { switch (expect_expectl ($stream, array ( array ("~$ ", SHELL, EXP_EXACT), // We've got the shell! array ("^.*[^~]$", UNAME, EXP_REGEXP), // uname -a output ), $match)) { case UNAME: $uname = $match; break; case SHELL: // Run update: var_dump($uname); fwrite ($stream, "ls -la\n"); while (true) { switch (expect_expectl ($stream, array ( array ("~$ ", SHELL, EXP_EXACT), // We've got the shell! array ("[^~]*~$", UNAME, EXP_REGEXP), // uname -a output ), $match1)) { case UNAME: $uname = $match1; break; case SHELL: // Run update: var_dump($uname); fwrite ($stream, "exit\n"); break 3; case EXP_TIMEOUT: case EXP_EOF: var_dump($uname); break 3; default: die ("Error has occurred!\n"); } } break 2; case EXP_TIMEOUT: case EXP_EOF: break 2; default: die ("Error has occurred!\n"); } } break 2; case EXP_TIMEOUT: case EXP_EOF: break 2; default: die ("Error has occurred!\n"); } } fclose ($stream); Expected result: ---------------- Not leaking memory