« first day (1528 days earlier)      last day (3414 days later) » 

11:00 AM
@JoeWatkins The current SPL autoload API is fine really
 
if that were true you wouldn't be working on it today :D
 
Its only problem is its lack of support for functions
 
not sure why it's in SPL at all, feels correct that it's a feature of /Zend, I liked that about anthony's patch ... like i said whatever moves us forward is good ...
 
The old __autoload API isn't nice though, I'm not using it for functions.
@JoeWatkins It's in SPL because it's all just a wrapper over __autoload. You could even polyfill it in userland.
 
what do I pass as $length in function read($length) { return fgets($this->fp, $length); } when I want to offer that optional functionality? null, false and -1 doesn't work because it expects $length to be >0.
 
11:04 AM
@James there exists some. look for directory services. most application with user-management in professional environments do support that. depending on the online services you use, you might find it there to at least some share. However it would require that you professionalize the IT you have in that small company which might be the actual problem.
 
@Gordon If the parameter doesn't have a default, do the optional bit yourself
 
INT_MAX perhaps ...
 
@Gordon pass INF. ;) - well what is that optional functionality?
 
I am considering to make two different function calls, one with the length and one without
 
i.e. if ($length !== NULL) { ... } else { ... }
@JoeWatkins no
 
11:05 AM
@AndreaFaulds yup
 
@hakre God no
@JoeWatkins no
 
Actually is SSL so importaint ... i make just a casual page with cms not Banking services.. Or ist it common to use SSL like - where possible?
 
heard the first time @AndreaFaulds
 
INF or INT_MAX doesnt work because then it will not stop at line breaks
which is the default for fgets without length
 
@Gordon Some functions essentially do if (func_num_args() > 1) internally
 
11:06 AM
why can't you allow NULL?
 
@hakre Yes, I've just been looking there are service like OneLogin that seem to do it - they call it Provisioning.
 
oh yeah god don't use INT_MAX
 
We should be ok on the IT front, althought small we still rub MSFT SBS and use active directory.
 
@AndreaFaulds thanks for clarifying
 
@JoeWatkins stupid Mobile Safari...
 
11:07 AM
This : ["field1"]=> string(33) "bla" onclick="alert(0);" becomes this ["field1"]=> string(33) "bla", onclick=",alert(0)," when passed in this function format ($item) {
return $item;
}
 
spl_autoload_register(
function($cl){

require_once 'clases/' . $cl . '.php';
}
 
@animaacija depends... do you mind getting hacked?
 
How is this possible ? :o
 
@James then you already have a directory server.
 
11:08 AM
$buffer = $length !== null
    ? fgets($this->getProcHandle(), $length)
    : fgets($this->getProcHandle());
ugly :)
 
@Partick but unless noobie hacker with low intelligence will not do it. Skilled hacher will be intelligent enought to not to mess with page ... i think
 
@animaacija TLS/SSL is important to protect user passwords and privacy, and it's easy to set up usually
@Gordon you could cheat and use variadics (ogodno)
 
@AndreaFaulds I can live with the ugly
 
It's the hackiness that bothers me ;)
 
@Gordon just fyi, fgets returns from length -1, newline or eof, whichever comes first ...
 
11:10 AM
Easy? Really? I thied at top of every php page to place code SSL_starrt_safe() ... did not work ... so not so easy ..
 
the problem with using INT_MA X is preallocated buffer would be huge and extremely wasteful
 
The internet not helping eather .. ;(
just killing my believe in myself
 
the internet pains us all, @animaacija
 
@AndreaFaulds sorry TLS/SSL i found is not the same as SSL only
 
Alright, regex guru required
0
Q: Regex different result in debugger

Alma DoUse-case, project I have regular expression like: '/(^|[^a-z])sku([^a-z])/i' and a replacement '$1child_sku$2' The goal I want to achieve is to replace occurrences like sku to child_sku, with the requirements that field boundary should be replaced only when it's not a part of other data. T...

 
11:15 AM
@Gordon alternatively wrap stream_get_line instead of fgets
 
@AndreaFaulds can u provide link please or info on how to set up TSL easely ?
 
@AlmaDo most likely answer is a bug in PCRE that exists in one version and not the other
It's not likely to be a PHP bug, I would say
 
@AlmaDo or just a flaw in xdebug. test, don't debug.
 
@animaacija TLS is just the newer version of what was called SSL.
@animaacija No need: If you get a certificate for your site, it'll have instructions
 
@AndreaFaulds yes , found StackOverflow topic on that..
sertificate... how to get ... is it free ?
 
11:23 AM
@animaacija startssl.com
 
Yeah, StartSSL is good from what I hear
 
ouuh ... lovely ... finally ... i get myself going. Thank you folks!
 
@hakre I was testing and then found this. I fixed the code (got rid of regex, btw), and only was wondering what's the issue (apart from testing, just for debugging)
 
@AlmaDo I'm confused, the results in the 3v4 link have the comma
 
11:25 AM
@AlmaDo jup, can you obtain the full xdebug protocol log?
 
Posted to SO just in case if someone has a clue - and, perhaps, someday it will help another person
 
Is upvoting retarded questions a way to get a hat?
 
@AndreaFaulds It's trusted and free for a year of L1 (and can be renewed for free), on the down side the web site is a bit flaky and they can take up to a week to validate requests, and they don't do fancy stuff like wildcards or custom SAN. But what do you expect for free :-)
 
