« first day (3413 days earlier)      last day (1532 days later) » 
00:00 - 15:0015:00 - 23:00

3:00 PM
there's no working around it ... you might be able to write code that executes, but as I said before it that results in a vm that could crash at any moment, then nobody can use that code ...
 
Which one is better?
- Making a PHP function which gets width and height and resizes the given image to that dimensions
- Storing a image in 4 different sizes and use them directly
 
@Shafizadeh second option is better for larger volumes
 
the data maintenance would be hard in that case
 
Option 3: An API that dynamically resizes an image on demand
 
3:04 PM
well, that API isn't that PHP function I said?
 
Depends when the image is used
 
Minor Service Outage | Issues, PRs, Dashboard, Projects has Partial Outage
 
plenty of feedback on the language evolution rfc
 
@NikiC Yeah, the ... is for ergonomics of intent. I imagine we'll see things like array_map(strlen(...), $foo). This is a bad example, but imagine something that can take variadics itself for the array_map.
 
Minor Service Outage | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage
 
3:09 PM
Until I got hired at Datadog this was the RFC I planned to push for PHP 8.
After this I was then hoping for a way to signature check callables.
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage
 
@LeviMorrison But array_map requires at least two arguments wouldn't it be better to put two $ placeholders and variadic one ... at the end? The example with array_map(strlen(...), $foo) could look like array_map(strlen($), $foo)
 
@brzuchal I'm not partially applying the map, I'm basically creating a closure for strlen instead of using a string.
 
@NikiC got a question regarding editions, how could standard library function/classes etc. be solved if signature changes? If for eg. argument order changes, would it be multiple symbol tables one per each edition?
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage
 
3:21 PM
@LeviMorrison Yes, that's why I've put strlen($) at the last example
 
... and $ are not any different.
 
@brzuchal Standard library changes are out of scope
Editions is only about language changes
 
does out of scope mean they'd be rolled out for everyone?
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage | GitHub Pages has Partial Outage
 
@Ekin It means they are unrelated to the proposal. I have no intention of doing standard library changes with it, and think doing that is a bad idea.
 
3:25 PM
I see your point
 
Standard library should change the way you change any library. The fact that we don't want to do that has nothing to do with technical limitations
 
@NikiC Ok, but if I write library in declare(edition=2020) and useimplode(string $glue, array $pieces) which for now is in PHP 7.4 and that would for eg. change in PHP 9.0 where assuming the same edition is supported but implode(array $pieces, string $glue) is changed, my library therefore even if uses edition=2020 will stop working, right?
Meaning when writing library using editions gives no guarantee code would work!
 
scalar object methods ftw :-) almost all the 'order' arguments go away as as the source isn't needed anymore.
 
@brzuchal I'm being unclear here. There will be no library changes.
 
@MarkR what if scalar method signature changes over PHP versions? and two editions are supported within the PHP version where signature changes?
 
3:27 PM
That's back to 'dont change them as part of editions'
There's only 2 options, a) change them everywhere or b) create modules for them and allow the user to decide which module to use
 
@NikiC If I write library in specific edition for eg. 2020 and that edition is supported for eg. by PHP 8.0 and 9.0 but standard library method/function signature changes, then edition doesn't guarantee code would still work, it only guarantees code would parse
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage | Gists has Partial Outage | GitHub Pages has Partial Outage
 
Much outage
 
I should screenshot that and send it to my boss to remind him why "No, I'm not going to remove our internal gitlab ci/cd server in favour of github"
 
Shit, can you send that to my boss too?
 
3:38 PM
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage | Gists has Major Outage | GitHub Pages has Partial Outage
 
@MarkR If signature changes are not part of editions and with above what said I wrote a library which is actively mainained and supports PHP 8.0 I would have to support two versions of my library separately for PHP 8.0 and for PHP 9.0 cause they can differ in standard library API, what's the benefit for library then?
 
That's always going to be the case.
Even without editions
 
@MarkR Ok so editions saves me only from language syntax and behaviour changes
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage | Gists has Major Outage | GitHub Pages has Major Outage
 
