« first day (1412 days earlier)      last day (3529 days later) » 

12:00 AM
require_once($path);
if (file_exists($path)) {
       require_once($path);
}
the first reuire works fine, the file exists
but the secondone does not run because of the condition
does anyone have idea why?
the file is there for sure, it exists
path looks like: folder/file.php
 
@derp I know, in this context it's is not right, but I used it in a different way
if (file_exists($path)) {
       require_once($path);
}
like this
the first row is there for testing purposes only, and somehow it can include the page, but the condition returns false
 
12:54 AM
@KissKoppány What do you expect this code to do?
 
1:09 AM
Oh whiskey. Much solution. Such problem. Wow.
 
1:19 AM
Sometimes, when I lurk here reading, I yearn for the days of "hai guiz, how can i include files?"
 
Oh dear god
I wasn't going insane
is_long really isn't an FALIAS
I was going completely nuts
is_integer, is_int and is_long are supposed to be THE SAME FUNCTIONS
But they're not
Why? Because the Zend engine specifically handles is_long specially
 
is_special_snowflake
 
php_is_a_beautiful_and_unique_snowflake
 
Adding warnings everywhere
so people will never make same mistake
"Warning: This function is special-cased by zend_compile.c and so is usually not actually used"
 
Why does it handle it differently? Overflow?
 
1:27 AM
Hi guys, how to detect the lost connections in websocket ?
 
@DanLugg Performance
 
I'm using stream_select($changed_sockets, $write, $except, 0, 5000); to detect changes to the sockets
 
If you type is_long(foo) it doesn't actually call is_long
It compiles a special long typecheck
However, the bastard who implemented that check decided not to note in the function itself that it's usually bypassed
 
So, it'll only call it if a valid PHP integer is passed?
 
but when i disconnect internet on android I don't have any changed_sockets ?
Internet browsers works good
 
1:29 AM
@DanLugg No, it's never called
 
Oh.
 
It'll only be called if you use it as a callback
 
:-|
 
It's a bit like pow()
 
** now ;-)
 
1:30 AM
Which since 5.6 is an operator, so you never call the actual pow function unless it's a callback
 
But there isn't an operator for is_long. If I call is_long($noodles), what happens?
 
@DanLugg It compiles it to a type-checking opcode
 
Ahhhh, right, those special cases.
 
Rather than a function call
 
Doing call_user_func('is_long', $noodles) however, will invoke the function.
 
1:33 AM
@DanLugg Right
Seriously, though, I'm mad at whoever implemented this. It's deceptive.
Not that they implemented, that's fine. I hate that they didn't mention at the definition of the function that it's usually bypassed.
 
@ircmaxell Done!
@AndreaFaulds Understandably. Interesting though, I had completely forgotten about those optimizations.
 
I had no idea they existed until today
 
I recall them, from when Joe was working on an opcode analyzer.
Mind you, recalling them is pretty much where my understanding of their implementation ends :-P
 
where are the error logs stored in a typical Linux server with apache?
 
@DemCodeLines /var/log/apache
Or something along those lines
 
1:42 AM
no apache folder
 
@DemCodeLines httpd? apache2?
 
httpd is there with an error_log file in there, but it's empty.
That can't be the right one, since I remember looking at the error file to fix a PHP issue a couple of days ago and the file had a well over 10,000 lines in it.
 