@PaulCrovella no, it has not (I mean in the place it should be)
 
@DaveRandom So, they're about as bad as every cheap TLS cert provider then. :p
 
11:26 AM
@Danack can you give any sample code example to work this actually..
 
@AndreaFaulds Yeh well that's the point - they provide a reasonable service for a free product, what makes them stand out is that the product is actually free :-P
 
@AndreaFaulds Which one is bad?
 
@DaveRandom They don't need to validate anything for the free cert that takes a week, got my last cert in minutes ;-)
 
@PeeHaa Every single one
 
@John No.
 
11:27 AM
@AlmaDo string(37) "child_sku==one-child_sku,sku==two-SKU"
 
@kelunik You underestimate the amount of validation they do
;)
 
Ah yes
 
@AndreaFaulds I'm rather happy with mine
 
btw thanks for the facebook link
 
@kelunik If you get another one for the same domain you may find it's not as quick, they had to do some manual verification for my second cert (but now they've done that they won't have to do it again, I think)
 
11:28 AM
Their validation is very sophisticated, I stole their algorithm:
 
I had to speak to a real person on the phone
 
@DaveRandom wut?
 
and since it's a free product, I guess that goes to the back of the queue
 
For domain validated cert?
 
if (strpos($email, '@') > 0) { grantSSLCert(); }
 
11:28 AM
@AndreaFaulds :D
 
hm..
 
@PeeHaa What do they validate other than your email?
 
@Danack Actually I am confused how can I divide html into chunks and send it to browser one by one (depending on repose of each chunk)
 
@DaveRandom I didn't have to renew one yet.
 
@kelunik They cross reference everyhting, hire a private investigator, folow you around IRL, check you bank accounts, police fines
 
11:29 AM
@PeeHaa No idea, something about the second application I made triggered their "extended checks" alarm. They were OK about it though, it took a while but as soon as it got sorted out they did it straight away.
 
:D
 
In any case, none of this will be relevant for much longer
 
Why is that?
 
so, guys'n'gals... how has the Steam's Winter sale been going for you ?
 
11:31 AM
@DaveRandom Well they also are going to "validate" so...
 
@PeeHaa Automatically, not using real world identity.
 
@AndreaFaulds Domain validation works exactly the same now
That check of yours is almost exactly a copy pasta of what they are doing now
 
@DaveRandom They'll still make a killing on them Extended Validation certs ;)
 
woops
 
@AndreaFaulds That's fine by me, I have no problem with people making money as long as the little guy who doesn't need/can't afford that crap isn't forced to pay for something that could be done for free
 
11:34 AM
^ that
 
Oh, wait, that was the redacted form. Full version: if (strpos($email, '@') > 0 && isNotSuspiciousAtAll($email)) { grantSSLCert(); }
 
Also insurance is what makes it expensive although I have never seen anybody actualy use it
Or even heard about it
 
People dealing with money
 
I have always thought that's a bit of a racket, it seems extremely unlikely that the cert would be the thing that's responsible for a breach
It would be even harder to prove it
 
Exactly
 
11:37 AM
Although that said, this could arguably have caused some such issues, for which the cert issuer could be held responsible
 
Does anyone know of a deprecated function in PHP 5.6 that will give an deprecated warning, but no other error?
 
@DaveRandom Also the great Dutch company diginotar
 