Correct, or rather, only delays it. There's only one solution to mixing editions and lib changes and that's to have imported libs.
 
3:48 PM
@MarkR Which leads to separate symbol table per file scope, right?
 
Correct, or rather the lookup mechanics
Maintaining a lib version indefinitely, or for an extended period, is much, much easier than maintaining two engine styles indefinitely
 
Incident on 2020-02-19 15:17 UTC | API Requests has Partial Outage | Issues, PRs, Dashboard, Projects has Partial Outage | Notifications has Partial Outage | Gists has Major Outage | GitHub Pages has Partial Outage
 
@MarkR that's not an issue for userland libs but how to do that with standard library shipped with interpreter? it would require either standard library to be decoupled from interpreter or for it to ship with multiple library versions, right?
 
The latter, but just because you have multiple versions doesn't mean you have to re-create everything. Effectively you'd just alias everything into a module and only change the functions you need to between versions.
 
Incident on 2020-02-19 15:17 UTC | Issues, PRs, Dashboard, Projects has Partial Outage | Gists has Partial Outage
Incident on 2020-02-19 15:17 UTC | Gists has Partial Outage
Minor Service Outage | Gists has Partial Outage
All issues have been resolved!
 
4:31 PM
Hey guys,

Actually, I have a question very similar to @brzuchal.
I was considering proposing a RFC to "fix" the fact that many functions return "warning + false" instead of throwing an exception in case of error (I'm the author of SafePHP so this is a bit my pet peeve : https://github.com/thecodingmachine/safe). I talked to @Ocramius about this idea that likes it and advised me to ask about it here.

For instance, strtotime would throw an error instead of returning "false", that invariably gets interpreted as a 0 and then as 1970-01-01 :)
 
We've already had a couple of test implementations of strict errors but the amount of changes which would need to be made would be pretty huge
 
@DavidNégrier This kind of change is potentially in scope.
Many errors in library functions already throw in PHP 8, so you may want to look over those changes first
 
@NikiC I already had a look. Actually, I even contributed some (github.com/php/php-src/pull/4837)
 
If that's the kind of thing in scope and we had an API available could start the changes fairly quickly...

RETURN_ERROR(ErrorLevel, ExceptionClass, Message, ...) ?
 
@DavidNégrier You can use this label if you are curious about the (majority of) these changes: github.com/php/php-src/… :)
 
4:39 PM
@MátéKocsis Thanks!
 
Only about 2200 places that would need changing
 
@MarkR Absolutely. If I understand correctly, most functions that return "false" are actually triggered by "php_error_docref(NULL, E_WARNING, ...);"
 
@MarkR "only"
 
@MarkR Yes. I'm completely aware of this. The longest part is not fixing the code but rewriting the tests actually.
 
php_error_docref doesn't return the false, it just prints the error out.
I'd probably not bother re-writing the tests
 
4:42 PM
@MarkR true!
 
If the error message is going to be identical, run the test suite with the exceptions suppressed and only use exception mode when needing to test a specific class being returned
Otherwise you'd need to duplicate every test which tests for an error
 
@LeviMorrison You wanted to do some pair programming ... how would that work technically?
 
@MarkR It makes a lot of sense! But I'll still need to check for the type of the exception that is thrown.
 
@DavidNégrier When I was writing the tests for GD (where I added a fair few exceptions) I used short closures to speed up the process:

check(fn() => your_call_here())
 
@MarkR Excellent idea! :+1:
 
4:48 PM
Rather than having to write try / catch blocks around everything, I let a helper function call them all and then format out a message which contained the class name. If you suppressed the error message from and then read it using get_last_error or whatnot, it could be d ual purpose
 
@MarkR Sounds good.
 
github.com/php/php-src/commit/… bottom file shows it pretty well
 
If I want to get this moving, what do you think is the best strategy? Should I start with a RFC? Should I start with a prototype (maybe cover a few functions) and write a RFC later?