Please guys I need help, though connection gone ( Internet disconnected ) ,
stream_select($changed_sockets, $write, $except, 0, 5000); return empty $changed_sockets array ? :(
 
user895378
@crypticツ You won't have to do anything with newer versions of artax. It will "just work." If you're working with an older version you'll need to upgrade if you want to use the client with 5.6
 
1:52 AM
I love those upgrade paths :D
 
Wait, I'm an idiot, probably wasn't Nikita who did that
 
eh?
wow, why does opcache use ereg?
 
2:58 AM
@rdlowrey Do it do it do it! :)
@AndreaFaulds I'm just an ordinary guy .. also, NSA doesn't like accidental heroes, try to keep it to yourselves lest I'm being asked to put naughty stuff into Zend ;-)
 
 
1 hour later…
4:18 AM
urgh... a codebase with loads of if ($errorMsg == '') {. Makes me wanna cry blood :'(
 
That's horrific ... both, but mostly the former.
I think this answer needs moar +1's :)
The accepted answer is just really wasteful.
 
vs7
5:10 AM
Hi
@jack @AndreaFaulds screencast.com/t/aEx5oalpgI
 
hah.... i got upvoted thrice for an answer i don't even remember having answered.... it took so long to get upvoted... somtims i don't understand anything
 
user652649
morning. guys where would you host a blog about coding? that has code highlighting and things? tumblr? ghost? blogger?
 
devchix
:D
 
@WesleyCrushed github pages
 
do it at SO maybe.. one of those self-answering questions
 
user652649
5:16 AM
@Ocramius forgot of that! seems that's the best option
 
@WesleyCrushed consider checking sculpin
 
user652649
never heard of it
 
yesh, github pages are fancy
btw, has someone used emacs24?
 
@WesleyCrushed I'm converting my blog to that
 
Goooooooooooooooooooooooooooooooooooooooooooooodnight
 
6:13 AM
Morning
 
6:32 AM
posted on August 28, 2014 by kbironneau

/* by bgallagh3r */

 
Hello good morning
 
I am developing a web service for an android application and for that website has been already developed in WordPress so now if the user has signup from the website then can login from the android app an if they has signup from android app then they can login from website also but as i know that WordPress uses a special type of function to decrypt the password
how can i use that function so that i will get the same password after decryption whether it will be from WordPress website or from my web services i am developing the web services in core php
 
7:01 AM
i don't think password should be decrypted
 
@blackbee not in normal cases, at least
 
Hello All, i need one help with Wordpress.. Is there anyone who can help me ?
 
isn't the the rule of thumb , to encrypt the password using the same format used during signup and then match them with the one stored in the database?
 
unfortunately I have worked on projects where it has been necessary, because the password was then used by another part of the intranet (internal system, in a insurance provider's setup)
 
ow
 
vs7
7:03 AM
any php function which can do encryption and decryption ?
 
morning
 
vs7
@Milap whats the problem ?
 
@vs7 let's put it this way, you should never encrypt/decrypt passwords in an openly visible system (like a public website)
 
I am using Wordpress, added one insert query in theme's functions.php , but it inserts multiple records into database
 
vs7
Some one ask me question in interview, is there any Encryption /Decryption ...
I answered SHA1 :P
 
7:06 AM
can bcrypt-ed passwords be decrypted? i read that it uses Blowfish ciphers . and ciphers unlike hashes are two way function, i mean can be encrypted as well as decrypted
 
meurning
 
@vs7 you did not get that job
 
vs7
it should be in a loop
 
@vs7 What did the interviewer respond? Or wasn't it a job interview?
 
vs7
@tereško They told me I'm ok , but gave me low salary
 
7:07 AM
ugggghhhhh morning
 
This is my code
 
lol, I would have ended the interview at that point and asked you to leave
 
u really didnot say SHA1
 
@vs7 "hashing" != "encryption"
 
but there can be a possible explanation why he got the job. like md5 , sha1 can be cracked with rainbow tables with enough computational power .. (hypothetically) .. maybe the interviewer speculated he is a great guy...
 
7:11 AM
hypothetically?
 
i don't want to de-mean .. but i think that explanation is funny
 
I don't think you know what that means :P
 
u are right.. hypothetically
 
Also bruteforce FTW
 
i has hard time explaining things to people
 
7:12 AM
@blackbee $foo = md5('but there can be a possible explanation why he got the job. like md5 , sha1 can be cracked with rainbow tables with enough computational power .. (hypothetically) .. maybe the interviewer speculated he is a great guy...'); returns "524338df2ce7d1dfa99b43d0250f9861" ... so, are you a fucking idiot ?
 
vs7
@tereško Ya I told them MD5
sha1
 
how does a hash determine if i am an idiot or not
 
vs7
when i see the facial expression of the interviewer , I gave him lots of option sha16 , md5
 
how can i be a "fucking idiot" when i know that sha1 is an one way thing...
 
because you are implying that hashing is not only reversible, but also has compression properties
or that interviewer thought so
 
7:15 AM
o, no that's not what i meant..
i should have said brute-forced
 
you cannot prove that bruteforce gives you the original input
... also my spelling is shit today
 
moreover, there are multiple different inputs that give you the same output
especially with md5
 
but i don't need the original input, i need a text which when sha1-ed gives the same hash output.. but i don't know , if that is how bruteforcing happens with sha1
 
> Bailed out without a bailout address!
hmm
 
i am a slow learner, but i am not an idiot ... i am trying hard not to be an idiot ...
 
7:19 AM
@blackbee if you are attempting to use sha1 for encryption, then you need to get the original input
 
I have a naive question; what's the best way to ensure that only strings are passed to my function?
 
@iroegbu java
 
@iroegbu array_mult(array_map('is_string', func_get_args())) == 1 :D
 
so sha1 unlike md5 doesnot have hash collisions!!
 
lol
 
7:20 AM
wut
yes they have
 
vs7
@tereško I explain him how i can compare the things : codepad.org/7ezsKtwe
 
the amount and, what is more important, frequency of collisions is mostly based on the length of the output
 
then why do i need the original input?
 
@blackbee I would venture a guess that any 33 symbol string will have at least one collisions in sha1
... or was sha1 40 symbols and not 32 ?
 
@blackbee, encryption and hashing are two different things. encryption can be reverted (decrypted), but hashing cannot
 
7:22 AM
@SergeyTelshevsky that i know ..
 
2 mins ago, by blackbee
so sha1 unlike md5 doesnot have hash collisions!!
 
function foo($aString)
{
    if (!is_string($aString)) {
        //throw exception
    }
    //other things
}
 
^^ this tells us the opposite
 
40
 
seems like too much work for something this trivial
 
7:23 AM
@blackbee and md5 and sha1 are both hashing functions
 
@iroegbu why is it important that it's a string?
 
say, function will fail if it isn't.
 
how so?
then again, nothing is stopping you from writing your own assert() function.
e.g. real_assert() .. that will do it :)
 
you don't want a function for that ...
 
ssshh
actually, it would be nice if you could have an .ini setting that would nullify asserts
 
7:27 AM
@SergeyTelshevsky yes!! i was saying that like md5 , sha1-ed passwords can also cracked .. with enough computation power. i mean , pff.. i don't know how to put this
 
srsly though, the way objects work provide an excellent way to implement assertions that have near as makes no difference has no impact when disabled ...
 
vs7
So sha1 and Md5 is one way encryption
 
yes
they are hash algo
 
vs7
than what will the function for two way encryption / decryption
?
 
@blackbee "cracked" is a bad word to describe that
 
7:28 AM
@vs7 hashing*
 
i agree to that @SergeyTelshevsky , just that i didnot realize that .. :P
 
@vs7 AES for example
 
caesar cipher :D
 
@vs7 most frequently used in web
 
@blackbee passwords are hashed with a password hash, and sha1(), md5(), etc. are not password hash functions.
 
7:29 AM
309
A: Fundamental difference between Hashing and Encryption algorithms

ircmaxellWell, you could look it up in Wikipedia... But since you want an explanation, I'll do my best here: Hash Functions They provide a mapping between an arbitrary length input, and a (usually) fixed length (or smaller length) output. It can be anything from a simple crc32, to a full blown cryptog...

 
vs7
So there is not default function for encryption and decryption
 
@vs7 there is, it's called mcrypt.
136
A: How to encrypt/decrypt data in php?

Ja͢ckForeword Starting with your table definition: - UserID * Fname * Lname * Email # Password + IV Here are the changes: The fields marked with as asterisk, Fname, Lname and Email will be encrypted using a symmetric cipher, provided by Mcrypt, The Password field will be hashed using a one-way p...

 
@vs7 no default, but as I have said, AES algorithm
 
<?php
define("DEBUG_ENABLED", 1);

class AssertionException extends Exception {}

if (DEBUG_ENABLED) {
    class Assertion {
        public function __construct($expression, $message = "assertion failed") {
            if (!$expression) {
                throw new AssertionException($message);
            }
        }
    }
} else {
    class Assertion {}
}

new Assertion(1 < 1);
?>
 
7:31 AM
aes aka rijndael-128
 
[joe@localhost php-src]$ /opt/php/master/zts/debug/bin/phpdbg -e../assert.php -v
[Welcome to phpdbg, the interactive PHP debugger, v0.3.2]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://github.com/krakjoe/phpdbg/issues>]
phpdbg> r
[Attempting compilation of /usr/src/assert.php]
[Success]
[L2       0x7fdbea819990 ZEND_SEND_VAL                  C0                   <unused>             <unused>             /usr/src/assert.php]
[L2       0x7fdbea8199c0 ZEND_SEND_VAL                  C1                   <unused>             <unused>             /usr/src/ass
 
vs7
@SergeyTelshevsky than mcrypt what is that ?
 
@Ja͢ck in the link ircmaxell says " full blown cryptographic hash function such as MD5 or SHA1/2/256/512:"
 
@blackbee please read ALL THE WORDS
 
7:33 AM
@blackbee what about it?
 
gods below, I will have to add this user to ignore list
bye bye
 
@vs7 mcrypt is a library with functions for encrypting/decrypting data that may use any of the algorithms provided: php.net/manual/en/mcrypt.ciphers.php
 
ignore list!! who? me?
 
another one bites the dust
 
^ (: sweet times when Freddy was alive ..
Good morning
 
vs7
7:36 AM
Thanks everyone @tereško @Ja͢ck @SergeyTelshevsky @blackbee

Now i can face the similar questions in my next interview .
 
@vs7 oh no you can't
 
@SergeyTelshevsky lol
 
vs7
@SergeyTelshevsky why so ?
 
@vs7 , you are approaching this from the wrong direction. You seem to be focused on faking the experience =/
 
vs7
Actually My Working background is JSP so dont have much exp. of PHP and from last 2 year i started over php --- With Wordpress and CI
I know I approach the things directly, even knowing the base ...
 
7:41 AM
> I have a student who likes to wrap large sections of code in curly braces...
> ... I understand that variables declared inside braces have a limited scope
0
Q: Superfluous curly braces

jnitram78I have a student who likes to wrap large sections of code in curly braces so he can collapse those sections in the code editor. Initially I balked at it, but couldn't think of a legitimate reason not to do it. I understand that variables declared inside braces have a limited scope, but outside of...

 
@vs7 encryption, decryption and hashing functions are not php specific, or any language specific
 
vs7
ya i know
but in interview i need to answer according to PHP
I know the basic concept of encryption
 
Morning.
 
if the interviewer asks that it's most probably required for you to at least understand how they work, if you fake that, you are lying, so it's better to say that it's out of your scope of proficiency, than to get a task of implementing a security feature, fucking that up and getting charged for that
@vs7 most probably reading at least a couple of articles about the topic would be enough to get a better understanding
 
vs7
@SergeyTelshevsky absolutely true
I have developed one security feature but with this approach : codepad.org/7ezsKtwe
 
7:52 AM
Morning
 
@vs7 implementing something doesn't mean you understand how it works. can you explain to the interviewer if he asks why can't the $akey be decrypted?
 
vs7
No as its not possible
 
@vs7 He's asking why it isn't possible.
 
vs7
We can't decrypt MD5
 
@vs7 And why's that?
 
7:55 AM
@vs7 I'm telling that to you because if the interviewer will be convinced from the answer that you know that it's ok, but if he will have the slightest doubt about your understanding, he will ask you about that. If he won't ask that, then it's probably not the best job there is
 
because i can't understand why wud teresko put me in the ignore list
 
@blackbee Don't feel too bad, he puts a lot of users in his ignore list, and to be honest, until not that long ago, you were in my list too
For starters, you can stop using "wud"
 
:(
today is a very bad day.
 
vs7
@SergeyTelshevsky @SecondRikudo you are right
than im unable to answer
further more
 
@Jack did you see laurence refuse to give ajf zend karma ?
 
7:59 AM
you're not at an interview currently, go study, your understanding of this extremely important topic for the position of the developer is about two hours of reading away
 
@vs7 If I tell you the length of a string
Can you tell me what the original string was?
 
vs7
@SecondRikudo Never
 
@vs7 Why?
 
vs7
It will be 0.01% chance
only do with brute force
 
8:00 AM
Why can't you tell me what the original string was?
10
Why can't you tell me what string I have that has a length of 10?
 
vs7
than i can
 
@vs7 Okay, what string I have with a length of 10? :P
 
vs7
I need to create a function which will compare single character combination
:P
 
You can't tell what the original string that I have is.
That's because there is more than one string that maps to the same length
 
vs7
yep
 
8:03 AM
My string could be aaaaaaaaaa, It could be madararule
 
Any good reading resources on BDD people know of?
 
This is a hash.
md5 return a 128-bit number
That's a number somewhere between 0 and 340282366920938463463374607431768211455
It's a huge number, but it's finite.
There are only 340282366920938463463374607431768211456 possible hashes
(with MD5)
 
vs7
:P
 
But there's an infinite number of strings that you can input to MD5
 
vs7
That is why we can decrypt MD5 as need to use 340282366920938463463374607431768211456 comparison
 
8:06 AM
no
that is what rainbow tables are doing
 
@vs7 You can't decrypt MD5 because the same MD5 hash can apply to a lot of strings
 
the point of cracking a password is to get the original string
 
vs7
ok got it
 
Just like there are a lot of strings with a length of 10, there are a lot of string with the MD5 hash of 0421008445828ceb46f496700a5fa65e
Which is why you can never decrypt md5
 
so if I get your password from SiteA, I could login as you on SiteB
 
8:08 AM
You can brute force/rainbow table into finding one string that matches a given hash
 
^ one or more strings
 
@SergeyTelshevsky One is plenty :P
 
vs7
but there will be lots of combination for that string
 
If your password is "foo", and I found "bar" that matches the hash, I don't need your "foo" anymore.
@vs7 Yes
 
@JoeWatkins yeah, i did ...
 
8:09 AM
But don't forget who usually generates passwords
Human brains.
Do you know what's the most common password in the world?
 
I don't get that ...
 
vs7
admin
 
123456
 
are we still at it ?!?!?
da faq
 
not sure why ... i didn't ask for mine actually .. it was bestowed upon me lol
 
8:09 AM
me too
 
@tereško :)
 
Peoples card pins are pretty simple too. 1234 1111 etc.
 
this encryption conversation is actually really intresting :)
 
I always say the pin isn't the secure part. The secure part is me :P
 
vs7
@SecondRikudo ya true
 
8:11 AM
stackoverflow.com/questions/25542701/… - that's why they say "idiots are so ingenious"
 
@Naruto sure it is, but the current "discussion" could have been avoided, if @vs7 had bothered to visit wikipedia
 
@vs7 So most attacks don't aim at cracking the hash
Most attacks aim at guessing your password
Either by bruteforce or by ranbow table
 
vs7
yep
got it
@tereško I am done
 
@tereško Well wikipedia doesn't mention some stuff some people say here.. Which are first hand experiences etc.. :)
 
vs7
@SecondRikudo Thanks to illustrate me md5 basic working
 
8:14 AM
morn
 
@vs7 correction, hashing in general, not md5
same applies to sha
@vs7 this is a great site for searching for the information about security, encryption, hashing:
 
^ looks suspicious
 
Guys I saw alot of website similiar to StackExchange. Is there a way to make your own?
 
@AlmaDo why?
 
@SergeyTelshevsky because.. looking to the logo I can't get rid of the thought that it's NSA watching me behind the screen :p
 
8:22 AM
well... it's part of stackexchange and the information is all openly available :) but I get what you mean
 
(:
 
8:33 AM
it's kinda frustrating when you have a coworker who seems slow
 
@tereško Slow walker / slow coder / slow runner / slow talker / .. ? ;)
 
I wonder ... maybe we should add IQ test for potential candidates in future
@Naruto slow thinker
 
Have you tried talking to the local USB driver Shaman? I heard there are some really good ones. I once had a malfunctioning USB drive and the shaman sacrificed a goat and cut a pineapple open and the USB started working straight away! — Benjamin Gruenbaum 2 mins ago
 
posted on August 28, 2014 by kbironneau

/* by n1k0 */

 
8:47 AM
mornings
 
Morning Dave
 
moin
 
You guys ever worked with Beanstalkd?
 
not me
there's a joke in there ... something about magic beans ... I'm tired ...
 
heh morning Joe
 
8:51 AM
:)
 

« first day (1412 days earlier)      last day (3529 days later) »