« first day (781 days earlier)      last day (4185 days later) » 

12:00 PM
@NikiC is evidence that the Germans are beginning to understand the concept of the joke. I'm sure one day they will even be funny... :-P
This job is properly beginning to f*ck me off actually, I'm seriously considering packing it in and just getting a job as a junior dev for a while.
 
@DaveRandom morning
 
Oct 2 at 19:56, by DaveRandom
Right, that's it, no more SO chat for me until I get the terrible jokes out of my system. I'm going to irritate my GF
 
:-P
@PeeHaa monring
 
And....
Oct 2 at 20:17, by DaveRandom
Right I'm back. I think I can be sensible and play nicely and not make any more terrible jokes after my time on the naughty step.
:D
 
@cyril I will create a git repo of it when I have finished my RTP implementation. It's currently modelled around "make it work with Polycom", which is in itself a sucky implementation. Will ping you when this happens, but don't hold your breath, I have a lot on at the moment. Also in general a SIP proxy is not that useful, a proper signalling server is what it should be.
 
12:07 PM
@DaveRandom But, seriously, are you doing this stuff as part of your job or is it "just for fun"?
 
@NikiC For "fun", with an ulterior motive of trying to one day show the world why Asterisk sucks. Forget about the underlying implementations, Asterisk is designed primarily by computer programmers, not telecommunications engineers and a lot of it is fundamentally wrong. But no-one will listen until something is doing it right. Also SIP sucks balls, but it is easier to implement than the better alternatives which I why I started with it - and why the VoIP world largely runs on it.
Multi-channel voice should not be done by segregating channels, neither should it be done by segregating signals. IAX came so close and yet fell at the last hurdle.
 
user1125394
do some performance benchmark, publish it!
 
Oh and also G.729 is a stupid thing to prefer. Just because you have to pay to license it does not make it good. It works well for mobile phone networks, it sucks for VoIP, especially in places where bandwidth is not the primary concern.
 
@DaveRandom I absolutely have no idea what you're talking about ^^
 
user1125394
yea not php related, (though interesting me for a possible job)
 
12:22 PM
@cyril Reliability is in many ways more important than performance. Where you care about performance, probably SIP is not the most ridiculous thing to use because it is relatively quiet compared to H.323 and friends. But where reliability is concerned, well... have you ever used a system that uses SIP as it's primary protocol that didn't do something unexpected at least once every couple of days?
 
@DaveRandom aren't communications systems mostly done on functional platforms
apparently if you want reliability, erlang is the way to go
 
user1125394
@DaveRandom yes SIP for the session establishment must be as reliable as http, but I was thinking you had better RTP performances, where it's not reliability that matters but perf, since human ears can handle small errors
 
What is needed is something more like the ETSI ISDN standard, although a direct literal port would make no sense because it would be insanely inefficient. But the idea of multiplexing signalling and data for multiple channels into a single stream for IX trunks is a good way to do it.
@cyril I have not touched RTP properly yet, media processing is difficult and resource hungry. Like I say I modelled it after an older Polycom implementation, mostly because that's what I had to hand at the time. It sucks. Wherever possible, just relay the SDP and let the endpoints negotiate the RTP between themselves.
 
user1125394
ok, and I never dealt with all that yet
 
wait wait, in communications, do you have multiple sockets receiving chunks of the same stream of data in parallel, and you have to mesh it together, but make sure they are in the right order?
 
12:31 PM
@all Hi
 
@cyril It all ties in to what I was saying the other day about how in theory (assuming L2-4 is properly set up) STUN and friends are unnecessary in the context of VoIP, because media streams are connection-free. If the endpoints are able to determine their local "public" port (after NAT) from the gateway, perfectly possible using uPnP, they can just advertise it in SDP and both start the stream at the same time.
IP addresses then become irrelevant, you just return data to the source IP. At worst the proxy determines it.
 
user1125394
but I have read that not all NATs support uPnP and SIP/SDP
 
