Some modx weirdness, or maybe it’s my setup, but either way here it goes, maybe someone else knows what’s going on here....
I spent around 30mins wondering what the hell was wrong with this.
I was writing a snippet - I needed to upload a file, and read from the file. So I write the snippet, I get to the point where I use fopen() to open the file, and then read it line by line with fgets().
When I saved the snippet, and it contained the call to
I would get an error page in the snippet pane of the modx manager:
Forbidden
You don't have permission to access /manager/index.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
When I removed the fgets call, the error went away, and the snippet was would save with no problem. I really needed to implement this, so I played around a bit more. I tried to figure out exactly what was causing the problem, and I left out the semicolon, and the parentheses, and tried adding in some spaces and stoopid stuff like that.
In the end this worked:
What does it all mean? I’m guessing there is an bug in the modx snippet parser... Anyone care to reproduce? or maybe I have a botched install....
Modx 0.9.6.1p2
PHP 4.4.7 (shared host)
Subd