« first day (2823 days earlier)      last day (2116 days later) » 

12:03 AM
@LucasBustamante spend like a month in here and you'll probably learn more than you care to ever know... and 1-2 years from now, you'll be digging through the php src and going "hmmm... I see..."
presuming you have some understanding of C
 
@LucasBustamante The long and short of it is: PHP code is run in two steps: 1) Parsing, this step involves tokenization and lexical analysis of the code (in PHP 7 this turns into what is called an Abstract Syntax Tree or AST) 2) Compilation, this step involves transforming the code (or AST) into opcodes that the PHP runtime can understand and execute into machine code (basically just a bunch of functions in /Zend/API. Further compilation may happen at the runtime level as necessary.
You can obviously skip the first step if you cache the opcodes.
 
Zend Engine is what interprets opcodes into binary?
Through C?
Or the whole tokenization proccess is Zend Engine as well?
@Sherif (forgot to mention)
 
Zend is basically the engine of PHP. Just like the JVM in Java.
 
Because, opcode isn't binary yet, right? It's like Assembly?
 
It's the virtual machine that understand how to turn PHP bytecode into machine executable code.
No, it's binary.
 
12:12 AM
opcode and bytecode is the same thing?
 
It just doesn't translate directly into machine code (what we call ISA or Instruction Set Architecture, like x86, for example).
@LucasBustamante Pretty much, yes.
 
but isn't binary machine code?
 
Depends on the context.
Binary is just a generic term.
 
You need an interpreter of binary to make real binary, depending on what assembled the first binary?
 
The word "binary" probably doesn't make a whole lot of sense in that context.
 
12:14 AM
ok. Go on
 
@LucasBustamante The way Java works is very similar to how PHP works. It takes your code and compiles it down into something only the virtual machine can understand. So all PHP code can only run inside the PHP virtual machine.
 
Why would they do that?
Cross-environment friendly?
 
Yes.
 
I get it.
 
It's called Compile-Once Run-Everywhere
 
12:16 AM
PHP is kinda strict in that sense, right?
even though it has this philosophy
Java runs in much more contexts
 
Not sure what you mean. The JVM itself has to be compiled to the native ISA just like PHP has to be compiled to the native ISA. But the Java code you write or the PHP code you write runs on Windows the same as MacOS or Linux.
So there's no native binary executable that runs on the hardware directly. The engine runs on the hardware and your code runs inside the engine.
 
It's one of the reasons why PHP is so popular, once you have a web server set up, PHP installed, it's easy to test changes, almost instantaneous feedback, similar to an HTML page. Compared to building a web page in a compiled language, there's a bit more footwork to see the changes you've made
 
Why PHP is JIT and Java is compiled, if they all are interpreted by an engine?
 
No, PHP has no JIT. They are both compiled into bytecode and they both run inside a virtual machine.
 
PHP doesn't have a JIT, yet, it's being worked on though
 
12:19 AM
OK, I might have misunderstood the term, what I mean is that you don't have to compile PHP code to run it
 
But let's not conflate the two as it deviates from your question. I was merely presenting Java as an example of Compile-Once Run-Everywhere.
 
correct
 
Java you need to compile, right
 
yes
 
@LucasBustamante There is a transparent compilation step.
 
12:20 AM
but almost negligible for most userland developers
 
(this conversation is so interesting)
 
13 mins ago, by Sherif
@LucasBustamante The long and short of it is: PHP code is run in two steps: 1) Parsing, this step involves tokenization and lexical analysis of the code (in PHP 7 this turns into what is called an Abstract Syntax Tree or AST) 2) Compilation, this step involves transforming the code (or AST) into opcodes that the PHP runtime can understand and execute into machine code (basically just a bunch of functions in /Zend/API. Further compilation may happen at the runtime level as necessary.
 
OK, but, Java takes a few minutes to compile, right
PHP is instant
Am I missing something?
 
No, but I just don't think that is relevant to what is being said.
 
Java turns the whole project into opcode at once?
 
12:21 AM
Not really. But again, let's not focus too much on trying to compare Java to PHP. There really is no point in doing so.
 
@LucasBustamante another one of the many reasons I like this chat 😀 there's half a dozen to a dozen or so php internals developers that hang out here, and their discussions are interesting
 
@Sherif this happens for every language, right? Except C
 
@LucasBustamante I wouldn't say that, no.
 
Enlighten me
 
How so?
 
12:23 AM
What's wrong with that statement?
 
What I said specifically pertains to how PHP code is run. It would make no sense at all to try and argue that this is how every language is run except for C.
You're asking me to justify an argument I never posed.
 
all human-readable programming languages have to be interpreted to machine code, some uses that methods above, some uses another methods?
and these methods are vast and don't limit themselves to tokenization, etc?
 
@LucasBustamante Not all languages are interpreted, no. Not all languages are necessarily compiled to machine code. That method only pertains specifically to PHP (I make no claim as to what other languages do).
 
how do machine interprets them, then?
 
Who are "them" in this sentence?
 
12:26 AM
the languages that are not compiled into machine code
 
@LucasBustamante You're asking me to explain to you the process of how every programming language is executed?
 
No, no... Just the general concepts around
PHP and Java goes through VM, I get it
 
The general concepts are: a language can be interpreted by an interpreter or it can be compiled to a native machine executable binary and executed directly on the hardware.
 
In one short sentence that won't bother you, do you know about Python, Ruby, Go, Javascript and C?
they are all kind of less the same?
or not
 
How exactly, that process works is entirely dependent upon implementation and falls outside the realm of generalization.
 
12:28 AM
I feel like I'm bothering you, so don't feel obligated to answer in a complete way
I don't get it, how does it depend upon implementation?
 
@LucasBustamante Yes, I am familiar with those languages. However, I would disagree that any one of them is "the same".
 
PHP will always be run over Zend Engine through opcodes, right?
 
Those are all very different languages based on very different genealogies.
@LucasBustamante No. There are many different implementations of PHP.
Zend is just one of them.
 
I see, Hack, for instance?
 
...sure
 
12:30 AM
But in pratical terms, Zend is the law, right?
 
It is defacto. I don't think I would say it's the law.
 
Who wouldn't use Zend, apart from Facebook? (Just to get the picture)
 
I don't know. Anyone that doesn't want to use it?
I'm not sure how to answer that question.
 
But you don't know anyone else xD
 
I have no idea what you're trying to ask, at this point.
 
12:32 AM
To use something as "Another Zend", it would be a massive amount of work
Found an article about it
Seems there are some
PHP on PyPy, PHP on JVM, PHP on .NET...
lol, PHP on JVM can run on Android.
That's some weird shit right there, never heard of anything like those.
PHP as a concept is limitless, right, but it seems it's simply easier to use Java instead of building a PHP JVM
that's why both exists, right
@Sherif I thank you for standing up with me asking these trillion questions.
 
Okay anyone have any idea if there is a way to retrieve the gmail search results using php?
For example if I search "hello" using gmail
I want those same results using my php script
 
@LucasBustamante such things are typically technical exercises rather than being intended for real-world apps, the notable exception being hhvm, although that has now diverged from PHP. The .net concept is interesting, but I'm doubtful it will ever be much more than a toy.
 
@William You want Google's search algorithms?
 
@Sherif :D technically no just results. But if you could give me the entire google code base while you are at it that would be great
I doubt the algorithm is well simple
 
Sure, let me just check my Google proprietary secrets database. One sec.
 
12:43 AM
Its algorithm is well better then I have been able to build/make
Figured since I am using gmail maybe I can get it programmatically
 
Did you check their API?
Here, I spent 10 seconds of my life Googling your question: developers.google.com/gmail/api/guides/filtering
 
looks like this might work
I doubt it is the same results though but will check
yeah was reading that page
 
Were you?
> These methods accept the q parameter which supports the same advanced search syntax as the Gmail web-interface.
So why the doubt if you read it?
That's the second sentence of the first line on that page.
 
I will believe it when I have code running
 
Guilty until proven innocent, eh?
 
12:48 AM
@William mighty good luck to you, chap.
 
seems to be in the right ballpark but will need to mess around with it some more to be sure
comparing results same count numebr
 
There seems to be a trend with community college websites: they're either pretty good, or should be burned in a fire. About 3/4s of these sites I've gone through, navigating through the site is a pain in the ass, the page organization is horrible and/or the design is ugly. The other 1/4 have been a delight to the eyes, and easy to navigate.
 
@Tiffany Was it anything like the world's greatest website?
 
chaffey.edu for example, it's pretty bad, but it could be so much worse... chabotcollege.edu/Counseling/TECS/…
 
design is very subjective
you could make a site with tables today and people will still use it
namely hacker news
 
The websites I could care less about most of the time
 
@Tiffany Looks pretty hardcore to me. Where can I get in touch with the people behind those websites? I want to interview them for a job.
 
seems like most web portals for colleges are notorious for bad design
 
I attended a community college a while ago over the summer and what drove me insane was the fact the wifi required you to uninstall from you computer torrent software and virus software.
 
lolwat
 
1:04 AM
Yes uninstall it was the most bizare requirement ever.
 
oh
yeah, we have that as well, or at least disable torrent software
 
no uninstall not just disable
I ended up booting up my mac and changing the user agent string to an iPad to get around the stupid requirement
 
community college I work for has a similar policy in place, though
 
Because they don't know how to block torrent ports?
 
They already block torrent ports making people uninstall it is stupdi
It was software you to run on your laptop to actual get on the wifi
 
1:06 AM
How can you make me uninstall something?
How would you know what I have installed on my computer?
 
@Sherif they may be blocked now, the policy that was in place was like six years ago with a different netadmin, and we've had a couple good ones since then
 
@William You're shitting me?
 
@Sherif you had to run an .exe, .dmg or .sh file.
I'm not joking they even had a file for linux
 
wow, we don't go that far
 
Oh well that's simple. I choose the .sh file, reverse-engineer whatever it's doing, and send them a fake report.
 
1:08 AM
the .sh file was either obfuscated or wrapped binary
don't recall which the people that made it weren't complete idiots
 
OH NOES! OBFUSCATED BASH!!! I CAN'T GET AROUND THAT!
Hard stuffs man
They got me
 
but of course it colud be reverse engineered
just really a waste of time
 
Not if it helps me uncover security hole in their network :)
 