@Danack mysql_escape_string?
(That's the broken one that needs no server connection, and ext/mysql is deprecated)
You know what I don't get? Why did ext/mysql have to die?
Why does ext/mysqli even exist?
ext/mysql could've been extended and improved, but noooo...
 
can anyone point out to me what does this do  ? preg_replace("/[,;]+/", ',', $string)
 
Oh wait, everything has to be an object now in this brave new world... :/
 
11:43 AM
But we would have ended up with mysql_real_real_escape_string at some point :)
 
@Joseph Ah, yes, that replaces a sequence of consecutive commas or semicolons with a single comma
 
In regex, [] is uses to pick one of a bunch of characters, so [abc] matches a, b or c. [a-z] matches the 26 letters from a to z.
The + in regex means "one or more", so a+ would match a, aa, aaa but not an empty string, for example.
So, combining that: [,;]+ matches one or more commas or semicolons
@Joseph I hope this helps.
 
@AndreaFaulds or scrap 'em both and let's all use pdo ;-)
 
11:45 AM
@AndreaFaulds and does it not replace a " by ", ?
 
@Joseph replace what with what? Do you mean replace a quote with a quote followed by a comma?
 
@PeeHaa Indeed, although a "fake" cert wouldn't be covered by insurance :-P
 
@AndreaFaulds yes
 
@Joseph Well, no, it doesn't do that replacement, no. It just replaces semicolons and commas.
 
Ugh, not only do I have to work with SOAP, I think I'm going to end up having to write a custom soap client implementation :-S
 
11:48 AM
(by the way, writing in C is actually bad advice, but RIP Dennis Ritchie)
 