@andho In essence, yes. That's kind of in the nature of IP as well. TCP provides this nice comfy abstraction that gives you "reliability", but really the underlying mechanisms are just a series of frames carrying data that may or may not arrive in the right order. It is the responsibility of intermediate switching systems to try and maintain integrity, and the responsibility of the endpoints to ensure that the data makes sense at the other end.
@cyril Indeed. "assuming L2-4 is properly set up". I am fully aware that in practical terms, for the average endpoint, that model just doesn't work. But in theory, and indeed with not a huge amount of effort, it can, and doing it that way makes everything a lot simpler and more reliable.
 
@all Can anyone please guide me how to use paypal service to my website?
 
@andho If you take that to it's natural conclusion, ICMP is closer to "traditional" digital telephony mechanisms than any implementation in common usage. However, acting on that conclusion would be an idiotic thing to do, because the internet is not a private circuit like a traditional telephone line.
@AnoopKumar Get a paypal account, RTFM. Do you have a specific problem? Paypal provide many, many examples and a lot of very good quality support.
Oh and </rant>
 
12:47 PM
Hi @andho
 
@DaveRandom now it's going over my head
@pardhu hello
 
i installed zend frame work
in that
the first page is index page, if session will not set the page will redirect to login page
how can i write?
 
@andho It's all good. I just read some of that back and realised that I know way too much about some of this stuff, way more than I have ever needed to. I complain regularly that programmers know too little about networking, and I stand by that, but expecting the average programmer to understand telephony is unreasonable and unnecessary. I come from a telecom background, sometimes it leaks a bit.
 
@andho
 
@pardhu do the quick start guide, do another tutorial and you'll be good to go
@DaveRandom i agree, i know too little about networking
the only way of really learning is doing
 
12:55 PM
i want know, if there is function like if(empty())
@andho thats y i am asking
 
@pardhu empty() is a PHP function. You are still using PHP, just using it with a framework.
@pardhu if you did not do the quickstart guide or any tutorial about any framework/library/toolkit, please don't ask coding questions about said framework/library/toolkit. It's rude!
 
ty :)
 
@andho Cough language construct cough
 
@DaveRandom ahem
 
@DaveRandom Just wanted to say ^^
 
1:18 PM
me too, me too
 
@DaveRandom Sorry for this silly question. What does the sandbox mean? What is its role in getting paypal service? Becuase I was suddenly given a task to use alternative for paypal. I can't get my head around it. link
Shopping Cart Kits currently available with PayU are:
• Interspire
• Opencart
• Jhoomla Virtue Mart
• Magento
• Prestashop
• Tomatocart
• Zencart
 
@AnoopKumar Sandbox is where you can test your implementation without any money changing hands. Basically it's should behave exactly like the real API, except no actual banking transactions will happen.
 
1:30 PM
morning
 
Morning @MikeB
 
@NikiC I notice you have made empty() work with expressions, I guess the reason that isset() was ignored is because it makes no sense and you might as well just do === NULL? Also, (in a convoluted way) following on from that, are there any plans to either make debug_zval_dump() usable or remove it? At the moment it is useless because it is impossible to get a refcount other than 1 because of call-time pass by reference. I may have asked you that before, apologies if so.
 
morning ....
 
@NullPointer Hi
 
@MikeB , @Jeremy1026 morning .....@Donut hellow
 
1:45 PM
Does/has anyone use(d) Safari Books Online before? Any thoughts or impressions to share on it?
 
@DaveRandom Okay. Then what are these shooping Cart Kits? Are these like sandbox?
 
Setting up a wordpress database (first time)... Just double-checking whether only I can use the database, ie other users have no access to it at all.
 
@AnoopKumar No they are frameworks for implementing shopping carts - a persistent list of items on your web site that the user has chosen. Like when you choose a few items on a website and then are able to "checkout" and it remembers what you have chosen. I guess the reason they are listed is because they already have a payment implementation for that service - I don't really know anything about any of them, the one time I have ever had to do something like that I built that functionality myself.
 
*please substitute 'can' for 'should'
 
Is there anything better in native MySQL prepared statements than emulated ones? Not talking about PDO, but general.
 
