Page MenuHomePhorge

Fix InvalidArgumentException on commit hook
ClosedPublic

Authored by valerio.bozzolan on Apr 14 2023, 12:05.
Tags
None
Referenced Files
F3338914: D25122.1743611115.diff
Tue, Apr 1, 16:25
F3337088: D25122.1743582311.diff
Tue, Apr 1, 08:25
F3336359: D25122.1743572976.diff
Tue, Apr 1, 05:49
F3335728: D25122.1743566586.diff
Tue, Apr 1, 04:03
F3331723: D25122.1743511540.diff
Mon, Mar 31, 12:45
F3327513: D25122.1743440641.diff
Sun, Mar 30, 17:04
F3324494: D25122.1743401446.diff
Sun, Mar 30, 06:10
F3314661: D25122.1743232868.diff
Fri, Mar 28, 07:21

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 Passed
Unit
No Test Coverage
Build Status
Buildable 247
Build 247: 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