Also, if I'm starting to work on a PR, shall I target the future "edition" mechanism?
 
Editions are more theorycrafting at the moment as far as I know, expect world war 3 between now and it becoming reality.... but I'd think if you could get an API approved via RFC, you could start making changes without actually effecting anything even if you comitted them?
Nikic would be the person to ask.
and hit up @Girgias too because he's been churning out 90% of them
 
Thanks for the tips! I'll do that!
 
4:55 PM
... would including the potential exception type in a notice / warning be too messy do you think?
 
would it be safe to call Levi's implementation of covariance/contravariance as "true type variance" in comparison to parameter type widening?
or I guess, in comparison to what is traditionally understood as type variance in other languages
 
@MarkR any idea how lib import could work thinking of it again with per file import with version constraint can only lead to a huge pain in the ass
 
File level importing is pretty much how every language works which uses modular library versions
That's not the problem
Passing a function name as a callable to a function which uses a different stdlib, that's the problem.
 
@MarkR lol, I did, no response :D
 
5:13 PM
@MarkR if converted to closure when callable type-hint found that's not a problem, when only as a string somewhere without context should result in function not found, unless you use it explicitly by use clause, right?
 
strings are the main way of passing them around (at least unless a method call)
 
@brzuchal That might be a nice solution to allowing class properties to be declared callable.
 
The solution is to unify the constant + function tables and create a closure on access to a function IMHO
 
That would be the eventual, preferred solution, yes, but I'm looking at what would work now.
 
@NikiC I would start a zoom meeting with a password and share my screen.
The code is open source, so that part isn't an issue or anything.
 
5:24 PM
@DavidNégrier you can PR warning to Error promotions for Programming Errors (invalid mode, types, ...) directly into master as we are changing them. haven't had time to continue currently and still waiting for @NikiC to review some (which are maybe too big so I maybe should do smaller ones) but have a look at an extension that you hasn't been done yet and look into it
@Derick are you going to the PHP London conf social tonight?
 
@Girgias Any pointer to an extension that hasn't been done yet I could look into?
 
@DavidNégrier LDAP, Intl, for sure and IIRC none of the XML extensions have had anything done to them
 
@Girgias Thanks! I'm actually in London (at the speakers dinner tonight and afterwards a the social). Maybe we can talk about it there!
 
@DavidNégrier sure :D
 
@MarkR That's not sufficient enough, think of object properties where closure is assigned and method with the same name
 
5:31 PM
I'm not following, referencing standard functions wouldnt be within the scope of properties
 
Ok, though of merging const and function tables dunno why on what you said
 
Doing something like foo(strlen) would typically look for strlen as a constant, if the tables get unified (to warn on collision) or just modify the lookup, strlen on its own without an arg list following it could just return an unscoped closure generated on-demand
 
<?php // v8.0 where for eg. array_walk(array &$array, callable $callback): bool
class Compat {
  public static callable $walk = 'array_walk';
}
<?php // v9.0 where for eg. array_walk(callable $callback, array &$array): bool
Compat::$walk; // should be a closure of array_walk(array &$array, callable $callback): bool ??
@Trowski like that?
Example is with static field cause I wanted it to be short
 
@brzuchal Yes for the v8.0. I'm not sure what you're trying to show for v9.0?
 
Hmmm... good question
 
5:41 PM
Compat::$walk should be a closure in 8.0 as well.
 
Ok I know, I was poking to importing lib in different versions in two PHP files as we talked about importing libs per file scope previously with @MarkR
 
Ah, ok.
 
@Girgias I am wondering if we'll be able to continue promotions during feature freeze. If not then we'll have to hurry because this is our last chance for 3+ years to get rid of some silly warnings. :D
 
@MátéKocsis I would expect it to stop during feature freeze, but I'll try to get back to it, just was overflowed with coursework and exams for the past 3 weeks
 
Meaning that Compat::$walk should be converted into closure using array_walk which is implicitly imported in first file, then when used in another file which eventually imports stdlib in different version where argument order differs, closure stays untouched
 