1:53 PM
@DeanKayton Probably a good idea, depends what you are doing but it's unlikely you'd want any other users to be able to access it. However: obviously wordpress itself will need to be able to access it, and I know nothing about WP, that's just a general statement.
 
@DaveRandom Thanks! Makes sense to me. So there's no use in making it readable to other users?
@DaveRandom I know I'm being really vague, especially since you do not have experience in the WP application. Sorry
 
@Donut Yes. Real prepared statements send the bound arguments as separate data fields, so there is zero risk of injection because the data is not part of the parsed statement. Emulated prepared statements just provide a query builder that has an interface like a prepared statement. It still uses mysql_real_escape_string() and it is still subject to the same edge case injection scenarios that string concatenation is subject to. Because it is just string concatenation underneath.
 
@DaveRandom Got it, thanks mate.
 
@DeanKayton General security principle: start with no-one having any permissions and allocate them as needed, rather than the other way around.
 
@DaveRandom Great advice, that's a big help. That's what I would have applied but my university has a more global way of controlling access. They have regulations where the first letter of the database name must be a 'P' if it's readable to others and 'X' if not (plus other letters for in between options). If I'm wrong I can always just make a new database later with the correct naming format
 
2:09 PM
@DeanKayton Yeh it definitely sounds like you want it to be private. Consider this: if your database is world-readable, any passwords or other potentially sensitive information are world readable.
 
@DaveRandom I must be half asleep. If I thought hard enough I would have realised that! I am new to MySQL databases. Thanks so much for your help. Have a good day
 
@Donut Also there is a crucial PDO-specific difference that can catch you out - if you have been using emulated prepares, it will allow you to use the same named placeholder more than once (So you can do UPDATE sometable SET col1 = :myvalue WHERE col2 = :myvalue for example). When you switch to proper prepared statements, this is no longer allowed - you have to do UPDATE sometable SET col1 = :myvalue1 WHERE col2 = :myvalue2. Obviously if you use question marks this is not an issue.
@DeanKayton No worries :-)
 
@MikeB Lol that question looks like the guy had stroke while writing it
 
I somehow don't have access to the Privileges section in phpMyAdmin 3.3.2. There is already a user account created by my university. Can anyone think of a way for me to link this default user to the database I created?

P.S. I am logged into the default user account
 
2:21 PM
@DeanKayton Under which user did you create the database? The default one? Are you sure it doesn't already have permissions on it? It's unlikely the user you have been given has GRANT permissions (if they know what they are doing)
 
@DaveRandom I created it under the default one, the naming regulation makes sense now I think...
 
@DeanKayton While logged into PMA as this default, are you able to see the database you created in the left pane?
 
@DaveRandom Yes
@ok so that means I, as the user have access to it... think I need another cup of coffee, these things I am asking seem so obvious now
 
@DeanKayton Then you probably already have the necessary permissions. Just go and try and create a table in it, if it will let you do that then I would be surprised if you don't have every permission that WP will require (probably just CREATE SELECT INSERT and UPDATE, possibly DELETE, I would imagine)
 
@DaveRandom What confused me, is when I click home, then processes... it lists my ID user host database, etc... under database it has the value 'none'
 
2:30 PM
@DaveRandom Thank you so much dear for your time and info you provided. cya later.
 
@DeanKayton The thing about University systems is that while they do lock you down to the max, they also usually try and make them as automated and idiot-proof as possible. I would expect everything to just work if you point WP at the database - of course, this won't stop WP from being sh*t but hey :-P
@DeanKayton I'm not totally sure what PMA displays there (I don't really use it if it can be avoided) but at a guess that's because you don't have a DB selected and you are just viewing server-level stats.
@AnoopKumar No problem.
(lol @ "dear")
 
what happens if you call_user_func_array with no parameter array passed through?
 
@DaveRandom Haha, so I'm going to guess everything is alright! WP is brilliant for noobs. I do think that people should progress from it though
 
@dyelawn The function definition expects two arguments: php -r 'var_dump(call_user_func_array("time", array()));' // 1354718088
 
@dyelawn You get a warning, and the function will be called with no arguments. Why would you do that though?
 
2:36 PM
@daveRandom laziness.
 
@DeanKayton Just be careful with it. WP is so far removed from PHP. Definitely E_TOO_MUCH_MAGIC in my book.
 
setting up an argument map to get properties by method names and add them as parameters, but some methods take no arguments
 
@dyelawn So just pass an empty array and avoid the warning. Also sounds like you might be suffering from E_TOO_MUCH_MAGIC as well.
 
@DaveRandom I've actually just set up a society 'Durham University Design Society'. Just want a basic webpage to save the spot. Once we get enough people with a background in web design I will let them sort it out. My design interests are in structural engineering so this is all a foreign challenge for me! Think I'll be fine from now on! Good day :)
 
i don't know what too much magic is.
 
2:41 PM
@DeanKayton Yeh For non-developers WP is good I guess, for exactly the reasons I don't like it :-D have fun...
@dyelawn As in, "too dynamic". Making code short at the cost of readability is not usually a good thing.
 
A lot of people hate on Wordpress, Drupal, Joomla, and a bunch of other popular php projects because they've become successful despite their code
Some of the biggest sites in the world were running wordpress that contained code like: foreach ($piss as $tinkle)
 
@DaveRandom all models and methods are pre-defined, so they're readable
*classes
 
@MikeB I hate it because it's a black box. wp_some_ugly_function_name_that_does_god_knows_what_and_takes_no_arguments()
 
I hope I have not sparked a debate... whatever is said here, OPINIONS ARE NOT GOING TO BE ALTERED, so let's just agree to disagree :)
 
@DeanKayton I don't mean to start one either - it's just something I wish was mentioned to me earlier. "Understand that this product is used everywhere (even the whitehouse) but the horrors you see under the hood shall never be repeated"
Code Quality and project success aren't necessarily closely tied it seems.. which is tough to accept
 
2:54 PM
@DeanKayton Don't worry about it, it's a never ending debate. By the way, if you are venturing into WP, you'll probably find wordpress.stackexchange.com useful - if you post WP-specific questions on SO and tag them PHP you'll get a lot of unconstructive "don't use WP" answers, which doesn't help anyone. I have no problem with someone in you position using wordpress, and I accept that people have done great things with it, I just ask that you take it with a pinch of salt, that's all.
 
hello every one...just wanted to ask about uploading file problems..
i cant upload my audio and video files above 6-7 MB, i have changed memory_limit, post_max_size & upload_max_size to 128M but still i cant upload files above 6-7 mb

any help would be appreciated
 
any suggestion for a site where I can learn Ajax from? Assume I have 0 knowledge about Ajax.
 
@Kishor If you want tutorials, just Google it and avoid W3Schools results. If you want a reference manual, I highly recommend MDN for pretty much anything related to client-side technologies.
 
This reminds me of when I went on work experience at a beautifully constructed home. The architects and structural engineers were not entirely happy with the inner workings, layout of cabling, etc... but the outside looked perfect to me! I think the developers are never going to be entirely happy with what's under the hood!
 
2:57 PM
@DaveRandom - Thanks Bud! :)
@MikeB - Ha ha.. Okay ;)
 
@DaveRandom Haha, so true... especially the way the customer is billed!
 
Is there any limitations in using Session variables for a user login instead of using cookies other than sessions are cleared after some time..
 
3:04 PM
@troublecreator Check the value of $_FILES['name']['error'] please (the error key of the file upload information) this should give a numeric error code that matches on of the reason codes shown here.
(for a failed upload of a larger file, obviously)
 
gtg guys, thanks for the help @DaveRandom
 
@DeanKayton NP :-)
@Kishor There are potential concurrency issues with $_SESSION, see session_write_close(). Also, sessions are incompatible with REST (if you care about that)
 
Good morning all
 
@troublecreator Also, how did you change the settings you mention? In php.ini or with ini_set()? Because changing some of those settings with ini_set() will have no effect because they are applied before any code in your script is executed.
@Neal Morning.
 
@DaveRandom i have changed these settings in php.ini directly... the file upload shows no error but in DB the entries are empty...
 
3:11 PM
@troublecreator Ahh you've added a whole new dimension to it now - what is supposed to be in the database? Can you show your upload handling/database insert code? Please create a paste of it instead of posting it in here if it is more than a few lines.
 
@Neal howdy
 
@DaveRandom - So Session variables cant be accessed when more than 1 script is running concurrently..? hhmm I dont think I would have something like that in what I am doing..
 
Whats goin on? @MikeB @DaveRandom
^_^
 
@DaveRandom actuallu after uploading file to the directory it saves the path in db...everything else is working fine but it do not upload more than 6-7 MB
 
@Kishor Just be careful with that assumption. In a lot of cases it doesn't make a noticeable but if, for example, you allow a file to be downloaded through a PHP script at some point, you should close the session before you start outputting the data, else the user won't be able to browse you site while the download is in progress.
 
3:13 PM
@DaveRandom they seem to work fine for me
 
@Neal Concurrent requests are queued. In a "just serve a webpage, get it out the door asap" situation it rarely makes a noticeable difference, but see my comment above for a common situation where it does make a difference ^^
 
@DaveRandom which comment?
@DaveRandom wait... what do u mean?
 
@troublecreator You mean the file stored on disk only contains 6-7mb of data? Or are you storing the file data in the DB? (don't do this)
 
I have poeple downloading files fine without closing sessions.
 
ohh no iam not saving the files in db just saving the path....

should i increase post_max_size??? aswell... i just came across these lines in php.ini

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size = 8M
 
3:16 PM
@Neal If you link the file directly, it's not an issue. But say you have a download proxy script like download.php?file=somefile.ext - if you call session_start() within download.php then subsequent requests will block until the download is complete.
Also not an issue if download.php doesn't call session_start()
 
@DaveRandom Well I have a session class that is automatically called by my code.
 
@DaveRandom why the blocking?
 
@troublecreator Yeh that'll be your problem. I'd be surprised if that gave you an "no error" error code though.
 
function getFile($fileId = null, $asAttachment = false) {
    $file = $this->getFileInfo($fileId);
    header("Content-Type: " . $file['fileType']);
    header("Content-Length: " . $file['fileSize']);
    header("Content-Location: " . $file['fileLocation']);
    if(!$asAttachment)  {
        header("Content-Disposition: inline; filename=" . $file['fileName']);
    }
    else {
        header("Content-Disposition: attachment; filename=" . $file['fileName']);
    }
    echo file_get_contents($file['fileLocation']);
Can that cause a session issue? ^ @DaveRandom
 
yeah... so am i... :S thanks a lot @DaveRandom :)
 
3:19 PM
@andho Because the session file is locked by the script that has it open. Subsequent requests will block at the session_start() call, because they are trying to acquire an exclusive lock on the file.
@Neal If you called session_start() within the script, yes. Also, use readfile() instead of echo file_get_contents(); the former copies one stream to another, whereas the latter loads the whole file into memory before writing it to the output buffer.
 
@DaveRandom hmm in many things I have seen, they use file_get_contents why is that?
 
@Neal Many people still use ext/mysql, that doesn't make it the right way to do it :-P
 
@DaveRandom and again, my session class is called every time the controller is built.
idk how session_start would block anything
 
@Neal Well you probably wouldn't have noticed the issue if you are only serving small files that download very quickly, also you wouldn't notice it unless you tried to browse to another page while the file is downloading.
@Neal Hang on I'll make a little demo.
 
@DaveRandom k
and if this is true, how do I fix my download script? @DaveRandom
I already changed to readFile
Current fn:
    function getFile($fileId = null, $asAttachment = false) {
        $file = $this->getFileInfo($fileId);
        header("Content-Type: " . $file['fileType']);
        header("Content-Length: " . $file['fileSize']);
        header("Content-Location: " . $file['fileLocation']);
        if(!$asAttachment)  {
            header("Content-Disposition: inline; filename=" . $file['fileName']);
        }
        else {
            header("Content-Disposition: attachment; filename=" . $file['fileName']);
 
3:34 PM
Grrr viper7 is playing up again. Anyone know of another codepad that renders the HTML?
 
@DaveRandom - I would be excited to see your demo on this.
 
@DaveRandom not sure... I found this list by @hakre hakre.wordpress.com/2011/10/05/list-of-online-php-codepads
@DaveRandom this one seems to work: coderun.com/ide ^_^
 
How would one avoid new stdClass() triggering __autoload() ?
I don't fancy doing a string check to make sure it's not stdClass
 
.... I never knew that cd - would take you to the last directory you were in!
 
@Jimbo autoload is only triggered when the class doesn't exist. stdClass always exists, so it will never happen.
 
3:44 PM
@Jimbo it should not autoload...
 
@Leigh it takes me to the home directory on ubuntu
 
Oh ffs it's just overwritten my code!
 
That's what I thought guys.. running new stdClass() seems to still want to require_once() it.. Warning: require_once(stdClass.class.php): failed to open stream :D
 
@Leigh on OSX too
 
@Jimbo you are doing something wrong....
 
3:46 PM
@Neal Yep x(
 
@Jimbo what's the code creating the new instance?
 
@andho $this->response = new stdClass();
 
@Jimbo no need for the ()
 
@Jimbo you should check the stacktrace for the error
 
@andho No it doesn't, you're confusing - with ~
 
3:50 PM
Huzzah Everyone!
I made a small community thingy, for friends and friends-of-friends who play the same game, and i'm expecting about 200ish users/day. I have a 256Mb ram VPS will this be enough? (there isn't that much db-connections going on behind it, just a few selects and inserts anytime a user likes another user thing and visit their profile)
 
@MoshMage Yes
 
@MoshMage depends entirely on everything you haven't told us :)
 
@DaveRandom anything?
 
@Neal @Kishor Right, none of the codepad-type options are working properly, here is a pastebin of a small code sample that demonstrates the problem. If you click the Get the file without ending the session link, you won't be able to get to Click the link page until the entire file has been written to the web server's output buffer. If you click the other link, you can get to it immediately.
 
@Leigh wait "cd -" or just "cd"
just "cd" takes you to the home dir
haha, i didn't parse the "-"
 
3:55 PM
Thanks @KingCrunch;
@Leigh erm.. i have enough space and bandwidth (i think! 50000 MB)
 
dammit, i cannot see monospace -.-
 
@andho As I said: cd -
 
@MoshMage Go for one of the unlimited hosting plans.. because that's a tangible asset that can be guaranteed /s
 
@MoshMage OS? Web server being used? DBMS being used? concurrent users? what else is the server going to do?
 
@Leigh i read - as a separator, as i couldn't differentiate the mono-space font
goodnight
 
3:58 PM
@MoshMage MoshMage, in order to determine the limits of your box you need to do something called AB (Apache Bench) testing to determine the requests per second your server and application you can support. It's not something that anyone can answer given a list of server specs
Once you know the requests/sec limits you can apply that to frequency of users-visits and growth.. if you do it right you'll be able to determine the week of the year that you'll have to upgrade to avoid downtime or performance dips
 
Debian, nginx, percona, and nothing else - 256mb should be fine. Centos, Apache, 200 users concurrent and MongoDB - Hope you got a few gig of swap space spare
 
@Leigh he said 200 users per day. OK, there is a slightly chance, that all 200 come to the same time ;)
 
@KingCrunch If they're playing the same game together, it's likely there will be a few concurrent right?
But still, 256MB is tight, there's no room for edge-cases
 
@MikeB i already have the plan, i bought it for my portfolio which i never came around doing x)
@Leigh i shall do what @MikeB said because i know not of half of what you ask; I know i'm on a *nix so (dot know the distro) and the server (or, my VPS) isnt doing anything else
 
@MoshMage You know a VPS generally means you have to manage it yourself. Knowing the distro is a good place to start :p
 
4:06 PM
@Leigh: SWAP space? To perform DB operations? Ew :p
 
@NiekBergman If Apache chugs all your memory, that's all you have.
 
@Leigh: yes, so things will go horribly slow :D
Unless you have an SSD, then things might only go slightly slow.
(but you don't want to perform too many write operations on an SSD)
(at least not yet, wasn't there something in the news lately about SSD being made more reliable?)
 
Hi Guys, how do I convert an array to an string, i have tried implode, I have used foreach and then concatinating the string... but for some reason it keeps converting back to an array. I am not resetting it anywhere
 
@KyleHudson Code or it didn't happen
 
@KyleHudson code on codepad or didn't happen
lol
 
4:17 PM
lol
 
This is just scary
:)
 
It's that mind-merge we did last week. I knew it would come back to bite us.
 
:P
 
@DaveRandom @peehaa 2 secs
 
That's nothing, I did a mind-merge with a Lojbanist 2 years ago and I still tavla bau la lojban
 
4:20 PM
hehe
 
@DaveRandom I would never write code like that...
 
(which reminds me, I need to update that)
 
@NiekBergman You're from friesland so it's all the same to me :D
 
@Neal Neither would I, it's just a very simple demo of the problem wrapped in a single file.
 
4:22 PM
@PeeHaa: LOL
 
@DaveRandom hmmmm
 
@PeeHaa: Well, I don't actually speak Frysian :)
 
@PeeHaa: not that you're really required to in Leeuwarden anyway :)
 
:)
 
4:27 PM
I dont understand the comment on my answer to that cv...
 
@Neal He's asking where to put the server side code for the Ajax request. Obviously the client side goes in JS, but it has to communicate with something on the server side.
 
@DaveRandom meeeh... obviously it is up to the OP.... weird question....
 
4:44 PM
@NullPointer Yes.
I work for BYU's supercomputing department.
 
@LeviMorrison its cool
 
@MadaraUchiha Sup
 
Well, shit.. You can't assign by reference when assigning like $a = $b = $c = 1234, so $a = &$b = $c = 1234 doesn't work
(it's codegolf, save your wtfs for another time)
 
Try $a = &$b = &$c = 1234
 
4:59 PM
@Neal I'm actually doing the equivalent of $files[] = &$file = [];
 
@Leigh hmmmm
 
@Leigh holsters weapon :p
 
evening
 
@Leigh ahh but explain this one. why is $a === 1?
<?php

$a = &$b; $b = &$c; $c = 1234;

$a++;

echo $b++ . PHP_EOL;

echo $c++ . PHP_EOL;

echo $a . PHP_EOL;
Output:
1234
1235
1
 
@Neal Because $b is undefined when you create a reference to it.
And null == 0, so null++ == 1
Would be an awesome bug if you created a reference to null, and then made null == 1 everywhere :D
 
5:05 PM
@Leigh yes, but when $b is set as a reference to $c shouldn't it fall back to $a?
 
@Neal No, it should not.
 
@Leigh and why is that?
 
Because $b is undefined when you do $a = &$b - It does not exist yet, you're not creating a reference to $b at this point.
 
@Leigh ok what about this case: codepad.org/cgnTOJ5T
$b is well defined there.
 
.You can't have a reference to a reference :D
 
5:07 PM
@Leigh So what is $a refrencing?
and why not?
 
Actually, let me change that, when you create $b as a pointer to $c (guessing here), the old $b is destroyed and created freshly as a reference to $c, breaking the reference that $a had to it.
 
@Leigh Actually, that is irrelevant. The only thing that matters is the $b gets reassigned as a reference to something else, which leaves $a no longer referenced to it.
 
and why is $b++ not 1235?
 
Counter intuitively, you can create a reference to a variable that does not yet exist, and when you create it the reference will inherit the value.
 
@DaveRandom You have to create the references in reverse order
$c = 1234;
$b = &$c;
$a = &$b;
 
5:10 PM
@Leigh so why does this work -> codepad.org/GFdO3hAz $b is now a reference to a reference.
 
That works
 
<?php
function &getC() {
    static $c = 1234;
    return $c;
}

$a = &getC();
$b = &$a;

echo $b++;
echo PHP_EOL;
echo getC();
 
@Leigh You don't have to.$a = &$b; $b = 1234; echo $a; // 1234
 
@DaveRandom Where is $c? :)
 
@DaveRandom but once you assign $b = &$c, $a is still 1234
@Leigh ? to the above demo
 
5:12 PM
@Neal Only if you do it after the $b = 1234; statement.
 
@DaveRandom yes
 
@Neal I'll assume something to do with the static keyword
 
that is what we are talking about @DaveRandom
@Leigh idk about that...
ill remove static. one second
class C {
   private $c = 1234;

    function &getC() {
       return $this->c;
    }
}

$C = new C;
$a = &$C->getC();
$b = &$a;

echo $b++;
echo PHP_EOL;
echo $C->getC();
 
I don't actually know what you're trying to prove with that demo
 
@Leigh That reference of a reference makes no difference. it should work. it should not lose its referenceyness
 
5:16 PM
@Neal I retracted that comment :) When I said the act of making a variable reference another variable, breaks references to that variable.
 
