Skip to content

Commit a73360c

Browse files
authored
get only last row
When JSignPdf havent config file, all executions of jar file return two rows with a warning. This will return every time the last row.
1 parent abd3a2e commit a73360c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Sign/JSignService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ public function getVersion(JSignParam $params)
6262

6363
$command = "$java -jar $jSignPdf --version 2>&1";
6464
\exec($command, $output);
65-
if (empty($output) || strpos($output[0], 'version') === false) {
65+
$lastRow = end($output);
66+
if (empty($output) || strpos($lastRow, 'version') === false) {
6667
return '';
6768
}
68-
return explode('version ', $output[0])[1];
69+
return explode('version ', $lastRow)[1];
6970
}
7071

7172
private function validation(JSignParam $params)

0 commit comments

Comments
 (0)