Running PHP index without a `.env` setup fails with an unclear error
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
Research direction
Start by running php index.php without a .env file to reproduce the failure. Read index.php and src/model/APNSCredentials.php, especially the constructor call and the reported strlen() error. Done means missing credentials produce a clear message about the missing .env and how to set it up instead of the current TypeError.
Written by the indexing model from the issue text.
Description
Hey @jkmassel, as you know, I'm a PHP noob. So feel free to close this issue if what I'm saying doesn't make sense.
I'm tracking this as an issue rather than a Slack convo because it feels tidier. Also, it might be a chance for me to link a PR to this issue to practice fixing.
After cloning the repo and running Composer, I tried to run php index.php knowing that I had no credentials setup to see the kind of error I'd get. This is what happened
➜ php index.php
=== Push Notification Server ===
PHP Fatal error: Uncaught TypeError: strlen() expects parameter 1 to be string, bool given in /Users/gio/Developer/a8c/php-push/src/model/APNSCredentials.php:12
Stack trace:
#0 /Users/gio/Developer/a8c/php-push/index.php(7): APNSCredentials->__construct(false, false, false)
#1 {main}
thrown in /Users/gio/Developer/a8c/php-push/src/model/APNSCredentials.php on line 12
Fatal error: Uncaught TypeError: strlen() expects parameter 1 to be string, bool given in /Users/gio/Developer/a8c/php-push/src/model/APNSCredentials.php:12
Stack trace:
#0 /Users/gio/Developer/a8c/php-push/index.php(7): APNSCredentials->__construct(false, false, false)
#1 {main}
thrown in /Users/gio/Developer/a8c/php-push/src/model/APNSCredentials.php on line 12
What I would have expected was a message about the missing .env with info on how to set it up.
Granted, for the context of this application, handling as one-off basic task like setting app .env might be overkill. Still worth tracking, though, I think.
- Dominant language
- PHP
- Stars
- 5
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/php-push
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Automattic/php-push#31 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Automattic/php-push#6 · 4 comments ·
All issues in Automattic/php-push
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·