« first day (979 days earlier)      last day (4195 days later) » 

00:04
So. Last night I stubbed my toe on my couch so hard that I actually broke my middle toe
However, this is a pretty weak story for a bone break
I need something a little more...not weak
you dropped a keg on it
Wild dog attacked a little girl and you kicked it, and it died.
@Danack I like this
0
A: Does a google API authenticated response needs sanitation?

ircmaxellYes. Yes you do need to sanitize the data. Sort-of. This is really one of the basic principles of security at work here: Filter In, Escape Out. Basically: Filter In Always filter the data that comes into your application. What does that mean? If the data isn't hard-coded in your source code,...

I have a feeling that's not going to get anything ;-)
00:30
@ircmaxell nice answer, +
you just never know...
;-)
0
A: How to unregister specific "Registered PHP Streams"?

ircmaxellThe short answer is: don't even bother trying. PHP is a complete enough language that if someone is going to write dirty of vulnerable code, they can do it through any block you put in place. The only thing disabling functions like that does is make application developers' lives hell. It's bee...

Yay! I jumped 5 spots yesterday to #347 all time!!!
and I'm #181 for the week!!!
@ircmaxell great points but doesn't answer op's actual question
@ircmaxell ?
sure it does: You can't
you must be able to do it
you're basically saying "you shouldn't"
00:50
edited... There
awesome! it's complete now
user652649
01:10
found a possible bug in php after 1 hour struggling... the php's embedded server doesn't handle post data if it's sent this way "&var=value&name=value" with a "&" as first character... which is weird because parse_str handles this case perfectly
user652649
any thoughts about this?
Interesting... what is the spec?
user652649
latest php 5.4.16 i guess, downloaded yesterday, on windows 7... data is sent via xmlhttprequest using the method .send("&bla=bla")
user652649
...fetching the request headers... wait for them
No, spec for the form URL encoded mime type...
user652649
01:13
application/x-www-form-urlencoded
user652649
just this
user652649
as Content-type
user652649
php://input contains the data
user652649
but $_POST is empty
user652649
data sent is very simple, it fails also with "&a=b"
01:17
& is a separator, it is undefined having a blank first element...
user652649
i don't understand... there's no form involved in this, i'm using xmlhttprequest
The current implementation follows the spec. So its not a but ;-)
Bug
Simply trim off the leading &...
Now, that doesn't mean it can't be fixed, but it needs to be approached correctly. Not as a bug, but asa missing feature...
Morninng
is this a proper way to handle exceptions?
class Exception extends \Suls\Operation\Exception
    {
    const RESTRICTION = 1;
    const RESTRICTION_MESSAGE = 'Restriction affect';
    const OVERFLOW = 2;
    const OVERFLOW_MESSAGE = 'Overflow affect';
    }
user652649
yeah of course it's not a bug but it's still weird... is post data handled differently with php's embedded server? doesn't it use same technique of parse_str ?
Without looking at the code, I am not sure...
01:22
@sectus Not clear what you're asking - but calling an exception 'Exception' is bad imho - it should always be a specific name e.g. FileNotFoundException.
user652649
:P should i submit a bug report / feature request ?
Or RestrictionException and OverflowException in your case.
@Danack , there is many states of it... i am not sure that i am ready to create 15-20 exception files.
@sectus In my opinion, no. Your catch() block is gonna have to have a bunch of if/else checks to determine which "exception" you're throwing.
@sectus "there is many states of it" That is fine. If you really have lots of different exceptions then it's probably best to define each of them separately as you can't tell when you're writing the code which exceptions the code calling the library will be able to catch and handle, and which can't be handled.
01:25
@cspray , it's a good reason.
Woot, just got me a badge by editing a question :-)
@sectus I'm confused. What's a good reason for what?
user652649
@ircmaxell ouch... i think there's more, because it still fails even without the leading &, happens less often by the way... how can i print the raw request data in php?
@cspray to use catch instead of if/else
If you do have lots of different types of exception you can sub-class them from a common root and only catch the root one.
class OverflowException extends \Suls\OperationException{}
class RestrictionException extends \Suls\OperationException{}

