« first day (1601 days earlier)      last day (3347 days later) » 

4:02 PM
@tereško github.com/PeeHaa/php-net-tutorial not complete though
 
@PeeHaa ^^
 
@PeeHaa Btw, here you're using htmlspecialchars($initialValue, 'UTF-8') which is missing the flags argument.
 
and the code there looks really confusing
yeah, that chapter seem unfinished
 
user895378
4:23 PM
@Tyrael I'm a little confused about what bugfix entries belong in the master NEWS file. Am I supposed to go ahead and add NEWS entries in master for bug fixes applied to 5.6 and merged up or not? Thanks in advance for your input :)
 
@Ja͢ck Good point. Fix it Fix it Fix it Fix it PR it PR it PR it PR it PR it PR it PR it PR it
@tereško I am still very much hoping for either: moar spare time or somebody adding to the thing :)
@Ja͢ck Although won't all new users be at least on 5.4 :P
 
wait, use doesn't need to be at the top of the file???
WTF
/me quits
who the f#%$ designed this shit?
 
user895378
I think designed is a strong word lol
 
user895378
Coded? Maybe. Designed? Not so much.
 
3v4l.org/mgd0P <-- why? for the love of god, why?
 
user895378
4:37 PM
That's my main issue with PHP ... the (historical) lack of direction and overall architecture/structure/cohesiveness. This is improving now, I think.
 
seriously, WTF
 
@ircmaxell Trying to decide what the "right" behavior is there, and I don't think PHP or HHVM hit it...
 
@PeeHaa yeah .. well .. that spare time thing
 
@Sara IMHO it should be an error. Use statements shouldn't come after code
and HHVM gets it right here: 3v4l.org/KlXUq
 
Morning people
Well, actually good day
 
4:45 PM
@Sara I was thinking of proposing the change that the only limitation on use is that the class cannot be defined in the same file (how HHVM behaves today)
 
@tereško inorite :(
 
I was wondering, is it true that the pattern behind single page applications is MVP and not MVC since the model does not affect the view but rather hands it to the presenter which uses a contract to read/write the data to the view by some kind of a contract, using JSON for example.
 
anyone floating around that happens to be good with compiling on solaris?
 
@rdlowrey :) Glad I can help.
 
@NikiC is there an easy way to get the parent of an ast node?
 
4:55 PM
How to correctly write this Twig notation? {{ price * quantity |number_format(2) }}
 
@Sruj I'd suggest making it into a single function that can be called, rather than having code in your template.
 
@Danack ok
 
@Sruj don't you want to format the number after you've done the math?
 
@crypticツ That's the twig syntax for doing that, everything after the pipe is a filter that is applied to the contents.
 
(I dont want to start conversation, with my English it will shortly become incomprehensible. )
 
5:02 PM
right now you format quantity then multiply by price, so you lose the formatting. You need to do this: {{ (price * quantity)|number_format(2) }} @Sruj
 
Does anyone have a website that uses the Composer autoloader, and use OPCache on their server and fancy benchmarking a (hopefully) faster clasloader? The only thing needed to do is composer update nothing with this composer.phar and add define('COMPOSER_OPCACHE_OPTIMIZE', true); before require'ing the composer autoloader. Context is here
 
@Danack I think opcachegui uses composer for something. Let me check
 
thanks @cryptic ツ
 
Oh nope wait. People wanted me to do that but I said meh
 
@ircmaxell no, there isn't… if we need this parent information we're checking a CG() which just exists for that purpose…
 
5:06 PM
posted on March 05, 2015 by kbironneau

/* by TeeMonie */

 
Ah that moment when you've spent a couple of days trying to optimise a piece of code that takes 2 minutes to run, only to discover whoever wrote it in the first place was executing tens of thousands of SQL queries and then effectively throwing the results away because the first one got all the data needed. Now it runs in 25 seconds
 
@bwoebi well, CG only gives me the file, right?
 
@ircmaxell I've been passing parent and child as 2 params to functions where I need the parent.
 
@ircmaxell I mean, it gives you information whether you're in a loop a class etc.
but that's all you currently can do.
 
I need to know which namespace block I am in
 
5:08 PM
Hello guys
 
like the AST of the current namespace block
 
I suppose since the AST is freed after compile, the memory overhead of adding a parent pointer isn't a huge deal
 
it's in the compile step
specifically, zend_compile_use()
 
