Page MenuHomePhorge

Fix InvalidArgumentException on commit hook
ClosedPublic

Authored by valerio.bozzolan on Apr 14 2023, 12:05.
Tags
None
Referenced Files
F4117509: D25122.1746993980.diff
Sat, May 10, 20:06
F4069236: D25122.1746831740.diff
Thu, May 8, 23:02
F4049051: D25122.1746756041.diff
Thu, May 8, 02:00
F4045910: D25122.1746736848.diff
Wed, May 7, 20:40
F3969907: D25122.1746525021.diff
Mon, May 5, 09:50
F3945761: D25122.1746445433.diff
Sun, May 4, 11:43
F3930255: D25122.1746412308.diff
Sun, May 4, 02:31
F3883109: D25122.1746249525.diff
Fri, May 2, 05:18

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 248
Build 248: 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