change you user agent string is way easier
 
I once took down a hotel's network that way.
 
1:09 AM
I browse now with ChromeOS as my default user agent string
 
I figure with my dream of moving out west, I'll probably have better luck finding a job at a community college than any other place, for the time being since I've worked at one for ten years. But digging through community college websites for their employment section... a couple of them I flatout gave up on because it's nearly impossible to find.
 
@Tiffany what is your degree in if you have one?
 
none
 
They wanted to charge me $19.95 for a movie so I decided since their access points have no ARP poisoning protection, and run in-band with the on-demand feature, I'll just take over the whole thing.
 
Yeah my University won't interview you with out one
 
1:10 AM
:)
Then I contacted their IT department and informed them of their gaping security flaw
 
anonymously I hope
 
I've attended college, but I haven't graduated. I'm self-taught in web dev, but I've taken a few formal intro programming courses. The rest I've read or learned from others.
 
degrees are a crap shot. Can make a world of a difference and can make literally none.
 
yeah, for quite some time I thought I needed a comp sci degree to understand the intermediate to advanced stuff
 
The jobs where a degree is a hard requirement are the ones you don't want (imho)
 
1:13 AM
I still want to get a bachelor's at some point, but I want to move first
one of the ones I'm looking at requires either a degree, or enough experience to make up for a degree. what's funny about this college is it's a few miles away from the city I grew up in.
it'd be funny to move back there after like... 21 years
 
