« first day (1631 days earlier)      last day (3332 days later) » 

1:22 AM
-3
Q: openssl_decrypt() Encryption in PHP convert to JavaScript

Josua Marcel ChrisanoI'd like to know about openssl_decrypt() function in PHP may i know the algorithm / pseudocode for that function? Because i need to change it to js format.

please help
 
 
4 hours later…
5:06 AM
Mornin' folks.
Although the room is asleep.
 
5:23 AM
Hello
 
5:34 AM
hello
 
 
3 hours later…
8:40 AM
@rdlowrey I've got the same problem, I've added some code to the issue github.com/rdlowrey/Auryn/issues/85
 
mogguh
 
@PeeHaa mogn
 
8:57 AM
is any of you using a macbook air for development?
 
@Gordon php development?
 
@PeeHaa yes
 
Nope sorry
 
I can get a MBA but it only packs 8 gig of RAM and an 1.4 Ghz i5 cpu
the alternative would be a MBP with more decent specs. But I am travelling so I'd prefer sth lightweight
thats why I consider the MBA
 
what should I use instead of ALLOC_ZVAL? :/ this macro does not exist anymore.
 
9:00 AM
Yeah I never take my mbp with me for that very reason. I might as well pick up my desktop
:P
 
@Gordon What about ASUS Transformer Book Flip TP300LD?
 
meh
I have begun to hate laptops
 
^ question up there :) //cc @bwoebi or @NikiC
 
@marcio nothing
 
@HassanAlthaf And which version of Auryn are you using right now?
 
9:04 AM
you can directly set the value
what are you trying to do in particular?
 
@VeeeneX not offered in this case
 
:(
 
@NikiC I'm working on the new patch for the CS lexer, now using the parser and I'm almost finishing (this was quite a piece of work). So I needed to add a zval * token_stream field on the _zend_php_scanner_globals struct...
but I'm having trouble to init_array(LANG_SCNG(token_stream))
 
@marcio you need a zval (without the *)
or, if it's always and array, just add a zend_array* (or HashTable*)
 
@NikiC humm ok, what is zend_array?
nevermind, I found the definition :) I'll remove the pointer, seems easier.
 
9:11 AM
@marcio an array ^^
you just use zend_hash_init instead of array_init with it
 
@NikiC BTW, after making token_get_all complain about syntax errors I noticed half the tests were using invalid syntax by mistake :D
I think that counts in favor of improving it.
 
@marcio um... but sounds like it could be an issue
Damn, I didn't even consider that
 
@NikiC if it's an issue then you will need to be less picky about github.com/php/php-src/pull/1158 :P
or we will have to give up the RFC forever (not for now, forever)
 
hah
 
why do you think it could be an issue?
 
9:16 AM
I have an alternative suggestion ... unreserve whatever comes after :: and function. That's trivial to implement, and covers the 95% case ^^
 
@NikiC nooope it doesn't work, it depends on context that only the parser knows
 
@marcio I suspect that people may be using token_get_all for other things than tokenizing php code
@marcio It does? I mean after all function and all :: regardless of context
 
@NikiC ::T_ and ->T_ are global rules, except for ::class on this point you got it right
but then we have declaration context:
 
At least I distinctly remember seeing people use token_get_all for lexing DSLs that are sufficiently close to PHP
 
@NikiC that shouldn't be covered as BC break ^^
    class SomeClass {
       const class; // should not work
       function function() { //should work
          function function(){} //should not work
       }

      function continue(){ // should work
          return new class {
              const continue; // should work
              function function... /// here we go again
         }
     }
    }
    // outside class
    const CONTINUE; // should not work
    function continue(){} // should not work
 
9:21 AM
@marcio So, I'm ignoring constants because of the ugly comma notation, and nobody wants those anyway
And I don't have a problem if it works outside of classes - if we want, we can explicitly blacklist reserved words at compile time
argh fuck. looks like this debugging error is not for debugging after all
 
@NikiC that's a lot of compile time stuff
 
@marcio just a list of keywords
 
hi guys :)
 
@NikiC I don't know exactly why this will not work, I tried it before on another discarded patch and there was a situation that was a dead end but I can't remember
 
iirc hhvm does this for hni files
 
