« first day (2830 days earlier)      last day (2114 days later) » 
00:00 - 16:0016:00 - 00:00

4:00 PM
  Bucket *p = input_ht->arData + offset;
  Bucket *end = p + length + 1;
  Bucket *output_p = output_ht->arData;
  if (preserve_keys) {
    for (; p != end; ++p, ++output_p) {
      output_p = p;
      ZVAL_COPY(&output_p->val, &p->val);
    }
    output_ht->nNumUsed = length;
  } else {
    zend_hash_real_init_packed(output_ht);
    for (; p != end; ++p) {
      entry = zend_hash_next_index_insert_new(output_ht, entry);
    }
  }
^ There's my code, and I'm pretty sure it's taking the else branch there.
Essentially, it's not preserving the reference or something?
 
In order to use the openssl extension with composer (from phpstorm), do I need to provide a cafile and/or capath?
 
Or it is, and shouldn't, or something...
 
Is it even worth it trying to integrate composer into phpstorm?
 
@bwoebi I think I get where he's coming from. From the perspective of the user of a class, public Foo $foo doesn't offer any extra safety over public ?Foo $foo. You still have to check, either for null or for uninitialized. Not sure where I stand on that subject but that's how I interpret it
 
@pmmaga No
That is bullshit
 
4:07 PM
@bwoebi Seems like he's looking for guarantees that PHP doesn't give in other areas anyway…
 
How do you check if the value is uninitialized? You can't read it, or if you do it will TypeError. So don't try, just use it as if it is initialized.
 
A user should never, under any circumstances, ever (*) check for uninitialized properties, or any other status causing a TypeError
(*) exceptions apply
If you get a TypeError, that means that someone has fucked up during initialization. It's not your job to deal with that (unless you also wrote the buggy initialization code)
 
I quit responding because I didn't want to dominate the thread, but I did try to explain that...
 
I would consider improper initialization the same as a class returning the wrong type from a function - it's not your problem and it's out of your control.
 
@NikiC indeed, but it's still a matter of "trust", not something that is enforced
 
4:11 PM
@pmmaga It has nothing to do with trust
You can trust that it is initialized
If it isn't you fix the code or file a bug
 
that's fair for me
but I think this is the TL;DR of his thread
 
Can anyone see the mistake in my array_slice code? It's failing tests for bug 72598.
 
@LeviMorrison well, you dropped code ... that code was there for a reason ^^
That isref + rc==1 check is the important bit
 
If I add it then I segfault on the refcount bit.
 
Does @tereško have a sock puppet he can use in chat or is he only banned from Stack Overflow for questions and answers? FREE tereško!
 
4:16 PM
DOH I'm not assigning entry to &p->val.
 
@NikiC What are the issues with doing a check after __construct is called for all non-nullable properties to be initialized?
 
@Trowski Firstly, we still need to support property unsetting, so it changes literally nothing
 
Secondly, you can skip constructors.
 
@Trowski Second, uninitialized properties might be accessed inside the ctor as well, so you still have the problem there
And what Levi said
 
It's not some totally obscure thing that is done by Ocramius level hackery, either. We literally provide a reflection method for it.
 
4:22 PM
And finally, I'm not even convinced it's a good idea in the first place. E.g. what if I like to use named constructors and bypass __construct entirely?
 
Maybe 8 would be a good time to finally get rid of those
 
It would break a lot of code.
 
@pmmaga Maybe
 
I'm pretty sure there is a nontrivial amount of DB "hydration" code that uses this feature.
 
I'd be happy to revisit the question if and when we are getting rid of unset properties entirely
 
4:24 PM
@NikiC Sure, I don't see the point either, especially with unsetting. I was mostly just curious about the possibilities.
Skipping the constructor isn't much of an argument though, as I would expect any object where the constructor was skipped to be broken.
 
@LeviMorrison It has been throwing a deprecated notice since 7 but I guess so
 
@NikiC Unless that named constructor uses reflection to make the object, __construct is going to be called.
And if does use reflection… WTF.
 
In order for composer to autoload a class directory, do all of the classes must include a namespace? I can't use something like "psr-4": { "": "lib/" }? (I know that PSR-4 requires namespacing in the files, but composer's documentation regarding using "": as a prefix has me confused)
 
@Trowski If there is a construct, yes
@Trowski my longer-term plan here would be to have an object initialization syntax (as an alternative to ctor) and that one would check that the object is fully initialized
 
@Tiffany Using "" means composer will use the entire namespace as a path to search under the given path.
 
4:33 PM
@LeviMorrison have beers from time to time with him
 
@Trowski and if namespace doesn't exist in the files, it ignores them?
 
@ircmaxell He seem happy enough?
 
@NikiC So __init would override __construct?
@Tiffany Since it's the fallback, I assume if the file isn't found there it would error. I've never used it though, so I'm not 100% sure.
 