boomerang generation ;)
 
Imo you have enough experience to make up for a degree
 
@William they don't live out there anymore
 
For front end development I need to look up flex
 
Dad lives like an hour from me now, Mom lives in an urn with my sister. We moved as a family out where I live now when I was ten.
 
1:15 AM
I remember parts but still don't use it for personal stuff
 
Do you want a job doing front end?
 
I'm about to graduate college then I will decide
 
have you done the flex frog puzzle?
 
Front End and JS is where my points come from so if I was going to get a job its probably what I most qualify for
playing flexbox froggy
now
I hate flex for having longer words more then anything
always mistype them
 
@William although I'm fully aware the world doesn't always work like this, in general you should forget about what the numbers say you can do and use your interests to communicate that you can do what you want to do. If you get a job doing front end and you don't like doing front end, it's not going to work out well in the medium-long term. Your regime's only job is to get you an interview.
If you do like doing front end then go for it, though
 
1:22 AM
Good night everyone
Thanks for the mentorship @Sherif
 
I have never really in my life really been paid to be what Ilove
so I threw that out the window
true though
 
Fuck, just remembered as I was closing my tabs, that I started looking for all of this to understand how PHP handles a request, what is a thread, a worker, a pool, what is pthread, etc.
 
@LucasBustamante rabbitholes are fun
 
