![]() |
register_shutdown_function() not behaving as expected
OK here's the code:
:
<?php |
Re: register_shutdown_function() not behaving as expected
Just use a real database. Your square wheel is a waste of time.
|
Re: register_shutdown_function() not behaving as expected
I'm curious: have you tested your diagnosis in alternate browsers?
Dameon, I'm of the notion that there's no such thing as a waste of time, if your time consists of doing something that interests and challenges you. I imagine it's the same idea for grimpirate. |
Re: register_shutdown_function() not behaving as expected
@Dameon: As a PF veteran I would hope that you could post something relevant to the thread and not just discourage others. I figure the intent of the forum is to help people, not discourage them from what they're attempting to do (however useless it may seem to you).
@Sane: Hmm... no I haven't Sane. I've only tested on Opera. I'll see what happens on Firefox and IE. |
Re: register_shutdown_function() not behaving as expected
Tried it on IE and Firefox and it produced the same results. I actually added a line to the code
:
<?php |
Re: register_shutdown_function() not behaving as expected
I'm having permissions trouble with the server space I haven't yet been able to run PHP scripts on. I'll get back to you when I resolve that.
I don't know much about what you're trying to accomplish. I'm not sure if many do. But are you sure it's something standard? Seems unlikely that a user abort could trigger a function consistently. I'm also wondering... maybe it only knows that the user aborted when it attempts to send a packet of data to the client, and sees that it's disconnected. When you've got the client hanging on a 30 second timeout, there's no data being transferred, right? So how would it know that the user clicked stop, unless there's some hidden communication going on? Maybe you could try outputting an infinite loop of numbers or something, and set a max running time on the script. Replace this with your sleep timeout. |
Re: register_shutdown_function() not behaving as expected
Attempted the following and it appears to have worked.
:
<?php |
Re: register_shutdown_function() not behaving as expected
Well I couldn't output the connection_status() result to a file, buuuuuut I modded the code to
:
<?php |
Re: register_shutdown_function() not behaving as expected
Since you were curious what I was trying to accomplish Sane here it is:
:
<?php |
Re: register_shutdown_function() not behaving as expected
Ah, yes. So it only checked for disconnection after it was done sleeping. So I was close. :)
Very interesting. You should post this on a PHP guru website and see what they have to say about it. I'm sure you could get lots of great contributions, and people trying to bust holes in your algorithm. What happens when multiple scripts try to request a lock for the same file at the same time? |
| All times are GMT -5. The time now is 3:27 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC