Submitting new notes
Closed this issue · 4 comments
Why does the code send a POST request to https://main.php.net
when submitting a note? How can I locally submit a note? This repo doesn't contain that file from what I can see, and yet the notes are read using a simple function in this repo. How does this work?
Line 97 in 16f4045
The repo for main.php.net is php/web-master, and it contains https://github.com/php/web-master/blob/main/public/entry/user-note.php. user-note.php stores the submitted user note in the database, and this repo reads the user notes from there (or maybe there is an intermediate step).
To fake this for testing purposes, you would need a working setup of web-master locally, and then to fiddle with your etc/host file. The latter could be simplified by allowing to configure the URL.
This made me sad to learn there is yet another repo. I don't know which codebase is worse. I want to improve things but I am starting to feel a little overwhelmed.
Is there any good reason why we have two separate servers? Why isn't it all in a single repo on a single server? Was it due to the historical mirroring? Would it ever be acceptable in the future to merge them together?
In the short term, if I took it up to modernize the codebase a little bit, would my efforts be appreciated? There are no unit tests in either repo, so potentially I could be introducing bugs, even if I am being extra careful. But waiting for the team to agree on using a unit testing tool and then writing test cases seems unattainable. I can try to write some tests while rewriting the code, but that is unlikely to catch all regressions.
Indeed, that might have historical reasons, since the php.net site was mirrored across the world, but there was only a single master.php.net (which is now main.php.net). It might be viable to merge the repos, but I guess mostly impractical currently.
If possible, I suggest to write PHPTs as tests. While the system is certainly not as sophisticated as PHPUnit or other frameworks, it might be okay-ish for now, and I cannot image that anybody would object to introduce a PHPT test suite.
PS: and frankly, the biggest hurdle for unit tests are certainly the missing seams in the existing code.
I figured out that there are already some notes committed in Git so I can use that for testing. I can also download more notes straight from php.net as the files aren't protected and are in the web root.