[wp-hackers] Future Posting Fix Request

Andy Skelton skeltoac at gmail.com
Tue Jul 25 17:45:24 GMT 2006


When I wrote the Argyle pinging code that would eventually be pasted
into the cron code, it worked beautifully on every machine I tested. I
mean it was a thing of perfect beauty. Then it got committed to core
and hell broke loose for a small fraction of testers. I grabbed one of
the afflicted and got access to his server for experimentation. That
was several months ago now so the details are fading from memory but I
will try to illuminate this thread with what I can recall.

The exact issue is not that PHP as CGI cannot open the socket to the
local machine. The socket opens and the targeted script begins to run.
At some point during execution, a conspiracy of factors causes the
script to abort without any errors. Output was one factor I recall
finding; an echo or a print would halt the script. That was easily
fixed. The second factor was tougher. Opening another socket (e.g. a
pingback to another blog) was okay but a subsequent attempt to open a
socket would kill the script.

Let me repeat that for clarity: as the post was saved, Argyle opened
execute-pings.php, and execute-pings would have to fsockopen once for
every ping. Only the first ping would be sent because the second
fsockopen would kill the script. If any errors were logged, I could
not find them. I was only given FTP access.

My solution was to check the SAPI and use the old iframe trick if it
was CGI. This worked well on the problem host except when an admin
page view did not immediately follow the publishing action, i.e.
bookmarklet and xmlrpc posting.

This should be tested again by someone who can reproduce the problem.
The code is now very different from what I remember writing.

Andy


More information about the wp-hackers mailing list