« first day (1802 days earlier)      last day (3149 days later) » 

12:00 AM
ParseError: syntax error, unexpected identifier (T_STRING), expecting ',' or ')' in line 732 at /Users/Bob/amp-mysql/lib/Connection.php
looking at that line:
$this->connectionId = DataTypes::decode_int32(sugit push bstr($packet, $off));

lol… :-D
@Danack I don't see any technical advantage of having an Enum superclass though.
And in that case we might now get comments why that pointless superclass?
 
> Not because of technical reasons, but just seeing the arguments that would come from people on internals.
aka "omg you're adding methods to something that is not a class111!"
And there's going to be far more wailing about adding a new type rather than just further abusing classes.
 
Then we need to make it one… THEN.
 
Abe
12:43 AM
nasty issues with internet connection. feels like 20th century
 
@ScottArciszewski fyi: you aren't weird.
 
@Danack Have you seen the current proof of concept implementation? Abuse is an accurate word.
"Let me just copy these methods on here ad-hoc over here" ~ Impl
"This is undefined behavior… probably" (I should have put that in a comment there)
 
@LeviMorrison what's UB there?
 
@bwoebi That whole implementation of inheriting methods.
(probably)
 
@LeviMorrison I don't see why it should?
Also, it sometimes depends on which standard you refer to.
 
12:57 AM
:D
Anyway, if anything this would be a nice reason to have a base class.
But maybe not.
I don't know.
I was thinking it might make the implementation cleaner.
 
I really first would like to design the PHP API without any internals thoughts.
@ScottArciszewski well, just as weird as a dev should be. but not extra weird.
 
now you're making me nervous, do people actually read the stuff I post? D:
:P
 
@ScottArciszewski sometimes :-P
 
1:00 AM
@Danack So let me see if I understand you clearly. You want to be able to customize the behavior of serialize() on enums, correct? You want to assign a scalar at each definition or be able to hook a function or..?
 
I'm going to hardlink /dev/zero to /dev/urandom. On OS X.
CSPRNG functions will happily accept it :>
(but "sadly" OS X has arc4random_buf ...)
 
@LeviMorrison Yes. In order that the PHP code can read them from input, or save them into a DB, where the PHP code has no control over what the scalar values are, and they don't match what the enums 'mean', I think people need to be able to specify how scalars gets converted into enums, and how enums get converted into scalars.
Although that could be done via a separate function for each enum, I really dislike having to have a functionality that 'belongs' to a type, separate from that type. And yes I'm guessing that just having Enum be a base class (possibly with single method of getValue()), would allow this to be done as people could just implement whatever they needed to, rather than it needing to be part of the Enum RFC.
 
@Danack How would they override the base?
 
1:20 AM
// either this
// enum RenewalAction {
// or
class RenewalAction extends Enum {
    Deny,
    Approve

    function fromString($string) {
        // yes probably a big switch statement here,
        // but other things would be possible.
    }
}
And just to clarify, I think the information about how to convert a string into an enum being separate from the type is a bigger issue than the needing to have a switch statement. As if it's not 'built-in' to the type, you then have to make the code that does the conversion be aware of all possible types.
Because I can't see otherwise how you would do it without having to list all known enum types, which was what I was asking about before:
function toData($foo) {

    if ($foo instanceof DayOfWeekEnum) {
         return getDayOfWeekString($foo);
    }
    if ($foo instanceof MonthOfYearEnum) {
        return getMonthOfYearString($foo);
    }
    // Every other Enum type possible must be added here, which is not good.
    if (is_object($foo)) {
        // We can make sure objects we are serializing have a toData method.
        return $foo->toData();
    }
    //Must be a scalar, can be used directly
    return $foo.
}
 
Typically it's a serialization class that registers hooks with type names – See Google GSON: github.com/google/gson
(To directly answer your question, you literally do it for every type you want to serialize)
 
Hmm…
 
(And to clarify: I have actually used this library in a team of 5 people)
 
@LeviMorrison I'm being blind, where do they do the registration of hooks?
I'm assuming the example is meant to show that....but Java.
 
