| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Comments:
<0> is there any way to check that data has been sent to the browser, not including headers, without starting a buffer? <1> at what other point in history have you been able to express _completely_ the wrong emotion at the slip of a finger?! <2> argh, why does file_exists($filename) where file name is Something 'Jojgoj.extension fail? <3> dools: Not many ppl on here are carving Kanji, not much is needs to remember =) <2> It works with special character free filenames <1> Bungopolis: what data do you mean? <0> dools page content <3> duanear try specifying the FULL path maybe? <1> duanear: use pastebin.com to put an example up... and what do you mean by fail? what error do you gt? <1> Bungopolis: what type of page content? <0> dools if it's html the first part of the content would be <html> <2> Jymm: I ddo use fullpath. The example was just to illustrate <2> By fail I mean it returns false even though the file does exist. <3> duanear: And we are mind readers? <0> dools web server sends the headers, then the "content". there's a headers_sent() function, of course, but I wonder if there's a way to check if any content has been sent by the current page
<0> is there a default buffer I can loo at? <0> *look <2> This works: ls /path/"filename" <4> I'm planning on building a script to troubleshoot network problems, can someone give me some ideas on how to implement this? I'm gonna have a series of yes or no questions and after each question i want the script to spit out a sentence on the page depending on the answer. <2> but file_exists($path.'/'.$filename) returns false <2> :( <1> Bungopolis: what type of request? POST? GET? <0> dools I'm talking about data the server is sending, not the browser <0> I want to check if something prior to the check has sent some content <1> Bungopolis: what is the error you are getting? <2> I am so stumped. <0> dools I am not getting an error <2> Should I be escaping something? <1> Bungopolis: okay, what is it you are trying to achieve (i mean apart from finding out if content has been sent) <1> duanear: put a test case in pastebin <0> nothing in particular <1> Bungopolis: well then you're fine!! <0> echo "something"; if ( content_has_been_sent() ) // true <1> sounds like homework to me ... <0> <?php if ( content_has_been_sent() ) // false ?> <0> no it's not "homework" <0> i just dont see the point in explaining what I want to do <0> ob_start(); echo "something"; iif (ob_get_content != '') // true <0> thats basically what I want to do, but I dont want to have to start a buffer first <1> Bungopolis: because there clearly is not a content_has_been_sent function, so if you give me an idea of what you are trying to achive then it better enables me to lend a helping hand <0> I'm presuming its impossible, I'm wondering if you know something different <2> dools: http://pastebin.com/645608 <0> alright I have a cl*** which generates javascript that uses xml http request. I want the same cl*** to transparantly act as the processor for the xml http request, but if the user of the cl*** has already sent some content, the xml sent back by the processor is obviously going to be invalid <0> so I want to check that the user is not sending content first, if they have I can throw an error about it <0> does that make sense <0> by "user" i meant user of the cl*** <0> not the end-user <0> I can use headers_sent, because in most cases headers_sent == true means that content has been sent, since most of the time we dont need to send headers explicitally <0> but in theory the user could be sending a header and still want to have the cl*** acting as the xml http request processor <0> so that's not a good enough proxy <0> but if you're right, dools, that there is absolutely no way to check that content has been sent to the browser without starting an output buffer first, then I dont need any further help <1> Bungopolis: i presume that you only are averse to starting an output buffer at the very beginning of your script? ie. if you had a solution using ob_start local to the function that response to the xml http request that would be okay? <5> what's the best way to convert serialized byte array to a string? <0> dools I am averse to it because tihs is a cl*** I am releasing publically and that's an unintuitive for a user of the cl*** to do <0> and anyway, if I am able to tell the user they need to start an ouptut buffer for me, i might as well just tell them to make sure the cl*** processes xml http request at the beginning of the script <1> Bungopolis: ob_start() can be used inside another ob_start(), so what i'm saying is that if ob_start(); ob_get_content(); ob_end_clean(); were used entirely locally within that cl*** it would present no problems in terms of the interfae <1> interface <0> dools thats not the question, the question is has the user ALREADY sent some content, becuase if they have the cl*** CANNOT send the xml http request response <0> it has to be the only data that is sent <1> Bungopolis: now this is a pretty big hack, but if you call session_start() and content output has already begun then you get a notice, so if you, locally, call ob_start(); session_start(); $result = ob_get_contents(); ob_end_clean(); then parse $result, you will see a notice that session_start() could not send the sesssion cache limiter because output has already begun <6> i have 4.4.2 set up to run as CGI via .htaccess. unfortunately it seems that the server will only start one php.cgi process at a time. if another request comes in, it blocks. <0> ah I see <1> Bungopolis: or perhaps session_cache_limiter() is better <0> that's interesting <6> any way to add more concurrency? <1> Bungopolis: play around with it, but i think session_cache_limiter() will cause the notice as well <0> so at least internally php does actually keep track of whether content has been sent <1> Bungopolis: it realise on the user having E_NOTICE in their error_reporting though <0> yeah <1> Bungopolis: yeah, i'd put in a feature request if you get it working <0> cool, thanks a lot I'll play around with that <1> Bungopolis: np <2> Nevermind, magic quotes was on <1> man!! where is aidan when you want to rub his nose in it?? <1> duanear: there's your first mistake :-P <2> I've never had it on... always used php.ini-recommended
<2> but i installed through debian this time <2> and its default php.ini had it on <1> duanear: there's your second mistake!! <2> ? <1> i'm a freebsd ports diehard, but i always install php manually <2> when i need turckmmcache i do it manually <2> but debian is so nice <2> :P <6> i guess my problem is actually with apache, i'll try there <0> dools another solution might be to try something like header('') because header will also fail if content has been sent <1> Bungopolis: ahh, yeah, there you go <0> but I dont know what the implication of sending an empty header is <1> Bungopolis: if it fails, surely nothing has been sent <0> right <7> what's wrong with headers_sent() ? <7> oh, didn't scroll up <1> GarethAdams: he's checking for post headers content <0> garethadams becuase I believe headers_sent() only tells you if a single header has been sent, and in my case I have nothing against a user sending headers, only to them sending content after the headers are sent <7> Bungopolis: no headers are sent until content starts. When any content is sent then all queued headers are sent together <0> garethadams are you positive? (i'm not questioning, just confirming) <7> not 100% <0> ok, well I'll test it <7> that's what I always ***umed <0> I think you might be right <0> I cant really remember why I thought I couldnt use headers_sent before <7> headers_sent in the manual says "You can't add any more header lines using the header() function once the header block has already been sent." <0> and the only way to send headers is to send some content, right? <0> or to exit() <0> presumably <7> and the header() function in the manual says "The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type." <7> indicating that they aren't send immediately <7> also "Note: The HTTP status header line will always be the first sent to the client, regardless of the actual header() call being the first or not." <0> right <0> it seems like headers_sent isnt very reliable, i'm running on windows right now and header('Content-type: text/plain'); echo 'test'; if (headers_sent()) echo 'YES'; else echo 'NO'; outputs testNO (indicating it thinks headers have not been sent) <1> Bungopolis: does a call to header() fail? <8> (isset($task) ? @$task : null) <-- what the sign '@' means in this case? <1> !+@ <8> ? <1> !tell xmlaxis about @ <3> !+@ <9> [@] The PHP error control operator that suppresses errors (@foo()), see: http://php.net/operators.errorcontrol - Don't use it. Think I'm wrong? Ask me about "GO". <1> ahh, i see <1> you'll have to make me an op then Jymmm :-) <10> does anyone know if there are any cl***es available for PHP5 that will allow you to do remoting similar to .NET remoting? <8> thanks <1> Psykick: what type of remoting? <0> dools header() is actually a void function so it's always false, I just realized <0> so that wouldnt have been a useful test anywya <1> Bungopolis: d'oh!! what about session_cache_limiter()? <0> havent tried that yet, still trying to figure out what the hell is going on with headers_sent() <11> $get_something = $_GET['p_time']; can I initiate that at the beginning of the cl***? <1> Frosh: do it in the constructor <11> ok <1> Frosh: you don't have to, but it's good practice <11> put it before the constructor? <11> or put it in the constructor? <1> in <1> Frosh: i always initialise all variables in the constructor <1> Frosh: member variables i should say <0> dools: why? <1> Bungopolis: makes more sense when you think about extending the cl***. only member vars i would initialise outside of the constructor are static members <11> question, maybe I'm doing it wrong <11> $_GET[]; <1> Frosh: what is that? <11> if I call that and there is no $_GET <11> I get error right <11> no $_get variable <1> Frosh: the only time there is no $_GET is when the script is called from the command line <0> dools but those members vars could still be replaced in a cl*** extension <1> Frosh: in which case count($argv) will return true <1> Bungopolis: that's the idea <11> index.php?id=3 and index.php <11> in the second one $_get would echo error about missing $get <1> Bungopolis: hold on... no, that's not the idea!!
Return to
#php or Go to some related
logs:
posh-lia movie modify routing table gentoo proftpd ubuntu connection refused gaim plugin autoreply y2mpsh mlingojones proxy #css alter all tables mysql
#debian quicktables for slackware
|
|