5:45 PM
Yeah, I also expected so (but hoped that we'll have a little bit more time left ^^)
 
@MarkR on your new RFC, how does it behave if I unset($this->prop) before it is initialized the first time? Same as before?
Asking because I still want to have immutability on most of my entity stuff in Doctrine
 
@Ocramius I think that RFC is probably dead in the water now Nikic proposed editions and used non-extensible properties by default as an example
 
It's opt-in syntax, don't think it is affected?
 
It should behave as before if memory serves, it only kicks in on IS_PROP_UNINIT and I don't think unset restores that flag
 
Oki, so it should be the same. I can most certainly write tests for it, if you want and have a branch that builds
 
5:53 PM
Do you mean the rigid properties one?
 
@Ocramius You meant me ^^
 
damn auto-complete. Sorry, @MarkR @MátéKocsis :|
 
I was also unsure which RFC you mean.
 
xD
 
I'm mostly interested in read-only stuff. Adding immutability everywhere has made my developer experience so much damn better over the last year
like... stuff actually MAKES SENSE HOLY SHIT!
 
5:55 PM
@Ocramius I can relate very much :)
 
now of course everything is @psalm-readonly, so that means that tools like PHPUnit and co still break everywhere
 
@MarkR Why an interface and not a class modifier, for eg. locked or something like that?
 
@NikiC Do you have any specific concerns? If not propose a time, keeping in mind I'm in UTC-7. Happy to clear almost anything else in the schedule on my side.
 
Because there's precedent for using stl interfaces to change object behaviour and there's only so many keywords we can put before a class before it gets ridiculous
 
@MarkR interesting concept about rigid classes, I like! :+1:
Just wondering if rigid is the correct naming (maybe gets confused with sealed?)
 
5:57 PM
@Ocramius If PHP evolution passes i'd expect it to become default
 
@Ocramius So to answer your question: I think it depends on the implementation. Currently, (if I remember correctly), you'll still get an "Unable to unset final properties" exception. But I'll double check it.
 
@MarkR YESSSSS
@MátéKocsis what interests me is that before state is initialized, __get, __set and __isset are triggered
@MátéKocsis this would allow stuff to work on doctrine entities, so:


class MyThing
{
public immutable int $theDbFieldHere;
}
 
6:12 PM
chokes on my tea okay I didn't expect this to work but...
 
Why didn't you expect this to work?
It's pretty standard
 
Look closer
 
@Ocramius Hmm, currently all uninitialized typed properties can be unset, after which __get(), __isset(), __set(), and __unset() are triggered.
 
@MátéKocsis are they still immutable once being set?
 
@Ocramius yes, they are "immutable" once they have been initialized.
 
cmb
6:19 PM
@MarkR always enable notices: 3v4l.org/bpiMK (fails on master, btw)
 
@MarkR is it becoming a closure on line 7 ?
 
@Ocramius So does think behaviour suit your needs?
 
That's because I'm not running on master, I've edited _zend_quick_get_constant to return a closure based on the function table
 
@MátéKocsis thanks, that seems to be all I needed. I'll obviously need to write more tests around it, but I think it will work.
 
   print_r(
        array_map(
            strrev,
            ['hello', 'world', 'superkala', 'fragilistic']
        ),
   );

Array
(
    [0] => olleh
    [1] => dlrow
    [2] => alakrepus
    [3] => citsiligarf
)
 
6:21 PM
@Ocramius I also tried to write as many tests I could, but I'll need quite some more. For example for this very use-case. So thanks for the input! (I'll also answer you a bit later on-list)
 
cmb
@MarkR ahh! The result makes even ~more~ sense. Still potential BC break (mostly due to case insensivity).
 
zv = zend_hash_find_ex(EG(function_table), Z_STR_P(key), 0);
if (zv) {
zend_function *fptr = (zend_function*)Z_PTR_P(zv);
zend_create_fake_closure(EX_VAR(opline->result.var), fptr, null, NULL, NULL);
return SUCCESS;
}