GSON will create a basic impl for each type unless you specify one – if you use value object like patterns this is fine.
(It would use Reflection in PHP to do this, probably)
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapter(MyType2.class, new MyTypeAdapter());
gson.registerTypeAdapter(MyType.class, new MySerializer());
gson.registerTypeAdapter(MyType.class, new MyDeserializer());
gson.registerTypeAdapter(MyType.class, new MyInstanceCreator());
 
1:36 AM
I've added two notes about the statement syntax and the single variable use. Though I'm not switching to the ==> operator, as I noticed many people expected typehints to work when they compared to Hack's short Closures. It also allows us to differ syntax-wise [e.g. for typehints] from Hack without causing any confusion later.
^ I want to add that to the announcement mails on internals.
is it fine that way?
 
In the announcement note that there were some further clarifications made about Symbol Choice.
 
@LeviMorrison hmm?
 
Symbol Choice was altered recently, wasn't it?
 
Abe
@Danack @LeviMorrison i imagine enums being just syntactic sugar over (possibly ordered) immutable maps
 
No announcement about it?
 
1:39 AM
@LeviMorrison Yes, the paragraph had been a bit expanded.
But it's still ~>
 
@LeviMorrison That's certainly a better description of how it would be done. You should probably add that to the RFC. Though my instinct is that having to register those things ahead of time is a bit of a pain for apps that support plugins where there could be a large number of enums in an app.
 
Sure, since you didn't change anything about the implementation or behavior I'm fine with that, but you should note it.
@Danack Sure – such a library could probably leverage Reflection to generate those for you though.
I'll be back in a bit.
 
I'll be back tomorrow, nn.
 
@LeviMorrison eih… I'm noting "Though I'm not switching to the ==> operator" ??
 
@bwoebi It's just a courtesy to note the changes.
 
1:41 AM
@LeviMorrison oh, you mean changelog in the RFC?
 
@bwoebi Even if you do that you should probably mention any changes on list.
People get weird about RFC changes close to votes remember?
 
Abe
something like this, perhaps? pastebin.com/VaGyB9m9
 
6 mins ago, by bwoebi
I've added two notes about the statement syntax and the single variable use. Though I'm not switching to the ==> operator, as I noticed many people expected typehints to work when they compared to Hack's short Closures. It also allows us to differ syntax-wise [e.g. for typehints] from Hack without causing any confusion later.
^ ???
 
@bwoebi Yeah, something like that.
Oh wait
I misunderstood what you initially said.
Carry on – you get it :D
 
lol? :-D
 