@ircmaxell to do what exactly?
 
determine if a class by the same name has already been declared in this present namespace block
 
5:09 PM
<form name="myform" action="handle-data.php">

<a href="javascript: submitform()">POST</a>
</form>
<script type="text/javascript">
function submitform()
{
document.myform.submit();
}
</script>
 
fucking.. accidental edit ^
 
Basically, to make this valid code: 3v4l.org/KlXUq
 
Did my code have a $_POST function?
 
@WTFZane method="post" in the form tag
 
Have you uhhhm.. like... considered using a submit button?
That is kinda what it is for
 
5:11 PM
@ircmaxell can you check this reliably at compiletime at all?
 
I dont like the submit button
 
can anybody help me with .htaccess rewrite rules. I want to add a '/' at the end of url http://example.com/offline
I am using this code

RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

but it's adding '/' on every url. I only want it for http://example.com/offline
 
because it will display data in the database
 
what changes should i do
 
The submit button doesnt like you to
 
5:11 PM
*from what will i be doing
 
Just use a submit button
 
@bwoebi shit. I don't know. Because of if statements, etc
 
But, it is a list of many data's
 
@ircmaxell I think you're either going to have to push/pop NS onto a stack as you encounter them, or add a parent pointer to the ast structs
 
I think I need to walk the entire tree before hand
 
5:11 PM
and a button won't look great in it
 
That is what css is for
 
Style the button then.
 
I have a very strong opinion about broken javascript submits
 
Or hide it and have some other element trigger its click event, if it comes down to it.
 
Can I use the fucking return key?
 
5:12 PM
Oh great thanks!
 
At least there's a handy function for tree walking already: zend_ast_apply :)
 
So i'll just design it and remove the square thingy?
 
Also, this is a PHP room, ther javascript room is -----> that way.
 
@WTFZane border: 0; background: transparent;
 
@ircmaxell Can't you just check if a class fetch of some class name was already compiled before when you encounter the use? Instead of walking the AST?
 
5:13 PM
Sorry, my main question is that if it can post. and i also. im not fond of using javascript
 
Nobody is :)
 
@bwoebi how? because it only should matter if it's within the same block as the use (since use is scoped to the block)
 
really?
 
Of course. All JS " developers" actually wanted to use PHP, but they failed
 
<button type="button" method="post">Click Me!</button>
is this will do?
 
5:15 PM
submit should be the type
 
how can i direct it to some .php?
 
please help me with my question. see my questions above. It's about to go off the screen
 
oh sorry
stupid question
 
I mean, I can keep a SLL of classes (and functions and constants) that are compiled in CG, then iterate over them in the use declaration...
 
well, look at what CG(current_namespace) is… and whether the "CG(current_namespace)\class_name" was already used. when you use something use namespace_prefix\class_name. Yes, you'd need to store that info in a HashTable…
 
5:17 PM
@ShubhamNishad, I suggest posting a comprehensive question :)
 
namespace Foo;
new Test;
use Bar\Test;
@ircmaxell ^ That's a minimal example which must fail, right?
 
no
that's fine
 
@ircmaxell why?
 
namespace Foo;
class Test {}
use Bar\Test;
@bwoebi I don't like it, but that's fully supported today
 
@WTFZane, it's 'comprehensive question'
 
5:18 PM
the thing tha'ts partially supported (and partially not) which is what I'm trying to fix is being able to use a classname that's defined in another file or block
 
1 message moved to Orphan GIFs
 
@ircmaxell That what you want to fix is essentially removing working functionality too.
 
I mean, in the proper?
 
namespace Foo {
    class Test {}
}
namespace Foo {
    use Bar\Test;
    var_dump(new Test); // should be Bar\Test
}
@bwoebi no, what I want to fix is currently an error today
 
oh
 
5:19 PM
as long as you don't run opcache
which makes it no longer an error
 
@ircmaxell imho we should just drop that error
 
sometimes, depending on inclusion order
 
lol
 
btw
 
altogether
 
5:20 PM
@NikiC that's what I'm trying to do
 
@ircmaxell wait wut
 
but this should remain an error IMHO:
2 mins ago, by ircmaxell
namespace Foo;
class Test {}
use Bar\Test;
 
no it shouldn't
 
why not?
 
why should it… either make it all error or none…
 
5:20 PM
How can I direct the button to other site?
 