try{
foo();
}
catch(OperationException){
}
01:27
Php://input
@sectus Exactly. But in your case you would need a bunch of if/else checks in the catch block. You have to check if it is an Operation exception or a Restriction exception
And then when you add more reasons for throwing an exception you have to go add more if/else blocks
user652649
@ircmaxell that's only the post data, right? how about all the request?
And if the code is able to handle one of them:
try{
foo();
}
catch(RestrictionException $re){
    //continue processing
}
catch(OperationException $oe){
    //We borked - stop processing.
}
Wes, not sure off hand...
I am agree with you. Second question. How to store exception files properly?
01:30
@sectus Btw this article is almost very good today.java.net/article/2006/04/04/… except for one bit where it's clearly wrong.
@sectus Create an individual exception for each type you plan on throwing that is descriptive of the exceptional circumstance it represents.
So long as you have APC or OPCache running, there is effectively zero overhead for having reasonably large numbers of exception classes.
(i presume)
@cspray , but my folder will consist of one-two logic file and of large pack of exceptions.
but there's lots of readability savings!
@sectus So?
01:32
or put exceptions to their own namespace(and folder)
Exception\AccountBlocked
Yes but Exception\AccountBlockedException
@Danack , why i must duplicate exception word?
Tradition mostly I guess.
But also you probably won't be duplicating it in actual use - top of file:
use \Suls\Exception\OperationException;
And then in your code:
throw new OperationException();
Unless your code style is to not use 'use' - tbh it's more of code style (and so open to opinions) rather than being an actual thing like having separate classes for each Exception type, which is not so open to opinion.
01:40
@Danack , no... i can use use
use Operation\Exception;
user652649
@ircmaxell without the leading "&" fails less often... but even without it sometimes $_POST isn't populated correctly (it's empty)

http://pastebin.com/c6unmC31