@Trowski what is __init?
 
@NikiC By the way, some languages solve this by prohibiting read access inside ctors
 
4:36 PM
@bwoebi which we're not going to do
 
right
 
@Trowski hm, okay, thanks.
 
@Wes what's up?
 
@NikiC Never mind, misunderstood what you said to mean an alternative constructor.
Which is what __init was.
 
Larry Garfield actually used __init as an example
 
Wes
4:39 PM
i was thinking if it was possible have what rowan asks only for public properties. public uninitialized properties are really bad. private and protected - don't care @bwoebi
 
The alternative syntax would be for objects with typed public properties then?
 
@NikiC Why doesn't the lower block do the ref check? e.g.
          if (string_key) {
            entry = zend_hash_add_new(output_ht, string_key, entry);
          } else {
            if (preserve_keys) {
              entry = zend_hash_index_add_new(output_ht, num_key, entry);
            } else {
              entry = zend_hash_next_index_insert_new(output_ht, entry);
            }
          }
          zval_add_ref(entry);
 
@Trowski Basically intended for value objects, so yeah
 
Wes
so someone is suggesting already what i was going to suggest? :B okay, great
 
!!lxr stream_socket_server
 
4:46 PM
[ /ext/standard/streamsfuncs.c#186 ] PHP_FUNCTION(stream_socket_server)
 
@LeviMorrison because that's what zval_add_ref does
It's the copy ctor for array elements
 
zend_hash_real_init_packed(output_ht);
ZEND_HASH_FILL_PACKED(output_ht) {
  for (; p != end; ++p) {
    zval *entry = &p->val;
    if (UNEXPECTED(Z_ISREF_P(entry)) && UNEXPECTED(Z_REFCOUNT_P(entry) == 1)) {
      entry = Z_REFVAL_P(entry);
    }
    Z_TRY_ADDREF_P(entry);
    ZEND_HASH_FILL_ADD(entry);
  }
} ZEND_HASH_FILL_END();
^ That look okay?
@NikiC This is why I prefer C++ ctor/dtor; I can raise the level of abstraction.
 
@LeviMorrison yah
 
5:23 PM
@LeviMorrison last time I saw him, definitely yes
 
5:33 PM
@Linus You're on early.
 
5:50 PM
@pmmaga "You still have to check, either for null or for uninitialized." - you don't need to check. If you see an uninitialized parameter exception ever, you go whack the people responsible for writing that and get them to fix their code. You don't handle it yourself.
 
@Danack I agree with that, but I can also sympathize with those who would prefer to see it enforced at a language level
 
setISODate sets current time(date is correct) – #76634
 
@pmmaga as I said in my email - ReflectionClass::newInstanceWithoutConstructor says hello.
PHP just isn't a language that has that type of safety.
 
@Danack Exception: Instantiating this class without setting all its typed properties is disallowed in .. :P
but I know, that's true and I think that the current implementation offers a good compromise
 
6:12 PM
@Danack another idea could be to just throw a notice/warning that the instance is not fully initialized. But I guess that would be pretty expensive
 
@pmmaga and still breaks doctrine. Unless you do it as the RFC proposes.
 
ahh.. true
 
Yees ..! My website is in the most optimal situation a website can be
 
Wes
well done
 
thx :-)
 
@kelunik Interesting... do you have an idea when v3 will be ready to start user testing?
 
@CharlesSprayberry You can test it now, but all the other libraries will take time. :P
 
I see
Is there anything I can do? Is it just refactoring to use Awaitable instead of Promise or is it more involved than that?
 
@CharlesSprayberry It's more, most promises aren't converted but entirely removed.
 
6:50 PM
I see
@kelunik Well, I'm interested in what comes out of v3. I've really enjoyed using amp so far. In between all the work you're doing for the new version if you could let me know what you think about the comments to your feedback in the phpunit-util AsyncTestCase PR I can get that wrapped up this weekend.
 
7:17 PM
evenin
@Tiffany thanks :)
 
7:29 PM
Sigh... of course I uncovered a silly edge case in array_slice...
 
Wes
@kelunik weren't promises the holy grail of async programming
 
@Wes No, just for languages that don't offer anything better.
 
Wes
in php that would be?
 
@Wes coroutines...
 
Wes
like, yield? :B
i know nothing of async. i probably should learn it at some point :B
i'm waiting for the good stuff, like async functions
 
7:34 PM
<?php

$assoc = ["one" => 1, "two" => 2, "three" => 3];

// If we go too far off the edge in the positive direction then we get an empty array:
assert([] === array_slice($assoc, count($assoc), 1));