@DaveRandom What have you done wrong on your life to deserve that horror :(
 
lol
 
In fact, ping @hakre?
@PeeHaa inorite
Although, it might be good to have an async-capable SOAP impl that can deal with a token stream incrementally
/me goes to talk to the React peeps
 
@AndreaFaulds great. Thanks
 
11:53 AM
OH: "She left me for a hybrid ... didn't hear it coming"
 
@AndreaFaulds it's weird , when i pass this string bla" onclick="alert(0); through it , it return this bla",onclick=",alert(0),
 
Odd, maybe ; has some special meaning in regex and needs escaping
 
^ it doesn't
 
11:59 AM
Also, almost nothing has special meaning inside a char class
not even [
 
@AlmaDo Why did you delete the question? I just finished typing up the answer :/
 
@AndreaFaulds i forgot to mention that i trim my string before, but i don't think that has any effect on the outcome
 
@PaulCrovella because edits are needed
so no confusing with other circumstances
 
@AlmaDo want to ping me when it's back up, or would you rather me spoil the answer for you now?
 
12:04 PM
@AndreaFaulds @DaveRandom the string looks like this upon a var dump , ["Myfield"]=> string(33) "bla" onclick="alert(0);" , some thing is wrong with the doubles quotes, yet it causes no errors :o
 
ThW
@Joseph it doesn't 3v4l.org/e5BYc
@Joseph are you trying to parse html with regex?
 
@DaveRandom pong.
 
@PaulCrovella we'll see
 
My website now has my gravatar on it ^^ ajf.me
It even has it scaled down 2x, for people with retinas.
 
@hakre Any experience of reading huge (100s of MB) XML docs with PHP? I'm evaluating the possibility of writing a SOAP client to consume an API that returns insanely large data sets
 
12:07 PM
@AndreaFaulds Turns out I had derprecated myself.
 
It seems like that sort of thing you might know something about
 
@Danack Oh?
 
@DaveRandom yes I have. Even gigabytes.
 
@hakre XMLReader?
 
Custom error handler that clears output buffering, and then calling a deprecated function => no worky output buffer.
 
12:08 PM
@DaveRandom if you can't take the whole document into memory, I would suggest so, yes.
 
ThW
@DaveRandom XMLReader + DOM for the record nodes
 
otherwise start with domdocument.
 
Wouldn't be practical to load the whole thing into memory. I would need to create some entities to work with in PHP, so that would be entire doc string + memory for PHP types, would get stupid very quickly
Need an element of concurrency as well
 
ThW
@DaveRandom basic example: stackoverflow.com/a/23079179/2265374
 
I'm thinking I'm going to end up writing a SOAP client impl on the back of Amp, probably. I really don't want to, but it seems like the most robust approach
 
12:10 PM
then read with XMLReader and then use expand like @ThW wrote.
However I would use XMLReaderIterator ;)
 
@ThW Interesting approach, looks good, tnx
 
ThW
@hakre hehe
 
@hakre You have written this or are being facetious? :-P
 
@DaveRandom does both count as an answer?
 
:-D
Hmmm, could be trickier that i thought, XMLReader cannot be passed a stream, can only take a URI, so not compatible with non-blocking I/O
So I'm going to have to write a feature for PHP before I can write the lib in PHP :-S
 
12:14 PM
@DaveRandom you can pass a stream URL.
 
Yes but I can't make it non-blocking
 
and with some dirty tricks, it works with streams, have this in the XMLReaderIterator Package.
 
It should be relatively easy to make open() accept a stream resource, I think
Not sure how read() error handling would work though
 
@hakre Ahh, interesting idea
 
12:16 PM
it works with a static global variable in my case, registering a stream for a stream wrapper so to cut XML sequence files for the XMLReader.
 
I always forget about the userland stream thingy
That should be a proper interface/set of interfaces really
 
I have some flaw in the buffering, but for a poc this works.
 
ThW
php://fd doesn't work?
 
for my usecase not, but perhaps for @DaveRandom
 
@ThW There's no way to get the fd identifier for an arbitrary stream, afaik
 
12:18 PM
isn't the handle the fd?
 
(int)$stream gives you the PHP resource ID, not the fd identifier
And php://fd works with fd identifiers
Rendering it kind of useless
 
ThW
good to know
 
Really, the only thing you can use it with is 0/1/2 for stdin/out/err
 
ThW
and that's pointless, because of the named variants
 
Guys.Suggest me if there are jquery tables with calculations between inputs,to be used in PHP
 
12:22 PM
@DaveRandom php -r 'var_dump($argv);' <(echo "hello")
 
Wow, I don't even begin to understand that :-P
Why isn't that just on stdin?
 
@DaveRandom: The way I did it is the work-around I know. I solved this with a static/global variable. I don't love that style, but it's the way I managed to get it working.
@DaveRandom to use an anonymous fifo - so just not to use stdin.
 
@hakre Yes, it's hacky but it would work. However it won't work without Promise::wait() /cc @rdlowrey
@hakre is that what the parens do?
 
> <(command) expands to a file name that designates a pipe connected to the output from command, and >(command) expands to a file name that designates a pipe connected to the input of command. This feature is called process substitution. Its primary purpose is to pipe more than one command into or out of another
6
A: Bash: create anonymous fifo

GillesWhile none of the shells I know can make pipes without forking, some do have better than the basic shell pipeline. In bash, ksh and zsh, assuming your system supports /dev/fd (most do nowadays), you can tie the input or the output of a command to a file name: <(command) expands to a file name th...

 
@hakre
 
12:28 PM
@hakre Oh wow, that's pretty neat, also
 
vs7
any body experience with SugarCRM
?
I got an error while adding extra field in Leads Form
 
Hy anyone there?
 
@user2736704 yes
 
@ThW do you have any experiences with removing the $node from the document again? This would fill up the memory after some time if not removed, right?
 
Does laravel save userdata to the session?? @vas_bar_code
mean database fields like username,password etc
 
12:34 PM
I'm weighing up the amount of work involved here and how hacky it would be underneath and I think that async support (while doable) would just be too much work using the available userland options @hakre, I think that adding proper async support to XML reader would actually be less work
Which shows just how horrible this whole concept is
 
@DaveRandom XMLReader PHP extension is more or less a wrapper around libxml xmlreader. it's perhaps easily feasible, but my PHP internals / C knowledge is very limited.
 
sO if a person is remembered via (Auth::attempt(input::all()),true) then how would I get his name to pass it to admin page any time he access that page??
Like Welcome smit
How would I get his name from the session as in laravel session only storeS 4 things and these are something token etc...
 
@user2736704 you need to store the users information the first time user authorizes.
 
Should I add those values manually in session??
 
@hakre Are there any jquery tables with calculations between inputs,to be used in PHP?
 
12:42 PM
Can somebody help me with this: stackoverflow.com/questions/27583759/…
 
Bas
@hakre Hey man
I've come al ong way, can you please review my code?
 
@vas_bar_code these kind of questions I only answer on Fridays when I have my crystal ball.
@Bas oh noe :) rejoin the room from yesterday: chat.stackoverflow.com/rooms/67413/room-for-bas-and-hakre
 
Bas
Thank you, i keep losing the link to it, any idea where i can find it on StackOverflow itself?^^
 
@hakre Ok.thx
 
ThW
1:01 PM
@hakre I do not append the node to the document, so it gets removed by the GC
 
@ThW doesn't importnode does that?
 