9:28 AM
question: is it normal to be unable to override a method defined in trait by calling parent::methodDefinedInTrait()?
 
@NikiC at this point, if you'd like to work on a concurrent patch doing that it would be nice... I don't even have the branch with this approach anymore \o/
oh and you already started the trend to throw exceptions from token_get_all, no one complained about it.
@NikiC ok I remember, it was the const list syntax and the impossibility to expand later to class names.
 
@fusillicode you will need to:
use B { saySomething as aliasedSaySomething; }

public function saySomething(){
     echo 'hi';
     return $this->aliasedSaySomething($something);
}
 
@marcio as I taught
 
@fusillicode because trait B is horizontal reuse and won't be parent of A
 
9:38 AM
u're right I was just wondering :)
 
@fusillicode or you can make the trait execute a beforeSaySomething() method in case it's defined (this is nicer).
 
uhm
 
just check if the method exists on the trait, before echo $something;
 
so u're suggestion is to implement an hook in the trait right?
 
yes, if the class that is reusing the trait has beforeSaySomething() defined you run it before echo $something;
 
9:41 AM
this is an approach I didn't take into account, let me try it :)
@marcio anyway...ty for the support ;)
 
;)
LOL not funny :(
LEAK&FAIL Bug #54089 (token_get_all() does not stop after __halt_compiler) [ext/tokenizer/tests/bug54089.phpt]
LEAK&FAIL Bug 60097: token_get_all fails to lex nested heredoc [ext/tokenizer/tests/bug60097.phpt]
LEAK&FAIL Bug 67395: token_name() does not return name for T_POW and T_POW_EQUAL token [ext/tokenizer/tests/bug67395.phpt]
LEAK&FAIL Test token_get_all() function : basic functionality [ext/tokenizer/tests/token_get_all_basic.phpt]
PASS Test token_get_all() function : error conditions [ext/tokenizer/tests/token_get_all_error.phpt]
 
9:57 AM
@marcio just converted fatal errors to exceptions there ;)
I'll also convert the warnings though. warnings that don't go through the error handler really suck
 
I'm creating new fatal errors and converting to exceptions, that should count :3 (dat logic)
well, if it's too much issue better drop the patch before finishing it
 
@marcio Not sure if it's too much of an issue
 
though I think that crazy people using token_get_all to tokenize ruby or wathev should be stabbed.
// me goes write an entire parser with serialize() unserialize() and expect long term support
 
@marcio Don't even need to go to ruby or dsls, could just be lexing an incomplete PHP snippet
like say, lex just a method
isn't entirely unreasonable, but syntax check would bark on the modifiers
 
@NikiC a method without context is just a normal func... ohhh, that's bad.
dang, who got the idea of exposing nude tokenization to userland? this was a dumb move.
 
10:06 AM
:D
 
ok so I'll put the finished patch on the mailing list and wait for the "evaluation" if it doesn't pass, it wasn't for the lack of efforts.
@NikiC who is tokenizing code snippets? do you have an example on github?
strange... if I run the test with mem leak check it passes, if run without the check I get:

Script: 'ext/tokenizer/tests/bug26463.php'
Zend/zend_string.h(97) : Freeing 0x7F52E5259440 (32 bytes), script=ext/tokenizer/tests/bug26463.php
Last leak repeated 4 times
 
10:21 AM
Can anyone recommend a very lightweight, simple PHP framework that has decent support and documentation?
Symfony, Cake and Zend all seem fairly comprehensive and a bit OTT for my needs
 
@James Just grab some packages you need and write code
 
@PeeHaa Im just looking for something which will help with things like database connections rather than having to write it all myself.
 
@James There is PDO for that
new \PDO() is all you need for database connections
 
@James if you really want a framework, slim is not bad.
 
@PeeHaa I'm not familiar with PDO's just reading this now though:

http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059
 
10:24 AM
> Slim has super-secure cryptography using military-grade encryption.
lol everytime I read that I wonder what military grade actually means
 
@PeeHaa This looks realyl useful thanks. Is this now considered 'best pracctice'?
 
@James yes
 
@PeeHaa lol marketing is the opposite of engineering
 
@marcio :-)
 
 
1 hour later…
11:45 AM
hi
 