// Unfortunately, this doesn't hold in the negative direction:
assert([] === array_slice($assoc, -count($assoc)-1, 1)); // fails
I knew the code looked wonky :(
I should emit a warning.
 
cv? stackoverflow.com/questions/37628425/… not sure if it counts. Dude asked question, found a solution, did not update question with solution, or post an answer with solution, and hasn't been seen since '16.
 
@Wes That exists now.
 
I guess if someone posts an answer at some point, other than author, then there wouldn't be sense in having it closed
 
Wes
$result = async foo();
or whatever
 
@Wes You don't need async for that, it just works.
 
7:43 PM
Feedback on warning message?
> Warning: array_slice(): The offset argument to array_slice was too far negative; in the future this will return an empty array in /home/levijm/Projects/php-src/array_slice.php on line 9
/cc @bwoebi @NikiC
 
@LeviMorrison What does it return now? false?
 
No, it sets the offset to 0.
Meaning, it gives you the (probably) wrong result.
 
@LeviMorrison IMHO, a notice like with strings. Not sure if it would be worth it to change the behavior
 
For clarification, if the array_slice offset is too far positive it returns the empty array without any warnings.
The behavior is not symmetric with negative offsets that are out of range.
I think there's a lurking bug with negative lengths too...
 
7:58 PM
Also, just realized that a negative $length is an ending offset, not a length. This function is just weird...
 
@Jeeves that last PHP bug 76634 is one of the bugs why I prefer Intl
I just don't understand why the PHP team wants to reinvent that wheel
Generic question: are you allowed to chat when your account is suspended?
 
@LeviMorrison too far negative? You mean like the absolute value of the offset was larger than the size of the passed array?
 
As in the array has 3 elements and you said to start at -5.
 
so yeah that
 
$assoc = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];
$slice = array_slice($assoc, -count($assoc)-2, 1));
^ This gives 1 element, even though it's clearly out of bounds.
 
8:13 PM
too far negative sounds weird to me
 
@LeviMorrison I think that's "expected"
We have this kind of behavior in a few places where going too far is allowed
Probably if you use a length larger than the array it will also just give you the whole array
 
It's okay to go too far.
The trouble is that a it starts it at 0.
The window is shifted to begin at zero, rather than truncating the results before 0.
Did that make sense?
 
//      [0, 1, 2, 3]
//  ^ ^
//  | |
//   V
//   You asked for these items, and array_slice gives you [0]?
 
@Tiffany evenin
 
8:20 PM
hi
 
@LeviMorrison Depends on interpretation
I'd say you first calculate the effective offset and then the effective length based on that
Not both first and then clamp it
Anyway, my preference is of course to throw them exceptions for everything, but I don't think the current behavior is strictly wrong given how things generally are
 
I'm very certain this is wrong.
 
Hmm, looks like someone has actually found an interesting security bug.
 
@LeviMorrison according to the docs, ".. then the sequence will have up to that many elements in it", appearantly it includes the negative amount.
 
As opposed to the usual "I will do anything to get that bounty" reports.
 
8:23 PM
@Code4R7 "up to" means there might not be that many to begin with, even in the positive direction.
 
@NikiC There are bounties?
 
If length is positive, then what we are essentially doing is a tuple of (beginning offset, length). If the length is negative then it's a tuple of (beginning offset, ending offset).
 
@LeviMorrison yeah, so the functions cuts it off at -4, then adding 1 and boom, there's your result.
 
@Code4R7 It truncated the wrong side.
 
why?
 
8:24 PM
@kelunik Yes, IBB bounty: hackerone.com/ibb-php
 
@Code4R7 Look at the way the positive version works.
 
-6 is truncated to -4, because at negative numbers. again from the slice docs "... If length is given and is negative then the sequence will stop that many elements from the end of the array"
Ok, I'll do that first :)
 
$input = [0, 1, 2, 3]; $offset = 2; $length = 4;
$slice = array_slice($input, $offset, $length);
 
I'd expect 2 and 3
 
@kelunik you feel that promises are wasted on yourself?
 
8:26 PM
Which is right, and makes sense.
It gave you the results that were in range, beginning with the one specified by the $offset.
Now apply that same logic to what should happen with:
$input = [0, 1, 2, 3]; $offset = -6; $length = 4;
$slice = array_slice($input, $offset, $length);
 
you get them all, and you're lucky. If you apply THAT logic to, say: $offset = 6; you get nothin'.
 
Logically it would give you [out of range, out of range, 0, 1] and then we return only the in-range values so [0, 1].
 
@LeviMorrison that's not what the docs say it should return
 
Except we don't. We say, "Oh, you definitely meant to say -4, not -6, so let me get that totally different result for you without even warning you about it."
@Code4R7 Quote it then.
 
it's using javascript's substr logic
 
8:31 PM
> If length is given and is positive, then the sequence will have up to that many elements in it. If the array is shorter than the length, then only the available array elements will be present. If length is given and is negative then the sequence will stop that many elements from the end of the array. If it is omitted, then the sequence will have everything from offset up until the end of the array.
 
