Page MenuHomePhorge

Fix InvalidArgumentException on commit hook
ClosedPublic

Authored by valerio.bozzolan on Apr 14 2023, 12:05.
Tags
None
Referenced Files
F3738923: D25122.1745761424.diff
Sat, Apr 26, 13:43
F3619223: D25122.1745308420.diff
Mon, Apr 21, 07:53
F3581808: D25122.1745109776.diff
Sat, Apr 19, 00:42
F3553190: D25122.1744923118.diff
Wed, Apr 16, 20:51
F3425866: D25122.1744647974.diff
Sun, Apr 13, 16:26
F3417607: D25122.1744614768.diff
Sun, Apr 13, 07:12
F3403108: D25122.1744571580.diff
Sat, Apr 12, 19:13
F3400558: D25122.1744557128.diff
Sat, Apr 12, 15:12

Details

Summary

Fix a regression introduced here:

96ae4ba13acbf0e2f8932e950a92af0495f034d7

I reproduced this exception executing "svn commit" on a hosted repository.

That crash happened because the PHP getenv() function can return false.
But, that is a very terrible value that blasts the non-string-empty check.

So, now the default getenv() value is skipped, without causing problems.

Closes T15253
Ref T15190

Test Plan
  • I've run svn commit and I have not encountered any issue now

Diff Detail

Repository
rP Phorge
Branch
fix-git-commit-hook
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningscripts/repository/commit_hook.php:196TXT3Line Too Long
Unit
No Test Coverage
Build Status
Buildable 246
Build 246: arc lint + arc unit

Event Timeline

  • fix damn linter putting every line under 80 chars

Removed some whitespaces unremoved by lint autofixer

scripts/repository/commit_hook.php
121

https://www.php.net/manual/en/function.getenv.php

«returns ... false if the environment variable varname does not exist»

This revision is now accepted and ready to land.Apr 14 2023, 17:06