Branch: refs/heads/master
Home: https://github.com/phpmyadmin/scripts
Commit: 65052ac5b0157074413412fbaf46c024252adfb5
https://github.com/phpmyadmin/scripts/commit/65052ac5b0157074413412fbaf46c024252adfb5
Author: William Desportes <[email protected]>
Date: 2026-10-27 (Tue, 10 October 2026) +01:00

Changed paths: 
A hooks/lib/http.php
A hooks/tests/json_response.phpt
M hooks/commits.php
M hooks/docs.php
M hooks/lib/commits_handler.php
M hooks/lib/github.php
M hooks/lib/github_client.php
M hooks/lib/push_handler.php
M hooks/website.php

Log Message:
-----------
hooks: accept the stdClass push.php answers with, and answer 204 properly

push.php fails on every push since the responses were typed:

  json_response(): Argument #1 ($data) must be of type ?array, stdClass given

github_webhook_push() returns a stdClass, so the successful answer of the
push hook always threw. A push hook that always fails makes GitHub mark the
delivery as failed, and the mail is sent before the crash so the only visible
symptom is the 500 in the log.

json_response() takes array|stdClass|null now, which is what every caller
passes: arrays from the pull request hooks, the stdClass from the push hook,
null when there is only a message.

The response helpers move from lib/github.php, which requires the
configuration file, to lib/http.php, so the hooks and the tests can use them
without it, and every lib that calls fail() loads it itself instead of relying
on the file that happened to require it first.

The responses with no body now answer 204 instead of 200 with a PHP default
content type: the closed pull requests and the "too many commits" warning in
commits.php, and the two triggers in docs.php and website.php that answered
nothing at all. RFC 9110 section 8.3 only allows a Content-Type when the
message has content, so the 204 drops it, and drops X-Content-Type-Options
with it, which only tells a browser how to sniff content there is none of.

PHP adds its default Content-type after the script is done, so header_remove()
alone leaves it on the wire; default_mimetype has to be emptied as well. Both
were needed to get a headerless 204 out of php-cgi, which takes the same
header path as the php-fpm the hooks run under.

Co-authored-by: DeepSeek <[email protected]>
Signed-off-by: William Desportes <[email protected]>

_______________________________________________
Git mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to