I have no idea how bad that actually is, I'm assuming very, but yeah
 
user12799634
Hello, Please can you take a look at this topic? :)
https://stackoverflow.com/questions/60287397/relocation-of-option-and-answer-key/60287660
 
@MátéKocsis thanks! I'll gladly prepare a WIP patch on ProxyManager to support your RFC as a "works out there in the wild" scenario, if that helps :-)
 
@Ocramius Thank you very much! If the RFC is accepted then I'll gladly accept the offer :)
 
6:25 PM
I'd do it before acceptance :D
YOLO!
 
@MarkR s/kala/cali
 
@Ocramius So that we can promote the RFC with the "Tested and approved by Ocramius" slogan? ^^
 
Oh cool, using a closure automatically reflects the original function's parameter names and such
 
@MátéKocsis dunno if that's a positive thing, nor if it is perceived as positive in internals :|
 
@Ocramius Then please prepare the patch and I'll try to poke with it!
 
6:31 PM
it's kinda like "this nuclear device has been approved by Dr. Strangelove"
 
@MarkR I was about to point out variable function names until I read one of the examples and saw that it used a string for the variable function type, which is why you followed up with "look closer" I'm guessing
 
@MátéKocsis Tested and approved by @Ocramius usually means "This feature should never ever exist and within 6 months will be used in so many unexpected ways it will hold back the language for decades to prevent breaking his code"
@Tiffany That's correct
 
yup
 
@MarkR :D Haha, fingers crossed that it's an exception in this case :P But I still (vaguely) remember about the blog post about type hinting against array items by using variadic args + Closures + ... That was insane indeed.
 
One day we'll just have to add a way to register classes on the fly with whatever interfaces / parents, and then you can abuse it to your hearts content xD
Reminds me I need to install proxy-manager so I can have symfony lazy load my services
 
user12799634
6:42 PM
I have a problem, can anyone help?! stackoverflow.com/questions/60287397/…
 
user12799634
I have to create this exam paper :))
 
What's wrong with the current answers?
 
user12799634
@Tiffany I get this error in the answer key part imgur.com/aPojYtl
 
Copy and paste the text into a gist. Screenshots are unhelpful
 
user12799634
 
6:50 PM
I'm willing to help you try to figure it out yourself, but I won't do the work for you.
 
user12799634
@Tiffany I see So what should I do?
 
First off, answer_key within implode is calling a function, either that needs to be a variable (as indicated in a line above) or there's a missing function
 
I'm an idiot... just wanted to formally state that.
 
@StatikStasis For added formality, I recommend writing it on letterheaded paper
 
Noted.
Hopefully the statement is enough for the purpose of this room. =P
 
user12799634
7:02 PM
`echo $element->id. " - " .implode(answer_key[$element->id]). "<br>"; `
to
`echo $element->id. " - " .implode(" ", answer_key[$element->id]). "<br>"; `

like this? @Tiffany
 
@Emre6 answer_key[] should be $answer_key[]
 
user12799634
Answers:
Warning: implode(): Invalid arguments passed in /home/ssss/public_html/_SubDomains/My/test6.php on line 38
1 -

result
 
code?
 
user12799634
foreach ($employee as $element) {
echo $element->id . " - " . implode($answer_key[$element->id]) . "<br>";
}

@Tiffany
 
you don't need to keep pinging me
entire code, not just the loop
paste it into gist.github.com
 
user12799634
 
first, I would test to make sure that you're getting the values you're expecting, either with var_dump or a debugger
 
user12799634
$element->id . " - " . var_dump(implode($answer_key[$element->id])) . "<br>"; (?)
 
at line 4, you can add var_dump($employee); to ensure that your code is pulling values from the database (if you haven't yet tested if you're pulling data from the database); line 6, you can add var_dump($element); to make sure the loop is iterating correctly
I get the feeling that in $answer_key[$element->id] = array_slice(array('A', 'B', 'C', 'D', 'E'), array_search($element->o1, $answers), 1) . $element->o1;, instances of $element->o1 should be $element->id instead
lines 8 through 12 are weird... why is that being done in a loop
 