ThW
Nope it creates a libxml representation for it, but it does not append it. So the only reference is the php variable.
@hakre remember the problems with nodelists? The errors because the internal objects are already destroyed?
 
@ThW have you started using nodeList[index]? :P
 
ThW
@FlorianMargaine Not yet :-)
@FlorianMargaine but node[index]
 
1:06 PM
Yo guys
    SELECT * FROM arepd_accounts LIMIT $limit OFFSET $offset

returns error. Why?
 
database?
 
ThW
@FlorianMargaine I implemented ArrayAccess on the element nodes in FluentDOM github.com/FluentDOM/FluentDOM/blob/master/tests/FluentDOM/…
 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 
Also amazing error
 
1:08 PM
@TomášAresakMalčánek mysql doesn't support offset
 
it's LIMIT offset, limit
 
as in LIMIT 0, 10, for example
 
@FlorianMargaine LIMIT [offset,] limit
 
1:08 PM
@ThW I see
 
@webarto heh, I've never omitted it...
 
:-)
 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 25' at line 1
for
$query = "SELECT * FROM arepd_accounts LIMIT $offset, $limit";
 
what's in $offset?
 
1:11 PM
why the fuck did I open reddit again .. reddit.com/r/PHP/comments/2q25pm/…
I never learn
 
string(39) "SELECT * FROM arepd_accounts LIMIT , 25"
There we go
No offset
 
@ThW Sure, however I always thought that when imported, internal objects do prevail. but now as I think of it, it would made no sense, because how to remove? There would be no method for that.
 
@TomášAresakMalčánek :)
$offset = $offset ?: 0;
 
Thanks guys for the LIMIT
 
Guy
hi guys
I have Yii question
 
1:16 PM
@tereško feeding
 
Guy
how to get executed query in yii
after $model->save();
like $this->db->last_query(); in CI
any one who's familiar with Yii?
 
@Guy here is a piece of advice: don't use Yii
it's shit
 
Guy
ok thanks
 
.. well, then again CI is a piece of shit too
 
Guy
1:21 PM
but now I need a solution for this
 
I am actually quite serious: I used Yii for a year - stackoverflow.com/a/10960679/727208
as for your original question: do you want to execute a native SQL query ?
or do you want to use CActiveRecord instance ?
 
Guy
it's CActiveRecord instance
see my code here
 
you probably could get to the quiry builder with Yii::app()->db->getCommandBuilder()
it might be storing the last executed query somewhere in it
 
Guy
after or before saving?
 
after
otherwise you will have to look for a way to enable query logging in your RBDMS
 
1:27 PM
@AlmaDo Heading out. Anyway, your problem was due to bash interpreting your back-references as its own variables, you need to escape them like \$1
 
problem with active record. @Guy, is that it's made of "magic"
it's a black box
when I was using Yii, I often ended up adding var_dump() calls all over the core classes just to track down some bug
 
Guy
@tereško : sorry it works
 
wat
 
Guy
thx
but you know I was trying the profiling the queries
but that didnt work
 
Guy
1:32 PM
@tereško : 'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'profile, error, warning',
'enabled' => true,
),
like this way
why that?
 
Seems you got a reply @FlorianMargaine . On reddit that is
 
no, I meant that you need to enable the logging on the database server
 
Though it seems he's uncertain of this own answer.
 
Guy
thats too
 
@Fabor yeah. I wanted @tereško to answer it :P
 
1:36 PM
Me too
 
fuck, guys, I need to get to a buss soon
 
although I guess it's about the DiC actually being a service locator, I'd say
 
yes, that's one point
 
another?
 
Guy
@tereško: Yii::app()->db->getCommandBuilder() this dosent show sql
 
1:37 PM
I don't know much about symfony.
 
@Guy no, it returns an object which is an instance of CDBCommand
 
@Ocramius Ping when you have some minutes please :)
 
Guy
@tereško: so how can I see the query
 
dunno .. try var_dump'ing it
 
Dont use š for start..
 
1:45 PM
I have never really needed such functionality
 
Guy
I did but no sql returning
 
@Guy then your best option is to turn on the logging on the database server
 
/me now has a triple monitor setup ready to go - and no computer to plug into it :-(
 
@FlorianMargaine wish has been granted
 
@tereško I don't get your 3rd point
 
1:56 PM
a lot of stuff in Sf2 need you to pass name of bundle (library) and/or class as string
which then is somewhere used to initiate a class
anyway, I am going mobile
 
.. don't ping me too extensively for next 2 hours
 

« first day (1528 days earlier)      last day (3414 days later) »