1:58 AM
Uh, forgot to actually send the announcement mail… minute ^^
RFCs for PHP 7.1: Short Closures (https://wiki.php.net/rfc/short_closures) now in vote phase. Thanks all those who had valuable feedback!
 
 
1 hour later…
any security issue ^?? :P
 
eh, that entire file? :P
 
@Ocramius What's that "omg" about that line?
 
@Ocramius keen to see your talk on the live stream, tomorrow
 
3:14 AM
where
 
@bwoebi nothing particular there, I'm just going through this file and it's regex mess
instead of using a proper HTML tokenizer parser.
 
Morning all
 
@Ocramius somebody must never have heard about x mode in regex…
 
lol, true :P
BUT WILL IT WORK ON PHP 5.1? ZOMG!
j/k ofc
 
Abe
3:16 AM
@Ocramius to be fair php dom parsers suck :P
 
@Abe it may suck, but it's still a parser, and it will simply reject tokens
 
Abe
i wonder what was so wrong with xml that they had to invent the html5 "random magic"
parsing xml is much, much easier
 
@Abe where can I retweet that?
 
Abe
lol
in fact, fuck trends. i'll serve as xml from now on
@Ocramius what about this: does "<link>" rather than "<link/>" justify having the html5 parser? because in 99.99% code i see, that's the only difference
most of pages don't even have images
 
@Abe indeed, it is annoying as fuck.
also, the fact that you have different allowed syntax depending on symbol (assuming a hardcoded symbol table)
also: webcomponents kinda challenge that anyway
 
Abe
3:31 AM
@Ocramius what do you mean?
xml namespaces?
or you mean allowed tags depending on scope
 
@Abe no, the fact that <img> is not self-closing, and that some other tags require a closing tag
so you cannot know if <my-component> is valid or not, as you don't know if a body is expected, and the parser depends on information on the tag definition itself, rather than just on the DSL
I need to stop going to wordpress talks, it makes me wanna have tequila shots at 11 AM.
 
Abe
ah yes. and btw they adopted the weirdest stuff in the html5 parsers and they didn't adopt the self closing tag syntax from xml
<div class="foo"/>
 
The html5 folk weren't building on xhtml (that dysfunctional group was going in a different direction). They built from html 4 and never gave any shits about xml. More interesting is they actually had to break from SGML in order to make html5, for as convoluted and wacky of a DTD you can make in SGML, you can't make the arbitrary custom data- attributes they decided for 5.
 
@PaulCrovella I'm fine with having non-validated parsed XML, tbh
 
Abe
^
 
3:38 AM
as in ignoring DTD/XSD. If you don't need HTML validation in first place, then don't frikken build HTML validation.
 
Abe
which they are bad too. would have preferred having data="{foo:'baz'}"
 
and for those who CARE about validity, they can simply use XML
 
Abe
all that to allow some big names to save bandwidth by not writing </p> imho
which could have been saved by having client side includes (xbl / <template>, whatever)
 
@Abe they got there with webcomponents anyway :|
 
Abe
yeah
html5 parser is pointless
and html5 rules are even more pointless
for instance <section> can contain <header>, and <header> can contain <section>, but that can't contain <header>
<section>
    <header>
        <section>valid</section>
    </header>
</section>
<section>
    <header>
        <section><header>invalid</header></section>
    </header>
</section>
total random
Fatal error: Method godhelpus::__toString() must not throw an exception. would pay good monyz to get rid of this
especially, i would have the fatal error telling at least the message of the thrown exception
 
4:07 AM
@Ocramius quick ddd question if you don't mind... when if ever would it be a good idea to make an entity immutable?
 
@Orangepill whenever you have something that represents an immutable concept in the real world
An event is an immutable concept, for example. A legal document as well.
An order too
 
okay... I think that's enough for me to go on...
 
4:32 AM
moin
 
5:04 AM
posted on September 22, 2015 by krakjoe

This release disables pthreads in all but the CLI SAPI. After many years of advising that multi-threading at the frontend doesn't make sense, I'm promoting the advice to hard and fast fact. Note that pthreads can still be loaded by phpdbg, but ...

 
5:36 AM
hai guys can we declare a variable inside join query?
 
5:57 AM
posted on September 22, 2015 by Joe Watkins

Fig 1. An extremely confusing sign.I've written on my blog, spoken in my talk, told strangers on the train: You should not use multi-threading at the front end of a web application, it does not make sense when the threading model is 1:1. Regardless of the fact that I wrote pthreads, and I know very well what is suitable and what is not, my advice is ignored: I get endless bug reports and que

 
6:14 AM
ohai @assertchris
 
6:31 AM
Hi gentleman.. i am facing a logout issue in my php application..When i am clinking on any random link application is automatic getting logout.. this is not on any specific link..happening with any random url or link after 2 min. Actually i am using a ajax call to check is there any new message come in database from other user. this ajax call is checking after 15 seconds.. When i make disable this ajax call no logout issue coming...
 
Morning
 
moin
 
6:47 AM
@samayo That seems really weird. I'll have a look at your resume if you want. Something must be wrong with it, you should at least get a bunch of interviews...
 
hi ..
Can any one look at my issue : i am sharing my code here.. codeshare.io/Hc023
 
Hi
i need help in login as admin and user in my project
can anyone direct me to any tutorial?
right now im starting from 0
i cant create for a 1 level of authorization but for multi not so great
*i can
 
@SebastianBergmann fix it and ship it
 
@FlorianMargaine :-)
 
6:58 AM
@MohdFadli what exactly do you want to do? what code have you written so far?
 
im trying to do a login page
that have authorization level
such as admin
user and guest
@Patrick
 
so that's what its called
 
Basically you'll have 3 tables, users, groups, permissions
 
sorry but my english is not so good, i have 1 table for user
so the table consist of username,password,level.
 
7:04 AM
@MohdFadli no
 
level refers to 0 and 1 for user and admin
or i need to split table?
 
