@@ -122,26 +122,33 @@ class Config implements ConfigInterface
122122
123123 public const SSH_PRIVATE_KEY = '~/.ssh/id_rsa ' ;
124124
125+ /**
126+ * By default throw exception on stream timeout
127+ * Set to false to disable timeout exception (useful for PHP 8.4 compatibility issues)
128+ */
129+ public const THROW_TIMEOUT_EXCEPTION = true ;
130+
125131 /**
126132 * List of allowed parameters of config
127133 */
128134 public const ALLOWED = [
129- 'host ' => 'string ' , // Address of Mikrotik RouterOS
130- 'user ' => 'string ' , // Username
131- 'pass ' => 'string ' , // Password
132- 'port ' => 'integer ' , // RouterOS API port number for access (if not set use default or default with SSL if SSL enabled)
133- 'ssl ' => 'boolean ' , // Enable ssl support (if port is not set this parameter must change default port to ssl port)
134- 'ssl_options ' => 'array ' , // List of SSL options, eg.
135- 'legacy ' => 'boolean ' , // Support of legacy login scheme (true - pre 6.43, false - post 6.43)
136- 'timeout ' => 'integer ' , // Max timeout for instantiating connection with RouterOS
137- 'socket_timeout ' => 'integer ' , // Max timeout for read from RouterOS
138- 'socket_blocking ' => 'boolean ' , // Set blocking mode on a socket stream
139- 'socket_options ' => 'array ' , // List of socket context options
140- 'attempts ' => 'integer ' , // Count of attempts to establish TCP session
141- 'delay ' => 'integer ' , // Delay between attempts in seconds
142- 'ssh_port ' => 'integer ' , // Number of SSH port
143- 'ssh_timeout ' => 'integer ' , // Max timeout for read from RouterOS via SSH proto (for "/export" command)
144- 'ssh_private_key ' => 'string ' , // Max timeout for read from RouterOS via SSH proto (for "/export" command)
135+ 'host ' => 'string ' , // Address of Mikrotik RouterOS
136+ 'user ' => 'string ' , // Username
137+ 'pass ' => 'string ' , // Password
138+ 'port ' => 'integer ' , // RouterOS API port number for access (if not set use default or default with SSL if SSL enabled)
139+ 'ssl ' => 'boolean ' , // Enable ssl support (if port is not set this parameter must change default port to ssl port)
140+ 'ssl_options ' => 'array ' , // List of SSL options, eg.
141+ 'legacy ' => 'boolean ' , // Support of legacy login scheme (true - pre 6.43, false - post 6.43)
142+ 'timeout ' => 'integer ' , // Max timeout for instantiating connection with RouterOS
143+ 'socket_timeout ' => 'integer ' , // Max timeout for read from RouterOS
144+ 'socket_blocking ' => 'boolean ' , // Set blocking mode on a socket stream
145+ 'socket_options ' => 'array ' , // List of socket context options
146+ 'attempts ' => 'integer ' , // Count of attempts to establish TCP session
147+ 'delay ' => 'integer ' , // Delay between attempts in seconds
148+ 'ssh_port ' => 'integer ' , // Number of SSH port
149+ 'ssh_timeout ' => 'integer ' , // Max timeout for read from RouterOS via SSH proto (for "/export" command)
150+ 'ssh_private_key ' => 'string ' , // Full path to required private key
151+ 'throw_timeout_exception ' => 'boolean ' , // Throw exception on stream timeout (set false to disable for PHP 8.4 issues)
145152 ];
146153
147154 /**
@@ -150,18 +157,19 @@ class Config implements ConfigInterface
150157 * @var array
151158 */
152159 private $ _parameters = [
153- 'legacy ' => self ::LEGACY ,
154- 'ssl ' => self ::SSL ,
155- 'ssl_options ' => self ::SSL_OPTIONS ,
156- 'timeout ' => self ::TIMEOUT ,
157- 'socket_timeout ' => self ::SOCKET_TIMEOUT ,
158- 'socket_blocking ' => self ::SOCKET_BLOCKING ,
159- 'socket_options ' => self ::SOCKET_OPTIONS ,
160- 'attempts ' => self ::ATTEMPTS ,
161- 'delay ' => self ::ATTEMPTS_DELAY ,
162- 'ssh_port ' => self ::SSH_PORT ,
163- 'ssh_timeout ' => self ::SSH_TIMEOUT ,
164- 'ssh_private_key ' => self ::SSH_PRIVATE_KEY ,
160+ 'legacy ' => self ::LEGACY ,
161+ 'ssl ' => self ::SSL ,
162+ 'ssl_options ' => self ::SSL_OPTIONS ,
163+ 'timeout ' => self ::TIMEOUT ,
164+ 'socket_timeout ' => self ::SOCKET_TIMEOUT ,
165+ 'socket_blocking ' => self ::SOCKET_BLOCKING ,
166+ 'socket_options ' => self ::SOCKET_OPTIONS ,
167+ 'attempts ' => self ::ATTEMPTS ,
168+ 'delay ' => self ::ATTEMPTS_DELAY ,
169+ 'ssh_port ' => self ::SSH_PORT ,
170+ 'ssh_timeout ' => self ::SSH_TIMEOUT ,
171+ 'ssh_private_key ' => self ::SSH_PRIVATE_KEY ,
172+ 'throw_timeout_exception ' => self ::THROW_TIMEOUT_EXCEPTION ,
165173 ];
166174
167175 /**
0 commit comments