because use statements are not "per namespace block"
they are only for the following code in the namespace block
 
namespace Foo;
use Bar\Test;
class Test {
    public static function getInstance() {
        return new Test;
    }
}
var_dump(Test::getInstance()); // What does this do???
 
@NikiC Can we just change use statements to be top-level statements only before any meaningful code?
 
@ircmaxell that's a different case and an error ;)
 
@NikiC why is that different
(note, I'm starting to agree with you, I see what you're saying. I'm just trying to clarify the thought)
 
5:23 PM
I absolutely don't get why you should be able to use things mid-file…
 
@bwoebi I agree with you
I just don't know if we have enough to break BC there
also: that crosses into an RFC teritory. Right now, removing the error can be just a PR... I think...
 
@ircmaxell How important would the break be? Also it'd be an easily identifiable one you can fix just as easily.
 
@bwoebi well, would it be easy to fix? It's not just a "move the declaration to the top" because that can cause other issues
 
agree that we should require use on top
 
Literally all code I've seen to date (except some weird phpt tests maybe) put the use on the top.
 
5:27 PM
should, yes. Do we actually do it?
meaning for 7?
 
@ircmaxell If you do this genre of weird things, I can't help you either…
 
fair
I'll update the patch
 
@ircmaxell not sure. But we could discuss it on list to see feedback.
 
well, I'll update the patch for the other case
 
(And you then still can decide whether 7.0 or 7.1)
 
5:29 PM
if (extension_loaded('blah')) {
    use blah\Driver;
}
else {
    use other\Driver;
}
 
@Leigh not supported
 
really? hm (never done it, was just trying to think of a possible valid use case)
 
use must be a top_statement
 
@Leigh use is not a runtime construct.
 
use extension_loaded('blah') ? 'blah' : 'other' . \Driver;
:D
 
5:30 PM
This chatroom is fun.
 
@Jimbo it expects a literal qualified name
 
I know, no . for a start
:-(
 
@WTFZane hmm, why?
 
@bwo
sorry
@bwoebi it's educational.
 
@WTFZane from times to times, yes. Exploring the dark sides of PHP...
 
user895378
5:32 PM
WTF PHP PULLS. Your interface is so broken.
 
@rdlowrey what happened?
 
Hahaha even it is as dark as the challengers deep
 
user895378
The UI is totally broken so I can't use it to actually close a PR.
 
or did you get the 2 cm sized boxes?
 
user895378
Some idiotic half-baked jquery ...
 
5:33 PM
18 secs ago, by bwoebi
or did you get the 2 cm sized boxes?
is it that?
 
user895378
I can't get anything now
 
@rdlowrey which one? I can close it
 
user895378
^ close that.
 
5:34 PM
@rdlowrey because rate limiting ;)
@rdlowrey done
 
user895378
Thanks. I just did a real bugfix for that issue and merged it up from 5.5.
 
@NikiC you… closed without qa.php.net?
 
Can't you close pulls with comments, or is it just issues?
 
@NikiC how comes you can do that?
 
user895378
5:36 PM
@Leigh I know it works for bug reports, but this was a separate PR for the same issue that was insufficient to actually merge
 
so actually, now I do need the parent to implement the top level check
 
user895378
So it was just some dude's PR that was no longer applicable because I addressed the issue.
 
because checking the oparray is not robust (due to the block support for namespaces
 
@bwoebi magic
 
time to implement that as a separate branch
 
5:37 PM
@NikiC did you kill an unicorn for that?
nah… serious answer please?
 
yo whats up ?
 
user895378
Why in the actual zanzibar are people still sending mails about consistent function names ...
 
@rdlowrey they hope to start some drama at some point. No idea…
 
Or maybe they hope it might happen one day....
 
@bwoebi I have admin rights for the php orga on github
 
5:40 PM
i have one question, every time i come here I see the same people online. are you all paid from stackexchange?
thanks
 
yes lol
 
i was not talking to you
 
I still don't get it though, there's not that many functions that use _, how difficult would it be to add some camelCase functions with params ordered as expected? Wouldn't add that much bloat to the language and would allow the older ones to be deprecated over years...
 
but to @ircmaxell @rdlowrey and some others
 
@zeeks Be nice...
 
5:41 PM
@zeeks no
 
@NikiC We should just give every php-src.git contributor some rights there… :x
 
@Jimbo sorry :)
@ircmaxell aha okay thanks for the answer
well sorry for disturbing, bye
 
@zeeks That made me laugh… It's just a nice platform to communicate.
 
It's a free community @zeeks
And as you can see. (Which i Just saw earlier) the same people you see every time you come are somewhat room master? lol
 
have you ever met in real life ?
 
5:46 PM
@zeeks We actually all live in a big house together. It's televised, I'm surprised you haven't seen it.
 
hey @PeeHaa, still activity on the PeeHaa box?
 
@NikiC can't we use C++ comments? … Or is it just about header files?
 
I get told off all the time for c++ comments and not putting all my variable declarations at the top :(
 
@NikiC btw. I'm aware that I forgot to dtor the HashTable in zend_generator_node. I still need to push this.
 
@bwoebi don't worry I'm just scrolling through the code ^^ I don't get what you're doing there with all those nodes anyway
 
6:01 PM
so the "fix" breaks 32 core tests
 
@NikiC I had explained it in text form a few days ago… It's exactly that, just without a refcounter.
 
holy crap, this is really messed up
 
Anyone have a command for reliably counting lines of code in a directory, excluding directories like vendor/ and ignoring blank lines?
 
@NikiC addressed your comments in code… but not sure why there's an EG(exception) check missing.
@NikiC do you know why my PR didn't trigger a travis run?
 
6:19 PM
I assume that TSRMLS_CC was just by mistake
removing that fixes the build
 
please suggest a good book to learn php for someone with programming background.
 
^^ that's not a valid fix
 
helooooooo!
 
@rdlowrey and the test (ext/openssl/tests/bug64802.phpt) fails for me because I get
[5]=>
string(8) "Delaware"
 
@Tyrael please suggest a good book to learn php for someone with programming background.
 
6:32 PM
@IndrajithIndraprastham check out phptherightway.com while you are waiting for other suggestions
 
@IndrajithIndraprastham i) Don't spam, ii) don't ping people to ask questions. iii) room-11.github.io
 