12:17 PM
@marcio concerning the solution u suggested me earlier this morning, the check about the existence of the beforeGetContent() method could be avoided by simply declaring an empty method with the same name inside the trait. Am I right?
 
@fusillicode sure, since you can overwrite trait methods this is also an option :)
 
@marcio ty a lot ;)
 
@fusillicode (you can [tab] + [space] instead of [return] to put the @ user name and avoid sending the message prematurely)
 
ty, I know I just made the same mistake 2 time in a row XD
 
:P
 
1:08 PM
0
Q: A PHP User System

Hassan AlthafThis PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer. Here is my source code: User.php (Controller File in the src/Controller) folder. <?php namespace Application\Controllers; use...

 
Why are you using mysqli instead of pdo and why are you binding ids as string?
 
I used MySQLi because I'm sort of more comfortable with it.
 
That's something you don't hear everyday :P
 
Just kidding.
I did this for a client
He wanted me to use MySQLi
but I decided to create a sort of a module out of this
So that I don't have to code this again and again
And make this very flexible.
 
Imo you should really set the cost of passhash
Also you should check whether a rehash is needed on successful login
 
1:12 PM
Hey PeeHaa, why don't you write a top-notch answer for me? :P
 
I just did :P
;)
 
Altered the question a bit.
I don't see any. >:(
Write a long ass answer for me PeeHaa. :P
 
lol
ur lazy :P
 
;)
 
1:15 PM
I am having naughty feelings, any program to fix it?
I tried this so far:
$feelings->clearNaughtyFeelings();
but failed.
crap, i potted the black ball in. :(
Looks like I'm gonna code something in Java. :D
 
@HassanAlthaf I don't like "session_start()" in isUserOnline
 
Uh, can't read session variables without it. :
 
you only need to start the session once
 
2:13 PM
@PeeHaa no problem - "@TomášAresakMalčánek tnx :P"
:D
It was on your bday
You helped me a lot in many things so I wish you good luck in the next year ;)
 
2:29 PM
@HassanAlthaf you should push so much application logic in the mapper
instead most of it should be handles in a service layer
especially things like session handling
 
@tereško Aye, Aye, Sir! An answer to that question would be highly appreciated.
 
I am too lazy
 
2:47 PM
besides
I have written about this all mvc-ish crap already way too much
 
I wasnt using MVC
lol
 
@Ocramius you could have asked me whether it's worth watching
that would have saved you some considerably distress
 
 
1 hour later…
4:13 PM
#fail http://3v4l.org/6oqYN
abstract class FooBar implements Traversable{}
Class FooBar must implement interface Traversable as part of either Iterator or IteratorAggregate
god i hate markdown
@LeviMorrison ^
 
@Worf "Abstract base interface that cannot be implemented alone. Instead it must be implemented by either IteratorAggregate or Iterator."
Because PHP.
 
yes, but FooBar is abstract @Danack
class FooBar implements Traversable{} -> error, makes sense
abstract class FooBar implements Traversable{} -> Y U SO PEDANTIC
 
> Listen, and understand. That PHP is out there. It can't be bargained with. It can't be reasoned with. It doesn't feel pity, or remorse, or fear. And it absolutely will not stop, ever, until you have implemented IteratorAggregate or Iterator.
3
Tbh - I might be wrong. But I think there's a special case for checking that interface.
 
@Danack lol
 
4:25 PM
yeah but check should be performed in concrete classes, not abstract, amirite
 
it's an ugly hack, so it's hard to think logically about it. But no (I think) there are checks done at compile time, for classes to be correct. In this case if you had class ConcreteBar extends FooBar{} there would be nothing to check, without having a different special hard-coding of rules.
aka shits fucked up yo. It was a dumb hack, that is biting people, and it probably shouldn't have been done.
 
 
2 hours later…
6:23 PM
 
?
 
6:35 PM
 