posted on December 05, 2012 by Anthony Ferrara

The third video to my Programming With Anthony series is up! In this video, I talk about variables in PHP and how they work under the hood. I explain the difference between variable references and object references, along with the semantics of each. Give it a watch! This is the culmination of my trial at these YouTube videos. I have done a high-level one (focusing on abstract concepts), a mid-

 
Heh, Neal has insider info I guess ;)
 
@Leigh lol wth
 
user1125394
well let's see &references with Anthony
 
5:31 PM
@Neal lxr.php.net/xref/PHP_5_4/Zend/zend_execute.c#508 - I believe, the "break it away" line, is whats causing the broken chain of references (from your first example)
Someone needs to teach @ircmaxell how to hold a pen.
I'm going home
 
Am I vulnerable anyway if i hotlink images? I mean, the image link is submitted by the user. is there any chance of vulnerability?
 
user1125394
nah he's afraid to spread ink everywhere
 
@Kishor Just <img src="http://not-my-site.com/image.jpg" /> ?
 
Thats my intention, but its users who submit the link. I am doing a check whether the url has a valid image file extension though. Is there any chance of vulnerability?
 
2
Q: Validate that a file is a picture in PHP

jd.If a file is uploaded to the server, is there a way using PHP, to make sure that it's actually a picture and not just a file with a .jpg or .gif extension?