user12799634
7:31 PM
I got the question contents and options with var_dump but I still keep getting this error -- Warning: implode(): Invalid arguments passed in Warning: implode(): Invalid arguments passed in ...`
 
user12799634
@Tiffany $answer_key[$element->id] = array_slice(array('A', 'B', 'C', 'D', 'E'), array_search($element->o1, $answers), 1) . $element->id; (?)
 
the first argument of array_search
 
user12799634
@Tiffany Unfortunately I have no idea about this :)
 
does $element->01 return what you expect it to?
ORMs are weird
 
user12799634
$element->01 there is no such thing in my code. I use --> $element->o1
 
7:38 PM
yeah that, typo
 
user12799634
@Tiffany array_search($element->id, $answers), 1) . $element->o1; (?) unfortunately it didn't work
 
I'm pulling apart the code inside 3v4l.org. I can't verify that what I'm suggesting is correct. I'm guessing lines 8 through 12 should be rewritten as $answers[] = $element->o1; since the answer is always in the o1 property, and the array should be dynamic
 
user12799634
It looks like this if I remove the "implode".

Answers:1 - ArrayGlandular-cystic hyperplasia of endometrium
2 - ArrayDeficiency of iron-containing enzymes
3 - ArraypH medium
4 - ArrayLice
5 - ArrayKnee-cap
6 - ArraySinusoidal
7 - ArrayEnterobins vermicularis
8 - ArrayDysentery
9 - ArrayIgE and IgG
10 - ArrayDeficiency of iron-containing enzymes

via "echo $element->id . " - " . $answer_key[$element->id] . "<br>";"
 
this is what I've done so far 3v4l.org/MB2ke
arrays start at 0, questions start at 1, so be aware of off-by-one errors
I see, so it needs to be something other than o1
since answer needs to be tied to question, I suggest using a multidimensional array to store the values of the question and answer
 
user12799634
7:54 PM
@Tiffany o1, o2, o3, o4, o5 these are options but the correct answer is only o1 (?)
 
going to tell you now, I don't know the answer, but I'm willing to take some time to help you find the answer because I like to learn how to do stuff
so part of my messages are things I've noticed as I'm working through your problem
I cannot provide you an authoritative answer
 
user12799634
I see, thank you for your time
 
I can continue to help you if you want me to, but I may be wrong, or I may not be any help at all.
 
Is there a good way in the engine to convert non-packed HashMap into immutable one?
 
user12799634
@Tiffany If you have an idea, of course I would like you to say it because I don't have it unfortunately
 
8:08 PM
alright, how many questions total are there?
 
user12799634
@Tiffany It works now!
 
cool, what was it?
 
user12799634
@Tiffany I just deleted this part.
 
user12799634
$answer_key[$element->id] = array_slice(array('A', 'B', 'C', 'D', 'E'), array_search($element->o1, $answers), 1) . $element->id;

to

$answer_key[$element->id] = array_slice(array('A', 'B', 'C', 'D', 'E'), array_search($element->o1, $answers), 1);
 
yeah, that makes sense
 
user12799634
8:10 PM
@Tiffany I'll check the answers.
 
user12799634
For now, everything seems to be right.
 
user12799634
Thank you again for your time and effort!
 
cool, good luck :)
 
user12799634
you too
 
9:47 PM
Mornings
 
10:15 PM
@FĂ©lixGagnon-Grenier isn't it evening for you?
 
indeed
How you doing?
 
job huntin'
 
Happy Huntin'
 
probably done for the evening though
Cat #1 is blocking the keyboard :P
 
Good cat, taking care of the human ;)
 
10:26 PM
how's the keto going?
 
10:43 PM
pretty bad lately.
pizza's been my undoing. it's always pizza that fucks up everything, be it vegetarian, vegan or keto.
 
lol
pizza is good
 
00:00 - 15:0015:00 - 23:00

« first day (3413 days earlier)      last day (1532 days later) »