7:00 PM
@Charles Yes, capturing groups are not supported (supporting them is a bit tricky and it doesn't really make sense for the routing use case). I've now added a check so you get an exception if you use a capturing group instead of things breaking in weird ways
 
7:49 PM
Hey, anyone using phpdbg? How do i step over a line of code? If I have step 1, it tries to step through each function from the line it's trying to execute
 
8:08 PM
@Andrea what did confuse you ?
 
Hi
Hoping someone can help me, I've tried researching and Googling' how I can do this.
http://pastebin.com/Av345f8q
I'm trying to get the number in value="X".
 
@RahulKhosla nope
@RahulKhosla try action instead of actiton
 
@MarcelBurkhard Thanks, sorry for that. Still didn't work though. Any ideas?
 
@RahulKhosla well, whats the output of print_r($_POST); ?
 
@MarcelBurkhard that seems to echo the correct value!
 
8:22 PM
good, so your problem is somewhere else
 
It seems so!
 
8:38 PM
Still stuck haha
 
8:57 PM
@Worf What about it?
The fact that FooBar cannot delegate to its sub-classes which inteface to use?
 
user3961151
Hello
 
user3961151
I'm having problems with FormData
 
user3961151
 
user3961151
Why $_FILES empty?
 
Is it anyhow logic that my Drupal site went from 20 MB in SQL to 700 MB, in 2 days; without changing to much?
 
9:40 PM
Problem solved: Database Optimization @ drupal.org/project/optimizedb.
 
Anonymous
10:04 PM
@GINCHER check your html <form> syntax, if it is correct
 
10:18 PM
[very-ot] can anyone just check if soundcloud is working for them plz? (Just try and play something)
 
Anonymous
Link?
 
@DaveRandom Hey, long time!
 
Ugh, on mobile, hard to type
Hey @RahulKhosla :-)
 
Help me out? I'm stuck for 4 hours!
 
Minute gonna fire up laptop
 
Anonymous
10:19 PM
Its working 4 me
 
@DaveRandom works
 
Anonymous
Tried that one
 
pastebin.com/LaEDQzp2 WHAT AM I DOING wrong?
 
ffs, I think BT are choking my "media" access
 
10:21 PM
The DB won't update...
 
right, have real keyboard, will look at it now @RahulKhosla
 
Thanks!
 
ffs, real keyboard batteries dying, also had to type, minte while I find some fresh bateries
gdi
*hard, minute, *batteries
:-P
right, really here now
 
That moment when whole world is against you. ^
 
@RahulKhosla so firstly. you problem is that the submit button doesn't have name="submit", but secondly (and more importantly), don't mix HTML and logic like that
Esp. with POST
PRG <-- important
 
10:28 PM
@DaveRandom I still need to clean the POST I know !
Thanks!
 
@RahulKhosla It's not about that, it's about maintainability. Separate your business logic from your presentation logic.
Separation of concerns <-- much more important
 
Hmmm
Hmm I don't really get that, I'm still bad at this!
You mean use some sort of db_functions file?
 
The point really is that the code block you show does two very distinct and very different things, and those two things should live in separate places
So instead of having the code that displays the form and the code that processes the form in the same place, you should have two "pages".
 
So two "files"?
 
It's especially important with POST, because it "breaks" the back button for the user
@RahulKhosla Yes. You should have a template file for displaying the form and a business logic file for processing the submission. Usually you should then issue a 303 redirect after you've processed the form to send the user to the next thing they see.
 
10:34 PM
Ok thanks @DaveRandom! Big help!!!
 
