Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Fixes method gaff

AuthorDave Jarvis <email>
Date2026-02-14 15:54:24 GMT-0800
Commit6bf36c18b1e232e302d307aad9a5e313b58d90bb
Parent44da3fb
git/Git.php
}
- private function extractAuthorAndTime( string $data, string $pattern
- ): array {
+ private function extractAuthorAndTime( string $data, string $pattern ): array {
$matches = [];
$found = preg_match( $pattern, $data, $matches );
$author = $found ? trim( $matches[1] ) : '';
- $timestamp = $found && isset( $matches[3] )
- ? (int)$matches[3]
- : $found && isset( $matches[2] ? (int)$matches[2] : 0 );
+
+ // Clean up the logic to check indices safely
+ $timestamp = 0;
+
+ if( $found ) {
+ if( isset( $matches[3] ) ) {
+ $timestamp = (int)$matches[3];
+ } elseif( isset( $matches[2] ) ) {
+ $timestamp = (int)$matches[2];
+ }
+ }
return [ $author, $timestamp ];
Delta12 lines added, 5 lines removed, 7-line increase