user895378
@Tyrael fixing shortly ...
 
@rdlowrey I'm also seeing errors because of missing TSRMLS_CC from the php_error_docref usages in PHP-5.6
 
user895378
Will be sure to test with a zts build :)
 
@ircmaxell Awww… you mixed spaces between the tabs
 
crap, I'll fix that
 
6:53 PM
@rdlowrey thanks
 
and WTF are we using tabs for in the first bloody place
 
haha, the good old whitespace wars
 
for the first one
 
@Tyrael … just use tabs everywhere and you're fine…
no need for a war here.
 
@bwoebi I have my personal preference, but my opinion is that this doesn't worth the effort to discuss, just keep it consistent. :)
 
6:56 PM
;-)
 
but I'm always ready to get some popcorn when some people start bringing out the big guns and argue for hours for the one true coding style
 
@ircmaxell But yes, that seems to me like the best approach here.
 
@RonniSkansing yo. I need it for this weekend after that you can burninate it if you want :)
Also morning roomies
 
@bwoebi fixed
 
@PeeHaa morning. Oh you can have it for a year if you need it, no probs, just curious
 
7:02 PM
<3
Holy shit. I just found out it is already almost friday :|
 
user1642018
hi all.,
 
user1642018
i have a question posted here .,
 
user1642018
0
Q: PHP Custom two way encyption and decryption , what i am doing wrong?

AMBi am trying to obfuscate/encrypt a number into string and then again want to de-ubfuscate/decrypt that string to get a number. i cant use base64 or any other public available algorithmbs as the generated hash is gonna be personal and specific to each user and cant be shared with other users, it...

 
I stopped reading after custom encryption
 
user1642018
dang typo there.
 
7:13 PM
The type is hardly the problem when what you are trying to do is custom encryption
 
user1642018
its a simple obfuscation. not actual encryption , i guess.
 
user1642018
-1 vote already, thanks
 
Don't thank us. Thank the person who downvotes
 
There, answered that for you
 
@Sara \o/
 
7:17 PM
@Sara <3
 
@rdlowrey can fix them if you don't have time right now (I'm really behind with the schedule for 5.6.7RC1
 
Also: Calling that encryption
 
user895378
@Tyrael I'm about to, sorry. 5 minutes. Had to respond to an email from Hannes :)
 
np, thats fine
 