It doesn't necessarily have to be two files (although usually it would be) but you shouldn't mix HTML and PHP code like that - it's OK to have PHP code in your HTML templates, but that code should be idempotent (it should have no side effects other than maybe logging) and it should only be there to help you display dynamic content.
I highly recommend you read both of those articles I linked, if it doesn't go in then don't worry about it, just go away and do something else and then come back and read it again until it does go in
Mostly you find in this kind of situation that every time you read it you understand a little bit more, then one day you read it and it suddenly all makes sense
This is true of almost anything related to science and technology (it's really deep rooted in the whole point of the scientific method)
Side note: (also quite OT) everyone should listen to bbc.co.uk/podcasts/series/timc
 
Time is money.
 
@sam_io Yeh, still nothing doing for me, I think BT are screwing me :-(
 
Although I'll read it!
 
Which is interesting because unencrypted bittorrent they seem to have no issue with
And I do several GBs/day in that, I do no more that a few hundred MB/day in streaming
 
Anonymous
10:40 PM
@DaveRandom first make sure you have audio turned on :p
 
@RahulKhosla Yeh, you put time in, you get money out. It's not an instant process though, you want that then go into banking. Although of course, of you go down that road, you'll have to live with being a cocaine addict and generally being a massive bell end.
@sam_io I wish :-/
My current job involves occasionally having to get involved with end-user support, it is surprising that I can still be surprised by people's stupidity...
And also, people never cease to amaze me with their facility for finding new and interesting ways to break shit
Related: I'm really going off some parts of Agile
Certainly for small (< ~100) teams
It seems to be producing a bunch of paperwork and people standing around talking about project meta and not enough time doing, y'know, work
/cc @Gordon ^ would like to discuss with you at some point because you seem to be quite experience at PM
</monologue>
 
@DaveRandom oh yeah
I had to chance to have a glance at some support stuff
some user was having a command not working... we asked him for a copy paste of what he typed. command foo [--arg1=bar [--arg2=baz]]. With the square brackets.
4
 
instastar
Still, a least they R'd TFM
The number of times I've had people come to me with "an error" and they've clearly not read it because it tells them precisely what the problem is and what to do about it
hmm, kbd may be a bit broken
 
10:58 PM
What's wrong with this, sorry for being so questioning:

"SELECT * FROM product WHERE 'condition' = 1 AND option_1 = :optionOne OR option_2 = :optionTwo OR option_3 = :optionThree OR option_4 = :optionFour"
 
@DaveRandom yes. Yes it is.
 
Oh sweet @JoshWatzman is here: if you could possibly pass this on to people in the know of this specific area, I've got a pretty stable module for authenticating against AD and pulling down a for bits and pieces of data, I've found on HHVM I sometimes get a "false negative" return value from ldap_bind() (bind worked but returns false). Also if you could implement ldap_modify_batch() in HHVM would be v. appreciative.
Can provide more info (and possibly contribute code) when back from hols/more sober
Will open bug, in fact
 
@Andrea sometimes HHVM crashes xD
 
@RahulKhosla Probably precedence, i.e. use brackets to group things
 
How so
 
11:03 PM
@FlorianMargaine Meh, self also a bit broken, poor workman blames tools etc
 
@DaveRandom go sleep
 
@RahulKhosla mix "and"s and "or"s can have more than one interpretation. Consider if (a && b || c) vs. if ((a && b) || c) vs. if (a && (b || c)). The first means one of the other two, but it's ambiguous (to the reader). As general rule in anything to do with computers, be as explicit as possible.
 
OHHH
 
@FlorianMargaine probably a good idea. But by the same token, if I go to sleep now you should be asleep an hour ago :-P
 
11:06 PM
I get it, like math? 2/(4x4)
Rather than 2/4x4
 
Precisely
 
@DaveRandom I'm not tired though, all the letters still appear
 
@DaveRandom That still didn't work. http://pastebin.com/KZ1uurNW
"SELECT * FROM product WHERE 'condition' = 1 AND (option_1 = :optionOne OR option_2 = :optionTwo OR option_3 = :optionThree OR option_4 = :optionFour)"
 
@FlorianMargaine Maybe they do, but maybe you're not reading them right. Maybe you're talking nonsense. Maybe you're not even really here. Maybe both of those things are true. Maybe neither of them are true. Maybe I shouldn't have spent an hour reading articles on quantum physics after going to the pub.
@RahulKhosla oh wait... 'condition' = 1 <--- remove the quotes
 
condition is a taken term????
 
11:11 PM
/me should really go do some washing up
 
in SQL
 
No, but you have use the wrong kind of quotes, that's taken as a string literal, not an identifier
 
@DaveRandom go sleep
 
:-P
 
@DaveRandom Removed all the condition stuff, and the AND; and the ()s.
I think it's the execution part.
 
11:13 PM
Am going to go do some washing up and then go to bed
@RahulKhosla If you're still stuck by then, will be back on tomorrow eve (probably)
 
Ok thanks, @DaveRandom You've helped a lot today.
 
11:30 PM
Anyone got any ideas on how to return the highest match on the options?
"SELECT * FROM product WHERE 'condition' = 1 AND option_1 = :optionOne OR option_2 = :optionTwo OR option_3 = :optionThree OR option_4 = :optionFour"
 

« first day (1631 days earlier)      last day (3332 days later) »