are my request headers fine?
@sectus - are you saying use the class 'Operation\Exception' or to pull in 'Operation\Exception\ *' ?
@Wesツ do you have a trailing or leading \r\n?
@ircmaxell I think it is a great step in solving one of the worst problems I've encountered in PHP development: plaintext passwords. However, I'm curious as to how much adoption we'll see.
user652649
checking..
01:45
I'm afraid adoption won't be as high as it should be...
@Danack , pull to separate folder.
@cspray thanks! But I meant more the documentation updates ;-)
@ircmaxell Oh! :P
Let me look over those and I'll get back to you with feedback if I have any :P
@sectus We may be talking past each other and giving each other confusion . You know you have to name all use individually? use 'Operation\Exception' wouldn't pull in the whole directory.
user652649
01:50
@ircmaxell strlen says it's fine
hmmm... Can you show the raw headers before you send it (the code you're sending it with)?
user652649
that's the dump Chrome makes pastebin.com/c6unmC31
user652649
i don't know if matters but that happens while many others xmlhttprequests are running
user652649
if you're interested i can try to package a smaller example showing the problem
how are you issuing the request? Can you show that part?
the actual JS code?
02:01
Do you know FW which has goodlooking exception tree?
Zend and Symfony both do
user652649
sure @ircmaxell pastebin.com/PQV19CKi
i somehow get the feeling , that if the most important aspect of framework for you is the exceptions, then you are doing it wrong
did they run out of goats to sacrifice ? I wonder what the unittests look like for that abomination.
02:06
@Wesツ Don't you have to set the Content-length header?
user652649
@ircmaxell i don't know what i'm reading...did you find the problem already?
@ircmaxell That is many cases.
user652649
@Jasper it isn't necessary... chrome adds it for me
user652649
ah, that's a monumental switch()
@ircmaxell , they are pretty close to each other: github.com/symfony/symfony/tree/master/src/Symfony/Component/… and github.com/zendframework/zf2/tree/master/library/Zend/… . And has separate folder for it.
02:12
@Wesツ no, looks pretty sane to me: lxr.php.net/xref/PHP_TRUNK/main/php_variables.c#231
aside from that nice goto there ... then again , that might be the cleanest solution
yeah, I've kind of abandoned my hatrid for GOTO after debugging this garbage collector issue...
4
it can make structures SO much easier to follow
user652649
so which could be the issue? php://input contains the data but $_POST is empty
honestly, I have no idea... Unless I could reproduce the issue, I can't tell from the least
@Wesツ , what is the data structure?
02:18
can you try to reproduce it with as little code as possible? And without a browser?
user652649
ok i'm trying, and i will create a small example
user652649
@sectus it's just a simple xmlhttprequest containing POST data of "bla=bla"
if you can reproduce it with fsockopen, that would be AWESOME, because I could then turn it into a test case: :-D
:-D
Alright, good night!
user652649
i think i've found a way to identify the problem
user652649
on firefox it works properly
user652649
02:28
pastebin.com/HyEjPUUL here's the difference between ff & chrome
user652649
so it must be some caching issue.. trying..
user652649
nothing changed... anyway gn ircmaxell
"Undefined variable: expecting"
That's what php just spit at me and I really thought it was a pretty useless message
it even looked broken
but of course, the fault was my own, I used a variable named "expecting" (well, actually used a class member named that and then forgot to write $this->)
I really should take a little care when picking my variable names...
02:54
Hi, I have a fast PHP+MySQL question.
user652649
i give up
I have a PHP string with a MySQL command: "SELECT * FROM t WHERE id=$idNumber";
id is an integer. What value should I give to $idNumber so the SQL command will be true for every integer?
I'm looking something like %s at strings...
You just remove the WHERE clause? (though since you added the %s bit I no longer know what you're trying to do, so I may be way off)
I have that MySQL command. I mustn't modify that, because it used by many functions, but sometimes I need it to be true for all values. The only way I can effect the result is with the $idNumber variable.
@totymedli WHERE IsNumeric(id)
03:01
$idNumber = '1 OR 1=1'
I know that, but I cant modify the command, as I said before.
Or am I not allowed to cheat?
:P
@totymedli ...whatchya' tryin' to do there?
I have a table full of integer ID-s. I use that SQL command to select the ID-s I want. The code sets the $idNumber variable to that id number, that I want to select. Sometimes I need to select all the ID-s so I try to give $idNumber a value that will be always true.
If they were strings I would simply say it to be '%s' but, this works only for strings... Aren't there a special character to replace any integers?
user652649
@ircmaxell i did surrender. it has something to do about X origin requests... since the only header that differs from firefox is "Origin: localhost:8001"; (on FF it isn't set at all) ! but it's still some php's problem, because data is sent and reiceved by php... but accordingly to the Origin header it decided to not parse it... in fact, as workaround i'm using parse_str($HTTP_RAW_POST_DATA, $_POST); and it's working brilliantly now... hope this helps identifying the problem
user652649
03:10
3 hours on this. i want to die
(interested in opinion )
@totymedli I really don't believe that's how %s works...
@Jasper Sry I mixed it up with LIKE '%s'
@totymedli you mean LIKE '%'?
@Jasper Yes. Oh man. I totally mix up everything today. I blame C for this.
03:19
IF you do, using wildcards make sense in imprecise text matching because there are other use cases for it
For integers, there are no other use cases, and the use case you have given doesn't really make sense (you should leave out the WHERE clause instead).
As such, I don't think there is any other way than the "SQL injection" method I gave above
But I need the WHERE clause in other usecases.
Then you can use something like:
$sql = "SELECT * FROM t"

if ($useWhere)
{
	$sql .= ' WHERE id=$idNumber';
}

query($sql);
@Jasper Yes. Seems like this is the only solution.
I just hoped if there is a way, without overwrite the source code.
Anyway, thanks for answer.
@HiteshSiddhapura hiya
user652649
morning all
@HiteshSiddhapura isnt this page looks wearied thehiveshowroom.com/careers ?
@Wesツ hiya ,,
hello all
04:15
@Paul hiya
@NullPoiиteя morning.
 
1 hour later…
m59
m59
05:27
SELECT COLUMN_NAME
        FROM information_schema.COLUMNS
        WHERE TABLE_NAME=:table
        AND COLUMN_KEY='PRI'
I'm not sure what I'm doing wrong here.
It works when I use a value rather than :table as a param
No errors, just an empty result (false).
Awww mannnnnn
I know why =D
the parameter has no value LOLZ
For MySQL, can display width be optional?
user895378
05:44
And they said PHP devs weren't smart enough for websockets ...
user895378
Non. Blocking. Event. Loop. How can you fix it? Don't call sleep(). — rdlowrey 2 mins ago
@ircmaxell the google says cant have no hitler here. and wont let me have the cure either
@Gordon Do you know how can I upgrade PHP version on wamp server to latest version of PHP. The addons of wamp server are just offering upto 5.3.1 not < 5.4
I searched but didn't found anything
@cspray a unicorn stepped on it while you were chasing down nazis in the black forest
4
morning humans
05:52
@YogeshSuthar I dont know. What I would do is make a copy of the php folder in your wamp directory. Then download a current official PHP and paste the contents into that folder, overwriting the WAMP's PHP. That either works or breaks WAMP. If it breaks WAMP start cursing it and finally use a VM instead of that crap package. Well, or put the copy back.
Instead backup www, uninstall wamp, re install it, restore www, that's it
hi
@Gordon Thanks. I will try this.
what's faster, foreach with prepared statement insert, or foreach then bulk insert?
bulk = INSERT INTO tbl(col1,col2,col3) VALUES(0,1,2),(1,2,3),(2,3,4),...)
one vote for the bulk insert but have to be carefull with that
06:02
there's a setting for if it fails, the whole query rolls back, @PeterKiss: I think I agree! Since execute() contacts the mysql, where as one statement is once only :)
it's always a goal to reduce the number of RPC (like query a db) calls in an application
m59
m59
I think my regex pattern is using the slashes from the variable in it....
what to do?
@Mr.Alien morning
@DaveChen, SQL injection is the problem not an unexpected error becouse an insert (bulk or not) should be always in a transaction
m59
m59
nm, found it =D preg_quote?
06:04
by error I mean constraints (dupes)
@DaveChen profile
m59
m59
nevermind, that did nothing.
gonna bench it yep ;), but I think I might just use bulk simply because if I use the first method, I can't rollback as easily if there are "errors" in any of the datasets
@DaveChen, yes, constraint errors, network transaction errors, locking problems, concurrency problems all parts the unexpected errors bag :)
ofcourse you can!
just start a transaction before the first insert
and send a COMMIT after the last
if something goes wrong, send a ROLLBACK and exit the foreach and signal the error somehow (throw an exception)
I still like this reduce the number of RPC~
06:09
me too, i just want the clear that "separated insert rollback question"
06:33
Good morning!
06:43
Anyone using Vagrant here?
07:04
posted on June 21, 2013 by hakre