Gonna tag you for the posterity, @Sherif
 
you have followed down the white rabbit whole
 
1:26 AM
I'm at this point of my PHP developer skillset, that I think it's essential to know this, how can we not learn about it before?
 
@William and what is that?
 
the endless knowledge of the internet I guess. Whatever he learned
 
I mean, how does PHP handles a request, in essence? How can we do parallel threading, why should we do that, what is memory_limit and how does it affects the threads
It's like, essential stuff
 
to front end no not really back end yeah
jump onto the node.js bandwagon and you don't really need threads
 
If we don't know this, in essence we don't know what we are doing
Node.js is my next thing
Bought a 1000+ book of Javascript and another one of Node
 
1:29 AM
@LucasBustamante welcome to the dark side. Be careful, there are dragons here. lxr.room11.org externals.io wiki.php.net
 
1000+ books?
 
line*
pages*
xD
 
Did you read any of them?
 
That's why it's my "next" thing
I'm moving, lots of stuff to do
But Node.js makes me think of parallelism, which leads me to realizing I don't know PHP
 
@LucasBustamante don't burn out and don't forget to take down notes.
 
1:30 AM
php isn't node.js don't think of them the same way
 
Node.js? Parallelism? o.0
 
How can I appreciate Node.js architecture if I don't know PHP's
 
What?
You realize javascript is single threaded, right?
 
@LucasBustamante ha, trust me, you very much can.
 
You should read one of those 1000 books you got.
 
1:31 AM
1000 pages* I think
 
@Sherif Yeah you are absolutely right, I was thinking of async and got lost in words
 
2 mins ago, by Lucas Bustamante
Bought a 1000+ book of Javascript and another one of Node
@William I saw books
 
but multi-threads is another point
@Sherif so good you returned, care to be bombarded with a trillion questions again?
 
OK, I sit corrected. I saw "book", but I now realize that was likely a gaffe
@LucasBustamante No
Sorry
 
It's okay, I'm tired myself
 
1:32 AM
I have lots of work to do, but Google is your friend.
 
Just wanna grab a beer and watch Suits
Watch Suits. Seriously.
It's on Netflix.
Dude, I googled for like 3 min and couldn't find
Shit musn't exist
 
@DaveRandom Seems interesting
Well, I'm out. Have a good one everyone!
 
@Tiffany in high school my school used teacherlogicxe
google it is worse then anything you have shown me so far
html injection through out the site
it is still used today sadly
 
classic ASP, lol
there's the first problem
 
1:44 AM
you can download the source of any page from the login page
as long as you now the file path
function ShowFile(filename){
	var realName,storedName;
	window.open('Attachments/AttachmentShow.asp?slcommon=yes&real='+filename+'&stored='+filename,"AttachmentView",'top=25,left=50,resizable=yes,menubar=yes,location=no,width=600,height=400');
}
simple pass the filename into the site and the source of any page
I believe the database was hardcoded in one of the files but don't remember which
that is the javascript from the login page
it made me wonder if the school had an IT staff for stuff like this to get through
I understand the company selling it doesn't care but the IT staff really?
capitalism at its finest
 
@William overworked and underpaid, typically
or their IT department has had their budget slashed so bad that they can't purchase something decent
 
the source is available to fix the site
because I was able to download it
just remove the security issues and I wouldn't care
with out going into details I wrecked havoc on the schools system
 
I'm the sole web person at my college, I'm in charge of most of the web-related technologies, including our mobile app. I have to make a list of everything that needs doing, and prioritize. I'm also at the mercy of my superiors jacking with my list of priorities.
 
@Tiffany what is your mobile app written in?
That is something I am meaning to learnish
 
@Tiffany I forgot to say earlier - unless there's a great reason to change it, you should leave that legacy app alone...
 
1:52 AM
swift and java, I believe. I didn't write it, code was provided to me from a vendor we contracted, and I branded it for our college and submitted to app stores. If you do a search in this chat for "xcode" you can see the chronicles of me slowly losing my mind.
@Danack our legacy codebase?
 
12 hours ago, by Tiffany
Other than understanding this better, I think one of my goals is rewriting a PL/SQL package at work that has pretty shitty security, but I haven't figured out a good way to rewrite it. I may end up rewriting it as PHP web app, using phpcas and some other stuff.
or work on your cv.....
 
@Danack if I'm working here in two years, it will need to be updated
 
its makes me angry how much I prefer my iPhone but despise xcode
for free Android is absolutely amazing for something I am paying for it still has quirks not to mention no update path
well despise objective-c anyways
swift looked better last I checked
 
phpdbg man page contains outdated information – #76595
 
swift as a language seems fun, Xcode however... is like wearing one's sanity down to the point of going on FMLA
... I won't go into it, cause I won't stop
 
1:57 AM
please go into it
 
Jun 15 at 19:32, by Tiffany
Xcode alone was enough to bring me to screaming in the server room. Not even PHP has achieved that.
 
is that really how you feel?
 
I actually did that, I went into the server room and I screamed. I was hoping the sound of the fans and a/c would drown it out. Couple of coworkers came out of their offices wondering wtf happened. With PHP, I've joked about going into the server room and screaming, but never actually done it, cause I wasn't driven to that point.
@Danack I found a job I want to apply, and it closes this Friday, so I'm going to be doing that this week.
probably switch out some of the developer-y achievements with more higher-ed focused achievements, since they're looking for a developer familiar with ellucian banner, which I am
this day went by too fast :< time to get ready for bed
 
2:20 AM
o/
 
phpdbg does not support display_errors=stderr – #76596
 
2:36 AM
phpdbg does not support auto_*_file ini settings – #76597
 
To bed early tonight, all. Have a good one.
 
2:58 AM
Any idea how I might make these two conditions shorter:

if( f || a ) { show 1 }
if( a ) { show 1 and 2 }
 
that shows 1 twice if a is true
is that intentional?
 
Wes
mornin
 
@DaveRandom Ha! Nope. I'm not thinking straight here. Fcuk.
 
Thinking is hard.
 
@Sherif I'm just finding out.
 
3:03 AM
@hello What you probably want is something like 3v4l.org/gShL0
also forget about shorter, what you want is the most readable
 
@DaveRandom That works. Early optimization is the root of all evil.
 
@DaveRandom Doesn't that still hit both conditions if $a is true?
All you did was move the expression to a variable.
 
@Sherif Look closely.
 
Wes
@hello also not understanding basic code is pretty evil tho :B
 
3:18 AM
@Wes ikr?
 
@hello I'm pretty sure I'm not the one that needs to look closely here.
 
LOL
 
@hello Would you like to take a closer look? 3v4l.org/ZCtM9
 
if( f || a ) { show 1 }
if( a ) { show 1 and 2 }
 
You should probably stop and think about what you just wrote for a minute.
 
3:21 AM
Ok.
 
@hello That's very different from what you said earlier, but if this is what you intended then carry on.
 
 
2 hours later…
5:14 AM
posted on July 09, 2018

New Cyanide and Happiness Comic

 
5:49 AM
Hi all great people
I saw following sentence in PHP manual : "As of PHP 7.1.0, assigning an empty string throws a fatal error. Formerly, it assigned a NULL byte."
 
oooo, look at that! I'm great people!
 
I tried to execute the below code in PHP 7.2.6 but I didn't get fatal error. Why so?
I got below output result :
Warning: Cannot assign an empty string to a string offset in C:\xampp\htdocs\php_playground\demo.php on line 3
Jumbo
I got the warning instead of a fatal error. Why so?
Am I misunderstanding something and writing wrong code?
 
yes
 
Wes
6:04 AM
$string = "foobar";
$string[3] = null; // was like doing:
$string[3] = "\0";
now you are required to write "\0" explicitly
also why are you guys being assholes, rather than help
 
Hey, I am not an asshole. I was told I was great people :/
Nicest thing anyone's said to me all year
 
Wes
don't be too happy, i said you are an asshole to balance it out :B
 
@Wes: I'm clear about assignment of null byte upon assigning an empty string. I'm asking for the warning I received in output instead of a fatal error. Why the PHP interpreter is throwing a warning instead of a fatal error?
 
Wes
wait lemme re-read
what's the "below code" ?
 
@Wes : <?php
$string = 'Jumbo';
$string[3] = '';
?>
Output in PHP 7.2.6 is : Warning: Cannot assign an empty string to a string offset in /in/WAleO on line 3
 
Wes
6:12 AM
it's a documentation bug probably
cc @PeeHaa documentation says that throws a fatal error but instead it's just a warning
http://php.net/manual/en/language.types.string.php where it says:
As of PHP 7.1.0, assigning an empty string throws a fatal error. Formerly, it assigned a NULL byte.
should probably be a type error
but this is php, it's not that it makes sense
 
@Wes : Is @PeeHaa going to correct the manual text?
 
Wes
yes
i would do it but i noticed anonymous edits don't get accepted... or checked often
i need to figure out how the php.net account thing works
 
@Wes : Thank you so much Wes for helping me out.
 
Wes
yw
 
@Wes : I noticed another weird thing in manual. The sentence is saying 'Non-integer types are converted to integer.' on the same manual page.
I tried below code :
<?php
$x = "foo"; $y = $x[true];
I was expecting it to work without any warning or notice but I received following notice :
Notice: String offset cast occurred in /in/SRI4L on line 2
This has not been mentioned anywhere in PHP manual. Tha manual only says that "Non-integer types are converted to integer."
It should also been corrected as 'Valid non-integer types are converted to integer.'
What do you think about this @Wes @PeeHaa?
 
Wes
6:29 AM
no that's ok, because notices are notices... one can choose to ignore a notice. it's not strictly an error
 
7:26 AM
New Field to store why a nay vote was made in rfc – #76598
4
 
@Jeeves lolno
 
I like it! :P
Nov 17 '16 at 18:54, by pmmaga
Why not an optional comment box whether you vote yes or no?
 
optional, fine
 
@Jeeves New Field to store why a yay vote was made in rfc – #76599
 
o/
 
7:43 AM
I have had 0 minutes sleep in the last 24 hrs, I currently feel pretty OK but I have a feeling that won't last...
 
mornin
 
first thing I am asked today... 'can you please find all user passwords reversing sha1+salt, and rehash them all with something more secure?'
 
I hope the person who asked you that is not allowed anywhere near code
 
@Ekin easy: sha1+salt+"more_secure"
 
7:59 AM
he is not... although sometimes he sneaks in to update paragraphs and puts U+00B4 instead of single quotes everytime
 

« first day (2823 days earlier)      last day (2116 days later) »