table users (id, email, password_hash, group_id)
table groups (id, name)
table permissions (id, group_id, name)
You could also make it many to many with a mapping table, but it's easier to explain it this way I think
 
@SebastianBergmann that's what RC's are for I guess :)
 
@MohdFadli and please tell me you are not storing the password as plaintext?
 
@Patrick can u direct me to a learning website for RBAC.
yup, as plain text using varchar -,-
sorry but im a total newb in php
i though can just route it like if (level==0)
header(blablabla)
 
7:10 AM
@MohdFadli NEVER do that. php.net/password_hash
 
else header blablabla
and use protect to lock the page
 
@MohdFadli yes you could but as soon as you want to add more fine grained access control you will regret doing it that way
 
yes, been stuck at updating account :(
@Patrick is there anywhere i can learn more about RBAC?
 
@MohdFadli google it, look at the tables that I posted here
 
@which tables?
@Patrick think I'm going to stick to if statement. i cant seem to grasp the idea RBAC, i need a working prototype of RBAC to understand it and i cant find it anywhere. like i said before, I'm new to website development.
 
7:21 AM
@MohdFadli then you should learn and not develop something that you don't understand. I really hope this is just a learning project, considering that you use plaintext passwords...
 
@Trowski ping ...
some backlash, help me out ... github.com/krakjoe/pthreads/issues/492
 
took longer than expected for someone to start crying about that
 
morning!
 
he was easily pleased, would be nice if some people could chime in though ... I absolutely know I'm doing the right thing, I don't want to be on my own though ...
 
@Naruto What kind of browser game would it be?
 
7:42 AM
hey guys
 
Good morning
question: if I mock some non-abstract class in phpunit, but not all of it's methods, how to tell phpstorm that methods from original class "exist" in the mock? (since they are not mocked and therefore will be called)
 
anyone interested in assisting in a wp question
 
@Patrick thanks
 
@Patrick "no" is also a good answer :P
 
7:44 AM
dropping over there
cheers mate
 
Ah, gotten my first set of revenge down votes ^^
 
Morning
 
ok, here's free rep (:
0
Q: Mocked class: methods hinting

Alma DoI have the following setup: I'm mocking non-abstract class with PHPUnit, but not all of it's methods. Therefore, non-mocked methods still exist as a call to real methods in the mock. And the question is: how to hint that those methods are available (of course, with the proper signature) ? I'll...

 
Abe
8:00 AM
@AlmaDo /** @var RealClass $mock */ ?
 
@Abe no, this won't do, it will also allow mocked method to appear
 
posted on September 22, 2015 by nlecointre

/* by d4b0urn4 */

 
(updated the question just in case)
 
8:20 AM
Repost from Reading someone else regex ^
TCL quality sure has decreased.
Marketing team must've taken over.
 
> and traits this as an error
@AlmaDo ^
 
?
 
treats this as an error
 
yep, FF spelling fix isn't good :\
 
Hey,any ideas why i don't get an output?
<?php

function multiplication (){
$var1 = 3;
$var2= 5;


while ($var1 <= 1000) {
for ($i=0; $i++;){
$var1 * $i;
}
}
echo $var1;
}
?>
 
ThW
8:29 AM
@sguetsch You don't call the function. btw Please use a nopaste for larger source snippets.
Morning
 
@ThW How can I do this?
 
case "Delete":
$empgrocID = $_POST['empgrocID'];
$empgrocmstID = $_POST['empgrocmstID'];
$total_items = $_POST['total_items'];
$total_amount = $_POST['total_amount'];
$Deletequery = "DELETE FROM tb_empgrocery WHERE empgrocID='$empgrocID'";
$atecCoop->query($Deletequery);
$Updatequery = "UPDATE tb_empgroc_master SET total_items='$total_items', total_amount='$total_amount' WHERE empgrocmstID='$empgrocmstID'";
$atecCoop->query($Updatequery);
break;
Why total_items and total_amount values are 0?
when I delete some row.. It must compute the total amount and items left
When I add some rows.. This compute all the total items and total amount that has been ordered.
case "Add":
$itemno = $_POST['itemno'];
$qty = $_POST['qty'];
$unitprc = $_POST['unitprc'];
$amt = $_POST['amt'];
$coopmemid = $_SESSION['kiosk']['is_coopmemID_kiosk'];
$totamt = 0;
$totitm = count($itemno);
$a_empgroid = array();
for($x=0; $x<$totitm; $x++) {
$Addquery = "INSERT INTO tb_empgrocery (coopmemID , date_ordered, item_no, qty_ordered, unit_price, amount)
VALUES ('$coopmemid',(NOW()),'$itemno[$x]','$qty[$x]','$unitprc[$x]','$amt[$x]')";
But when I delete some rows why it does not compute the rows left and values of it are 0?
 
Hi everyone
 
ThW
@Micaela Please use a nopaste service with highlighting and proper indent. This is not readable. You need to read about prepared statements and/or value escaping, too. The post values can break your SQL.
 
8:46 AM
 
@Patrick you can put xkcd link to have oneboxing
 
@FlorianMargaine I know. I was too lazy and had the picture already open because I'm writing some code guidelines at the moment
 
How can i implode this array that i will get all the values of the "inner" array?
Array ( [0] => Array ( [klfdnr] => 693 [plfdnr] => 0 [name] =>blah [vorname] => peter [adresse1] => [adresse2] => [strasse] => fwfwefwe [land] => D [plz] => 42341 [ort] => pgfwefwe) )
 
9:06 AM
 
@Patrick ?
 
@Micaela go read about sql injections before you touch any more code please
 
Guys, can you advice me on Best Opensource Data modeler tool.
I googled but, i need something best of best.. i dont want to test and try.
 
So what? @Patrick
 
@sguetsch does your array has many child-child arrays?
then you need to iterate the code manually..
or use recursive algorithm with array_values
 
9:21 AM
@Rafee Nope, it is the result of a query with exactly 1 row
 
Morning all
Any reference about URL rewrite?
 
@Micaela Your code is vunerable.
check this http://php.net/manual/en/mysqli.real-escape-string.php
Try using http://pastebin.com/, check your form fields.
Morning Due..
apache?
@tereško Just ping me once you are get up..
 
9:41 AM
@Rafee no need to say it again and again. @ThW already told me
 
Morning.
 
evening..
 
@Duikboot o/, got up late today? :P
 
o\
No was fixing Wordpress malware website(s) :D All clean now! ><
 
10:03 AM
o/ room11
was wondering how you set the codes for your exceptions? Is there any hierarchy behind that?
Or smth that does not clash with error codes?
 
10:27 AM
Any idea why this returns 3,6,9,12 instead of 3,6,9 ?

$var1 = 3;
$res1 = 0;
$i = 0;
$sum1 = array();
do{
$res1 = $var1 * $i;
array_push($sum1,$res1);
$i++;
} while ($res1 <= 10) ;
 
@samayo When you land an interview be sure to use these top interview techniques.
 
10:41 AM
morning
 
10:58 AM
Moin o/
 
Anonymous
@Fabor :D
 
@Duikboot wordpress and clean? :P
 
Anonymous
@Patrick I'll mail you the CV.
 
@sguetsch because 9 <= 10 ? And your condition is at the end, so...
 
posted on September 22, 2015 by nlecointre

/* by Jrich */

 
11:14 AM
@Rafee ping?
 
11:51 AM
hi
 
echo("Hello");
 
Does anyone actually use the functional "echo()"? :)
 
printf("Good %s", $timeOfDay);
 
can you please recommend me a php tutorial
 
@DamienOvereem they don't act as function brackets, they're just precedence thingies when used like that.
 
thanks
 
Actually dropped a stackoverflow question about that @Danack: stackoverflow.com/questions/16688398/…
 
how about a video?
 
Thing still bugs me
I suggest youtube.com. The search bar at the top is amazing.
 
lol
cuz i've already searched but I don't know which one is the best
 
11:59 AM
That is because PHP is quite open. The "best" is pretty subjective.
 
@DamienOvereem If you want to see how code is actually being interpreted into bytecode by PHP, checking it on 3v4l.org is the easiest way.
It's exactly the same in that case.
 
I mean best for beginner
haha
 

« first day (1802 days earlier)      last day (3149 days later) »