Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document accessing superglobals directly #90

Open
jasalt opened this issue Nov 7, 2024 · 0 comments
Open

Document accessing superglobals directly #90

jasalt opened this issue Nov 7, 2024 · 0 comments

Comments

@jasalt
Copy link
Contributor

jasalt commented Nov 7, 2024

Found a possible gap in the docs while figuring out how to connect to WordPress (MySQL) database from Phel which requires accessing the wpdb object via PHP superglobals.

I was looking for something equivalent to the PHP global statement first (generally recommended with wpdb), but the alternative method by accessing $GLOBALS superglobals array seemed more feasible.

Figured to access the $GLOBALS array then with (get php/$GLOBALS "wpdb") after reading Phel http library sources that I knew to be messing with the superglobals.

Docs didn't really give any good pointers about this so maybe it could be worth to mention something about it in eg. "Global and local bindings" or "PHP interop" or both as they'd seem the most logical places, if this would be considered a general enough issue? I'm not very familiar with the PHP ecosystem at large but find this somewhat frequent related to WP at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant