« first day (663 days earlier)      last day (4285 days later) » 

3:00 PM
@Mike, sorry what I meant to ask is can someone go into a separate chat room with me to help me fix these errors?
because it can get pretty crowded in here
 
It dont seem crowded right now
;)
anywayz
Have a great weekend all!
 
dafuq
friday?
 
So no one will moan if my questions crowd this page?
 
you are in a wheelchair, we have sympathy
 
Okay here's what I'm trying to solve. (@webarto lol thanks)
 
3:03 PM
@JordanRichards The reply feature is great for avoiding clutter
 
@Mike B, I'm sorry. I'm new here, where is it?
 
Hover over someone else's message and click the arrow pointing to the right
 
Q: will it still be possible to run PHP 5.5+ on Windows XP even thought it is not supported officially?
 
@MikeB Oh
Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/****/Include/functions.php on line 27
 
@PeeHaa What was it?
 
3:10 PM
 
Does anyone know how I can fix this?
I defined $link in my connect file which is included in functions.php
but for some reason..
my functions inside that file that use mysqli say
Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/****/Include/functions.php on line 27.. etc
I've been trying to fix this for days,
I would of posted to stackoverflow, but I'm not allowed for some reason.
so... is anyone there?
 
@NikiC sorry for pinging you, but I guess you should know this chat.stackoverflow.com/transcript/message/4872433#4872433
 
@webarto Spam. The internets is full of it.
 
@salathe yes, but how it got here news.php.net/group.php?group=php.announce it was not even 1st april :P
 
@JordanRichards What's confusing about the error? Consult the documentation regarding the function (php.net/mysqli_error) and note the required arguments
 
3:16 PM
@webarto svn.php.net/viewvc?view=revision&revision=323865 That's the only related commit that was made
It doesn't look particularly damanging, so probably it will still run for the most part ;)
 
@MikeB The fact that it connects fine and I did define $link to the mysqli_connect
 
@webarto some temporary misconfiguration.
 
@webarto But the changeset is rather confusing to me, so I can't say for certain ;)
 
@JordanRichards And mysqli_error() requires you pass that $link into it..
 
@MikeB yes, as i did
 
3:18 PM
No you didn't, the error says you're passing null
 
hmm, but it is defined..]
unless.. because it's in a function?
 
@NikiC "#if (_WIN32_WINNT < 0x0600) /* Vista/2k8 have these functions */" I'm guessing they are relying on some no XP functions... do you think someone should ask what exactly is being changed? Thank you very much for link
 
@JordanRichards VARIABLE SCOPE strikes again.
 
This is where you start to debug.. before the mysqli_error() call do a var_dump($link) to confirm it's empty.. then continue up the stack checking where it's supposed to be set, etc etc etc
 
@salathe :)
 
3:21 PM
it is definatly null, that;s for sure. As the var_dump concluded
I'll try doing it outside the function
AHA
 
@NikiC where have you been hiding the last few days?
 
It's not null outside the function and it's right
so how do I make sure that it's not null inside functions?
 
@JordanRichards There's a lot of ways to do that. The most-correct way would be to pass $link into all of your functions that would need it
There's also the very unpopular, and sloppy use of global scope
 
OH DEAR! That's gonna take forever.
 
@JordanRichards Hey there, again. I can't help just at this moment (about to go play tennis with my wife), but I can help you later today if you'll still be around.
 
3:25 PM
@LeviMorrison hey, thanks :)
@MikeB are there any quicker ways?
 
jQuery
 
@JordanRichards You've created a dependency on the mysqli link in a lot of your functions. You can read up on various ways of injecting that dependency en.wikipedia.org/wiki/Dependency_injection
As I said, the quick, dirty, sloppy way is to make use of global-scope.. but doing so opens the flood-gates for everyone in this room to judge you harshly :p
Unfortunately it's not a simple fix.. it's something all developers struggle with on a daily basis
 
@Mike B, okay thanks. May I ask, why is global scope hated?
 
Off the top of your heads, what does this do? unzip data.zip
 
23
Q: Are global variables in PHP considered bad practice? If so, why?

KRTacfunction foo () { global $var; // rest of code } In my small PHP projects I usually go the procedural way. I generally have a variable that contains the system configuration, and when I nead to access this variable in a function, I do global $var;. Is this bad practice?

41
A: PHP global in functions

GordonGlobals are evil This is true for the global keyword as well as everything else that reaches from a local scope to the global scope (statics, singletons, registries, constants). You do not want to use them. A function call should not have to rely on anything outside, e.g. function fn() { gl...

 
3:32 PM
@Leigh Didn't have much time recently
 
@NikiC My brain was crushed by lalr grammars yesterday :(
 
I'm getting home from university at around 16h, so that cuts a large part of the time I usually have ^^
 
@Christian unzips data.zip
 
@Leigh By LALR grammars?
 
@webarto Does it do that inside the current directory?
 
3:34 PM
@Christian yes, inside current working directory ... linux.die.net/man/1/unzip
 
@Leigh What's so crushing about them? :)
 
@NikiC I was playing with extending language syntax.
 
For PHP?
 
@webarto it vorks without katastrofic failure!
 
@NikiC Ehh, when you try and add an else to a foreach, the shift/reduce conflicts go nuts :p
 
3:35 PM
@Christian what do you mean :)
 
I'm always hesitant about obvious linux commands.
 
@Leigh I imagine that there will be more (because there will be an foreach/if ambiguity), but they shouldn't go nuts if you did everything right ;)
 
@NikiC I managed to get it down from 145 s/r conflicts to 5, and I figured that those 5 should be expected. (it took me about 2 hours to do it - since I never really played with the grammar before) - Then I got bored and gave up when I got all the opcode stuff wrong.
 
@Leigh 5 might be just right
because there are already 3 before that
 
Aye
 
3:37 PM
and +2 seems right for the foreach/if ambiguity
 
It looked like I was going to have to rewrite too much though, even as an experiment it was too hard for me :)
 
Okay guys.
 
So anyway, I had a question....
 
I have made my mighty decision
 
@Leigh I think the else is a simple feature
Should really be doable ;)
 
3:38 PM
to do it the proper way :D
 
@NikiC Yea thanks for making me feel stupid :p
 
(This is gonna take forever..)
 
@Leigh Not stupid, but new :P
 
So guys, I'm not gonna use the global scope in php, so you don't need to hate me for that now :L
 
@JordanRichards We still will ;)
 
3:40 PM
@NikiC Using the LALR grammar, is it possible to match foreach($a ...){ x } else { y } and translate it internally into if (count($a)) { foreach($a ...) { x } } else { y }
 
No way around it :D
 
@NikiC well at least it's not my fault.
 
Without the need to write new C functions
 
@Leigh no. also just count($a) doesn't do it, because Traversables don't necessarily need to be Countable ;)
@Leigh I don't think you need really much
 
Thank you, @Mark B For your help.
 
3:42 PM
@NikiC I had it pretty much working, except it always ran the contents of the else {} too, I needed to put some sort of jump opcode in there
 
@Leigh You'll have to add another func in the compiler to save the else offset in the oparray (so PHP knows where to jump) and in the FE_RESET opcode there already is code to check whether the traversable is empty, so you'll just have to insert a jump there
@Leigh Ah okay, so you already got that far
Yes, you'll need some kind of jump at the end of the loop
 
It was a fun project, to waste some time on, I'll probably try and do more later.
 
yes, you will :P
 
I added a new operator for my first project playing with the language syntax, that worked fine. Maybe this one was a bit too big for the second project :p
 
Is there a good method to define a variable in ALL functions quickly?
 
user895378
3:47 PM
@PeeHaa By default any SSL connection is accepted. No certificate authority file is needed to verify that the remote host is who they say they are. You can test this by sending a request to any standard https:// address like $r = new StdRequest('https://www.bankofamerica.com', 'GET'). If you need any custom SSL behavior, the full range is available to you through $client->setSslOptions($optArray)
 
user895378
Simply pass an associative array using the options specified at php.net/manual/en/context.ssl.php
 
for example..
function IneedVariables() {
echo $needsToBeInarguments;
}

would there be a way to define $needsToBeInarguments quickly?
for a lot of functions?
 
there is a constant, but it is not a variable .. config also..
 
oh, but for like $db resources, like $link?
would there be a way to define that for all my functions?
without using globals
crosses fingers
 
No
 
3:54 PM
"functions" as in functional programming?
 
oh great..
@orourkek like

function this() {

}
 
...
 
@orourkek what?
 
I know what a function is, but the real answer to your question is dependancy injection, which would be very cumbersome without organized classes
 
user895378
@PeeHaa There is one known issue currently -- There are valid HTTP responses that consist only of a single line (the 1xx series of response codes) like HTTP/1.1 100 Continue that are currently treated as invalid HTTP messages by the client. I've incorporated that fix in my local working directory but it won't be available until the next push which won't happen until I get full test coverage ...
 
3:57 PM
@Hello guys
how are u all
 
@JordanRichards No, you can't. In PHP all globals have to be imported with global.
 
@NikiC yet everyone hates global?
 
user895378
Don't confuse @NikiC's statement about language syntax as an endorsement of global use.
 
@orourkek Oh, that's way too complex for me.
 
@NikiC I wanted confirmation that a semi colon is not needed before php end tags. Already got it. :)
 
4:01 PM
@JordanRichards Yes. But it's still global if you don't have to write global. We don't have a problem with the global keyword, we have a problem with the general concept of global state.
 
@rdlowrey yeah sorry, I'm not too good with talking about code
so using global $link; would be bad?
 
Yes.
Instead you should pass it in as a function argument
 
so instead I'll have to go through every function and every place a call a function and define $link?
(every function where I use sql)
I thought mysqli would be an upgrade of efficiency from mysql.. everyone was telling me to upgrade to mysqli.
 
I've got an interesting question. I'm assuming you know how URL rewriting works in order to provide a response given a non-existent file path.
 
4:06 PM
@JordanRichards i.imgur.com/RJEsz.png .
 
@Nikic: I kind of agree with the yield() syntax. It's nicer looking than (yield $foo), and it's semantically more appropriate (since it "returns" data...
 
Most servers have the ErrorDocument-like directives, where you specify a file to handle server errors.
Since a PHP script is handling the 404 error, the script might result in a 404 if the fake path still doesn't make sense to the script.
 
@ircmaxell I don't like having non-function functions though :/
 
@PeeHaa lol win.
 
The question: is it possible to somehow detect this change to 404 from the PHP script?
 
4:08 PM
@PeeHaa how do I use super::?
5
 
I'm thinking maybe the append php script php setting/directive?
 
lol
 
@PeeHaa lol
 
@PeeHaa super::$link; just gave me an error
 
4:10 PM
You might wonder why I'm asking. Basically, I thought it would be nice to have something that reports actual 404s. But if a call to GET /post/bla routes to index.php?pid=bla, even if the index.php finally ends up with a 404, there's no way to capture this error through apache, am I correct?
 
@PeeHaa Wow, that's funny now. Didn't think people would take it literally...
 
@NikiC wow! that's funny now I didn't think you'd actually think that I was talking it literally. lol I was playing along.
 
4:12 PM
suuuuuuuuure...
 
@orourkek sure*
lol
 
@NikiC eih, in this case, I think the benefits outweigh that though...
 
@ircmaxell Maybe
 
It's worth a thought at least
 
4:13 PM
@JordanRichards You have to ask me. I have the trademark. It's not cheap, I can tell you. ;)
 
umm what?
 
@ircmaxell Sure.
But I'd so like to stay syntax compatible with Python etc...
but I see the benefits
 
@hakre We should try to patent the global state, no one could use it then!
 
Well, python has different parsing rules, so staying syntax compatible -while a good goal- may not be prudent in all cases...
 
@orourkek Let's start a nuclear design war to end global state.
 
@ircmaxell Related then: How would the delegation syntax look like. Python has yield from $foo, Harmony has yield* $foo. With the yield() base syntax, how could that look like?
 
@orourkek Should remove it from all versions prior to 5.4 to encourage uptake
 
yieldFrom($foo) ^^
 
@NikiC @ircmaxell when does the voting close on the finally rfc?
 
@ircmaxell I think the yield() syntax might look strange when not used as an expression. So when you just write:
 
4:17 PM
@JordanRichards Super::$tatic is that great that you have to pay royalties if you want to use it. Just for protection naturally.
 
$foo = 'bar';
yield($foo);
$bar = 'foo';
It bothers me there that the yield($foo) looks just like some function call. And not at all like the return $foo which it would be similar too
 
@NikiC I didn't follow internals for a couple of days, you can't use it like a statement? Just "yield $foo;" ?
 
why no yield $foo; yes
 
One could re-use the throw keyword (duck)
 
PHP normally only uses the pseudoFunc() syntax for things that are primarily used as expressions. For things that are primarily used as statements (like include etc) PHP uses the keyword notation.
 
4:20 PM
@hakre yes! you'd never want to -yield- throw an exception :)
 
@Leigh We are talking about whether it should be yield $value or yield($value) ;)
 
@salathe never! :)
 
@NikiC I think "yield $foo"
since its kinda-sorta-like return
 
what does it mean if when i echo "á" from a script it gives me "é"? im so encoding retarded...
 
4:21 PM
@NikiC More pertinently, why are we talking about whether it should be yield $value or yield($value) ?
 
@Leigh The issue there is that it needs parens in expression context: $data = (yield $foo); which some people consider odd ;)
@salathe See what I just said ;)
 
@NikiC that's just how it is, tell them to live with it.
 
@NikiC support both? like include/print
 
@AndyPerlitch It means you have saved your file in utf-8 but the browser is displaying that as latin-1 / window-1252
 
@salathe But what about the bikeshed!!!
 
4:22 PM
they need to do the same with print!
 
@salathe There they don't need it :D They should, but PHP (mistakenly I think) does not enforce them.
 
@hakre ah ic
 
@AndyPerlitch If you need more guidance, please tell in which HTML version your output is.
 
Is $data = (yield $foo); the same as

$data = $foo;
yield $foo;
 
@NikiC why would $a=yield $b; be any different from $a=print $b; ?
 
@salathe because our parser sucks. that's the real reason. I could give you some other fancy arguments, but it really comes down to that.
 
@NikiC fix it :)
 
@salathe I wouldn't make it in time
 
@NikiC ? in time for what?
 
@hakre i was just echoing to the browser without any html tags as a test, so that explains the browser interpreting that as latin-1, but why would it be interpreted that way when inserting into mysql? The table I am inserting into is encoded and collated in utf8
 
4:26 PM
@salathe For PHP 5.5
 
@NikiC so be it :)
 
Rewriting the parser to use an AST is a rather large task after all.
 
@NikiC If you start now, it'll be ready for 6.0 ;)
 
@AndyPerlitch or send header() content type bla bla
 
And honestly I don't want a feature to be dependent on a major parser rewrite ;) Because that has a large potential to f up
And also, it's always possible to remove the parentheses requirements later, when there is an awesome new parser :D
 
4:27 PM
@AndyPerlitch Encoding always is meta-information. That has nothing to do with display. Like you store it as UTF-8 in the file and display it as Latin-1, you can also store it as UTF-8 into the database and still display it as Latin-1. Nobody stops you to do so ;)
 
@AndyPerlitch how do you connect to database? It's all bytes like @hakre says
 
mysqli
using prepared statements
 
@NikiC Seriously it's going to be a requirement? Not optional?
 
How do you view the data in the database?
 
@Leigh yes
 
4:29 PM
@hakre a gui app called sequel pro
 
@Leigh But only when used as an expression ;9
The normal use will be just fine
 
@NikiC Oh, good.
 
And also the normal $data = yield; use doesn't need parens ;)
 
@AndyPerlitch And that gui displays it as what?
 
Well, home time.
 
@hakre well since i am seeing é, im assuming latin-1
@webarto so is that called setting the transfer encoding?
which is separate from the initial encoding/collating that i set the table to?
 
@AndyPerlitch Well, you can also tell the mysql that you want to store as UTF-8 but the connection is latin-1 and then you push in UTF-8 characters to the database but tell the database it is latin-1 and the database then re-encodes the latin-1 (which is utf-8) into utf-8 which then will store that as latin-1 like looking utf-8 as utf-8. You then screwed it.
 
@hakre i. hate. encoding.
 
@AndyPerlitch just set everything as UTF-8, collation, connection etc... table, field, database... everything...
 
@AndyPerlitch It's something you need to be precise with, true. Some developers think that is pedantic.
 
4:32 PM
@webarto oh i try, but there always seems to be one asshole
i've tried to get more comfortable with it all... reading that joel on software post about it + a few other articles. but i still run into problems and confusion
i guéss îm just rétår∂é∂
 
user895378
@GordonM I just updated my answer to your stream mocking question:
 
user895378
2
A: Trying to test filesystem operations with VFSStream

rdlowreyUPDATE Upon further consideration I do see some value in passing in an open resource stream in this case. So how to test it? All vfsStream does is provide a custom stream wrapper for file system operations. You don't need the full-blown vfsStream library just to mock the behavior of a single str...

 
@AndyPerlitch from our friend @deceze kunststube.net/encoding
 
user895378
@GordonM Anyway, there's no sense in trying to use vfsStream to mock php://input ... that's not what it's for. Just write your own custom stream wrapper.
 
@webarto awesome, thanks!
 
4:36 PM
@AndyPerlitch 漢 this is pretty badass UTF char, what you have is nothing :) for MySQL client I can tell you that SQLyog, Navicat, HeidiSQL all work great...
 
@rdlowrey Nice answer!
 
user895378
@hakre thanks :)
 
@webarto cool, i'll try those out. Never had a problem with Sequel Pro though.
 
well you can give a real answer to real question :)
@AndyPerlitch sorry I read it is giving you wrong output, if not, ignore...
 
@AndyPerlitch I think it's like I told in that lengthy chat-comment. I'll draw a picture.
 
4:39 PM
@hakre [processing hakre comment ... 34%]
 
user895378
[....................................100% ]
3
 
HAHAHAHAHA
 
user895378
Woot for ASCII progress bars.
 
I'm going to use instead of fancy loaders... never gets old...
 
@hakre the more times i read that comment the more i understand it and the funnier it sounds...especially when i read it out loud.
a la "who's on first"
 
Can you typecast parameters by interface?
 
@orourkek like $foo=(IMyInterface) $data ?
if it's so then yes
 
ugh, I work on a site that deals with the film industry, so 'typecast" just sort of came out. I meant type hinting
 
@orourkek Yes, they work on interfaces.
 
fatal errors came out of the blue complaining about the hinting
 
4:57 PM
@orourkek I think it should work fine as type hinting also. can you post the error?
 
> \Model\Services\ServiceFactory::__construct() must be an instance of \Model\Services\FactoryInterface, instance of \Model\DataMappers\DataMapperFactory given
wait either I copied that wrong, or I have a namespacing issue
><
 
@orourkek i think it can be a namespace issue, a quick test in here to check something
 
\Model\Services\FactoryInterface <- d'oh
 
@NikiC Can you make yield more similar to how return acts? Honestly that seems like the best choice to me. I haven't thought about this as much as you, I'm sure, but that's my recommendation.
 
@LeviMorrison Hey
 

« first day (663 days earlier)      last day (4285 days later) »