Don't just check the extension
 
5:42 PM
using GD, I will have to download the whole image first I assume
 
@Kishor Yes, there's no way to tell if a file is 'safe' without actually inspecting it
but if all you're doing it filling out an <img> tag with a user-entered url I don't think you have anything to worry about
At that point it's a browser problem if it opens an image that's actually a virus or something
You definitely want to validate that their image-url is actually a url and not some base64_encoded png mess
 
You might take an eye to this 1337day.com/exploit/18161 before doing the @snicker method
 
@MikeB - Ok Gotcha! :)
 
eeh? Isnt that what getimagesize should actually do?
 
5:50 PM
10
A: Super fast getimagesize in php

webartofunction ranger($url){ $headers = array( "Range: bytes=0-32768" ); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); return $data; } $start = ...

 
Nice, apparently I was wrong about getimagesize() downloading the entire image
> Plus getimagesize() doesn't download the whole file. It first calls
php_getimagetype() which reads just the first few bytes to get the type of image.
Then based on that type it will call a function like php_handle_jpeg() which just
reads the image info.
How do you quote something these days..
 
@MikeB I don't know how to read PHP core, but I'm really curious how much is "enough", since header can be of variable size.
You can't have newlines in text :)
 
I didn't think I did? - guess so
 
> Plus getimagesize() doesn't download the whole file. It first calls php_getimagetype() which reads just the first few bytes to get the type of image. Then based on that type it will call a function like php_handle_jpeg() which just reads the image info. - Rasmus
 
ty
 
5:55 PM
> lemme
> quote
> this
 
Fail
 
would be nice, but...
 
ah :P
 
Ohhh I copied the newlines from php.net.. got it
 
placekitten.com cool cat again ....
 
5:59 PM
You found @LeviMorrison's website :)
 

« first day (781 days earlier)      last day (4185 days later) »