user1642018
Thanks Sara, i just upvoted your answer.
 
7:22 PM
@AMB Sarcasm aside, there are a lot of things wrong with that code. If you /really/ wanted to do this (and you don't, trust me, you don't), you need to rewrite your entire decode function (encode is... servicable)
#1 You're mutating your base_encryption_array in the global scope, so that on each call it gets flipped again, and again, and again
 
user1642018
@Sara thanks, learning bit by bit.
 
#2, the inner loop can be simplified with something like $key = substr($hash, $i, 3); if (isset($base_encryption_array[$key])) $string .= $base_encryption_array[$key];
But this is NOT encryption.
It can be trivially cracked with a pocket calculator from 1972
 
it's encoding
 
^^
The /Romans/ used "encryption" like this.
2015 deserves better
 
user895378
@Tyrael zts should be fixed now. Will look into fixing the failing test in a few minutes.
 
7:27 PM
thanks
 
Reminds me a bit of the algorithm a certain university once used to encode student social security numbers. It met with.... poor results.
 
user1642018
@Sara its for basic task , basically i tried base64 multiple times but everybody knows base64
 
I feel like I've got my Bitch-Face on today.
Do I need to pull it back?
 
user1642018
so i wanted something smaller and only i can decode/decrypt/de-obfuscate it., thanks .
 
user1642018
*simpler
 
7:28 PM
If it's basic enough to settle for "not good at all non-cryption", then it's basic enough to send in plaintext
@AMB "only i can decode/decrypt/de-obfuscate it" <-- And that's the part where you're making incorrect assumptions.
 
@AMB What's simpler than using stuff built for the purpose instead of writing your own and failing?
 
@AMB If I saw your application out in the wild, with no knowledge of your algorithm, I could decode your tokens before breakfast. And I'm not even terribly clever at crypto.
@ircmaxell would probably have it done before he woke up
@AMB So in effect, you're using plaintext. You're just lying to yourself that it's at all, even remotely in the shadow of "secure"
 
user1642018
@Sara i was under impression if i set the values in array then nobody can guess.
 
user1642018
them
 
user1642018
i guess, i was wrong.
 
7:32 PM
Schneier's Law:
> Anyone, from the most clueless amateur to the best cryptographer, can create an algorithm that he himself can't break.
4
 
Yep, you were wrong.
 
There's no shame in being wrong. There's no shame in learning
We all did that. We all still do that
 
<guilty-secret>I've done implementations like that in my dark past</guilty-secret>
 
me too
 
user1642018
strstr is new for me, comments are still coming.
 
7:33 PM
I've also done echo $_GET['foo']; more than once :p
 
That should totally be $_REQUEST['foo']
 
$_MIND_YOUR_OWN_BUSINESS_WHERE_IT_CAME_FROM['foo']
 
user1642018
i once did $GET_['id'] and it took forever to load page. idk why.
 
@salathe Eh, I generally like to be explicit about where my data comes from.
 
I forgot to add a sarcasm smilie :(
 
7:40 PM
ah, heh
 
mail sent to list
 
user895378
Thoughts on emitting E_WARNING any time SSLv2 or SSLv3 is negotiated even when explicitly allowed by the calling code?
 
eh
if it's explicitly allowed, then there shouldn't be an error
I'd throw a warning on explicitly allowing it ("You did something stupid"), but not when it's actually negotiated
 
Okay, this is driving me nuts.
echo "${NODELIST[i]}:${TASKS_PER_NODE[i]}"
I cannot seem to use variable for the indices of arrays in bash.
I look it up online and it is supported.
I can't get it to work.
 
Should i be $i? Also, you can enter and leave quotes at any time, IIRC. Then again, I hate bash and avoid such trickery.
 
7:47 PM
take it outside of quotes?
 
Maybe use temporary vars to hold the result?
 
@ircmaxell Still doesn't work.
@Charles Have tried that
 
dunno, bash isn't my thing
 
I always switch to perl when I find myself writing non-trivial things in bash.
 
FOO=(a b c d); i=2; echo "${FOO[i]}:${FOO[i-1]}" ... works for me :/
 
7:50 PM
i=0;
echo ${NODELIST[i]}
^ That will work
But it will not work in my for loop
Screw bash.
 
lol
 
@LeviMorrison is it supported in your version of bash?
 

« first day (1601 days earlier)      last day (3347 days later) »