And what about that says it should do what its current behavior is?
 
@LeviMorrison I got it... you mean this part: "If offset is negative, the sequence will start that far from the end of the array." which it does not.
So yeah, you're absolutely right it is a bug
because array_slice does not behave like the docs say
 
> The offset provided to array_slice was negative and was out of bounds. The behavior of these cases will change in the future.
@bwoebi Better? ^
 
Lately I found another 'bug': IntlDateFormatter->parse() should return an INT, but when 32 bit space is used up, that function returns a FLOAT instead. But as it turned out, it was the undocumented way of solving the Y2K38 bug... pragmatic? Yes. Fast? Yup. Easy? well.... yes... after a while of rethinking things again and again...
 
Howdy partial hospitalization program peers?
 
8:39 PM
@Code4R7 Does that happen on 64-bit systems?
 
@NikiC I haven't tried, as the Synology NAS has only a 32 bit CPU..
 
Ah
Okay, that sound sufficiently exotic that I won't tell you off about using a 32-bit system
 
@NikiC I agree, but that's what my most important customer is using
And since we're talking government, it takes a few years to apply for a real server
 
was it normal for people to write a class wrapper for mysql_* functions? years and years ago
 
@Tiffany yeah, I still did that for both mysql and mysqli
Now for mysqli only
 
8:42 PM
but doesn't mysqli already have a class/object interface?
 
pg_query_params is so nice, but not for mysqli
 
I'm refactoring out mysql_* usage and switching to PDO, but finding a bunch of wrappers for the mysql functions
 
Sorry, have to go, wine awaits :)
cya
 
sadly all of the mysql wrappers are in one class called ModelBase, with a bunch of other generic class methods, instead of separated out into their own class :|
 
How is this fucking OO?
 
8:52 PM
god, that "about you" screams red flags
> The most important thing to you about a new job is being surrounded by smart people.
@Allenph they're confused what OO is
 
> You GIT what I'm saying
That's so lame, and i often see something like this
 
first time I've seen it, but it still sounds dumb
it's like "LOL PROGRAMMER HUMOR LOL"
 
Time to head home. Later.
 
o/
 
9:10 PM
which sounds better for a diagnostic message? "Indentation does not match that of the closing identifier" or "Indentation does not match that of the end label"
for context: that's regarding flexible heredocs
 
@Matt I'd probably choose the latter.
 
@Matt the docs seem to use the first
 
yeah that's why i'm torn
 
Ugh. I'm going to be forced to apply for Laravel jobs soon.
 
9:43 PM
So how exactly does this dildo cook me a steak?
 
@Trowski Looks like it basically makes any pot a crock pot.
 
@Trowski youtube.com/channel/UCpFuaxD-0PKLolFR3gWhrMw - you not heard of sous vide?
 
@Danack No I have not, looks interesting. Though I'm not sure why I need something connected to my phone to do that. Perhaps it's due to my aversion to the needless connectivity that is being built into products.
 
@Trowski so you can do things like turn it on from work. And monitor what temperatuere the water has been.
 
9:58 PM
@Danack Heh, so I went from "WTF" to considering purchasing one :-P
 
 
1 hour later…
11:26 PM
Morgens 11
 
Yo @StatikStasis
 
How's Turkey?
 
Hot and drunk kinda sums it up :)
 
Yeah it's hot here too.
 
11:31 PM
So... good :D
 
How is Ekin? You guys doing anything fun while there?
Any sight seeing? Trips? Or just sweltering?
 
We will be going out for a vacation thursday
Sight seeing last days has been getting a pool for the garden :p
Which is awesome
 
nice! Wish I was going on vacation. I think it's going to be a 6 day work week here. Have 5 openings in my departments that I have to fill... QUICK!
 
I want to redo my web site (it looks so 1990s, currently).
I wonder: Bootstrap 3 or 4 ? Is Bootstrap 4 battle-tested enough by now?
 
@StatikStasis well that sounds like "fun" :p
 
11:34 PM
HA!
 
What is called hot over there in real units?
 
I went through about 60 resumes and found 4 qualified candidates. One person I called said they were available anytime before 1030. I said okay- how about 9am. They said - that's too late how about 830am... when they're already being difficult and confusing just trying to schedule an interview... I'm done with them.
39-40 Celsius
 
What was the position?
Damn
Yeah ok
That is hot
 
E-commerce Associate
 
:D
 
11:39 PM
We're taking care of our neighbor's dog while they're ALSO on vacation (lucky people... grumble) Need to go feed her. Talk to you later. @PeeHaa
 
Laters @StatikStasis
 
00:00 - 16:0016:00 - 00:00

« first day (2830 days earlier)      last day (2114 days later) »