Christan Wieske has published a nice summarizing article with the same title. It contains some detailed information I haven’t found so far on the web so worth the link: PHP: XPath on HTML and XHTML. It also reminds me of … Continue reading →

@phpNoOBఠ_ఠ Why would that be?
Morning all
@dragon112 morning for you. :) afternoon for me.
It's all the same for me:p
07:22
Hey, anybody here have time to help me out with some regex? :)
morning
@dragon112 ayy ayy
I have a text with "test <br /> test2" in it... I'd like to change that into <li>test</li><br /><li>test2</li>
@JesperJacobsen regex, or just explode and then loop through the array
07:28
I want to use regex, but i cannot find any sense in it... could you help me with it?
@JesperJacobsen I have to go now, but give me 2mn i'll do it fast
okay thanks :)
@HamZa Noooo where are you going sadface
@dragon112 to internship lol
boooo :p
07:31
Good morning everyone
@JesperJacobsen You want to preserve the <br> o_O ?
No.. that was a flaw :P
ok
enjoy
It can maybe be optimised
but ya know fast thing :p
laters guyz
You can also replacestring "<br />" with "</li><li>" and prepend a <li> and append a </li>
07:33
@HamZa later
yeah maybe :)
user895378
♪ Writing tests that already pass ... singing about being naughty feels so good! Oh! Oh! Oh! ♪
@Mr.Alien See outside, its horrible raining . :)
@YogeshSuthar Not here :p
07:40
@Mr.Alien But in Dahisar, its horrible. :)
@YogeshSuthar Wait for 10 mins and it will rain here too than..
Ohhhh, it stopped here. @Mr.Alien
@NullPoiиteя got your Guru badge? :P How much rep did you get over the couple weeks your answer was accepted? :P
I count 170 rep + a silver badge
@YogeshSuthar Aaaa, good that it stopped
I haven't gotten a single rep point in 7 days :o
07:50
@dragon112 You aren't posting enough useful answers then :)
I'm not posting answers :p
All the rep I get right now is from older answers
My last answer: May 28 at 12:41
And that was on my own question :p
After we reach certain points, we get bored..
It's not that I get bored but I don't really see the point in getting more rep. If I see a question that doesn't have any good answers I'd answer it, but that rarely happens :p
I am bored...
Oh yes, am getting closer to get a css gold badge, muhahahaha
@ircmaxell Another page for you to update: docs.php.net/manual/en/password.constants.php :) Should mention that bcrypt is the default, see stackoverflow.com/questions/17225629/…
07:59
@Mr.Alien 15 more.
@YogeshSuthar 115 more :p
PASSWORD_DEFAULT (integer)
The default algorithm to use for hashing if no algorithm is provided. __This may change__ in newer PHP releases when newer, stronger hashing algorithms are supported.

Why would you ever use default? When you update php your code will stop working if they get a new /stronger algorithm..
@Mr.Alien ohh yeah its 885

« first day (979 days earlier)      last day (4195 days later) »