« first day (3707 days earlier)      last day (1246 days later) » 
00:00 - 22:0022:00 - 00:00

Wes
12:13 AM
@Trowski sorry for the tons of pings lately :B if i am not wrong, tearDownAsync gets called only if the loop has no active timeouts/scheduled things in the test, right? instead, shouldn't tearDownAsync be called precisely to cancel such scheduled timeouts, etc?
 
I have been wondering in which PHP 5 minor release was this bug fixed, but it turns out it was only fixed in PHP 7.3. Anyway, thank you everyone for fixing such a minor thing as this Strict Standards. I can't imagine (even after reading GH conversation) why would I ever need to call more_results(). That was legacy from PHP 4 era and it should be have been removed as a bug fix in PHP 5 release some time ago.
I am shocked it lasted until PHP 7.3 but then again Nikita only fixed the error reporting recently
However, I am still looking to find out if there is any use case for more_results() now that this bug got fixed.
 
Wes
> The event loop continued to run after the test method completed or the promise returned resolved
basically i want to keep a process open for the whole duration of tests, hence the event loop should continue to run
should i not use use the phpunit helper?
 
isn't the event loop better named endless loop? who knows when the next event is, if any.
 
Wes
horizon, event horizon
 
@Wes I think only a phpunit helper can scope the whole test-run. on the level of test-cases this is setUpBeforeClass and then the tear-down that offers control.
 
Wes
12:24 AM
i tried with setUpBeforeClass but the loop seems started and closed before and after each test
i can't have a global event loop
 
but speaking of unit-tests, there may be some use to have this more scoped ... .
in units global is normally denied, yes.
so maybe you want a different, more global phpunit helper. is this amp?
 
Wes
that makes sense but it's still a bummer for me :B
i need a different plan
 
yeah, sure.
 
Wes
in phpunit, is there an opposite of bootstrap, apart destructors?
 
what about extending your test-case with more methods and then do all the things from within a single test-method?
 
12:28 AM
@Wes teardown?
 
@Wes what @Danack says + tearDownAfterClass
 
Wes
global one?
i mean tearDownAfterEverything :P
 
the *afterClass stuff is static which is pretty global.
 
Wes
i think i can do with register shutdown function
 
12:29 AM
And then there are helpers you can put into the XML configuration that run all along.
 
Wes
i don't even have to click
 
<listeners>
    <listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
</listeners>
is also a thing for some lifecycle events.
 
1:09 AM
@Danack I'm fine with that, also I think most of us who have set up Sponsor think it's fair game (don't think Nikita did set it up nor cmb as they are already payed by a company to work on php-src full time)
 
If a parameter type is defined as nullable (?), is that considered "more specific" in reference with contravariance? e.g. a parent class defines a parameter type as \DateTimeImmutable $date = null, but a child class defines the parameter type as ?\DateTimeImmutable $date = null, does that violate contravariance? (and LSP)
 
though perhaps they might not want to be associated with PHP....
 
@Tiffany Think of it as a union type, a union is always larger, so it will pass contravariance, but not covariance
 
and yes, I know, it's a bit of a double-whammy using both ? and = null, I think the definition originally used = null as the old-style way of nullability, but ? doesn't initialize a parameter
 
@Danack Also true, but you can put me on it :p
 
1:17 AM
@Girgias covariance, at least in context of PHP, is for return types
argh... maybe I should change the "full covariance and contravariance support" :S
 
@Tiffany Nullable types where only introduced in PHP 7.1, so that's why, but this can still mess up inheritence if you do double
 
encountered some issues at work and it made me a bit frustrated at my lack of documenting things in the manual
 
@Tiffany Always should, just mentioning it for completeness
 
@Tiffany can you imagine any code that would break if the child class did that? If not, then it's probably LSP compliant....whether it's contravariant or not is more hand wavy.
 
@Danack ...yes........
 
1:20 AM
If you have
A which does Type $var = null
B extend A which does Type $var (or sets a default value of said type)
C extend B which does ?Type $var = null
You'll break LSP
Wait
No mushy brain
 
Nov 20 at 23:01, by Danack
@Girgias I think two things. i) trying to be precise with semantics when it comes to descriptions of properties of code is not particularly useful but also ii) LSP doesn't actually say anything about wideness, that's more what contravariance says about code. LSP doesn't say much about what mechanism is used to make the subtypes 'behave' the same way.
strong case of deja vu
 
I know I know, mixed up something again...
Had a long day
 
@Girgias B breaks if not passed a param...
 
@Danack Huh, I thought the nullability on the type was not propagated if not explicit
Well TIL
 
a change I made is coming close to being released, went through QA today and some stuff was found that was broke. I fixed the signature mismatches in the repo that my change resided in, but there are other repos that extend a class and their method signatures are inconsistent
I think there were at least a dozen children classes, and about half of them had mismatches >.<
I think this gives me good practical experience on how covariance/contravariance works in PHP and possibly expand on the manual page...possibly...
it would have to be a worthwhile enough change to justify translation
another item added to my docs to-do list
 
1:37 AM
maybe, just maybe, it would be good to have a dictionary with the docs. there are more and more terms which are kind of specific and to have a reference and a first exmplanation.
I was stumbling myself over contra- and covariance when reading one of NikiCs RFCs quite some time ago. And I had to repeat these two a couple of times to practically understand them.
 
@hakre I kind of define them in the manual
it could be better though
> Covariance allows a child's method to return a more specific type than the return type of its parent's method. Whereas, contravariance allows a parameter type to be less specific in a child method, than that of its parent.
 
A dictionary / reference is often helpful with hypertext so related parts can be linked.
 
an entity page maybe?
hey, @hakre, wanna contribute to the docs? ;D
 
oh this is nice. have not stumbled over that one, maybe it was not there that time.
 
I added it sometime in December last year
 
1:41 AM
@Tiffany oh I did (apart from adding comments).
 
I feel like I'm peddling something.
wanna contribute some more? ;D
sorry, couldn't resist
 
the benevolent twin of "PR's welcome", "come contribute" :P
 
A better joke would've been: hey kid, wanna buy help some out with the docs?
 
@AndrasDeak also, "write a distributed map reduce function in Erlang"
 
@Danack "did you just tell me to go fuck myself?"
 
1:54 AM
@Danack no no no, that's the other evil twin
 
@Tiffany so where does it hurt most. and is it still the docs editor? or this moved to github?
 
@hakre there is still the docs editor, but PR via GitHub may be easier.
 
i want to have the docs all uppercase for readability.
I'll do a patch.
it's also more portable for older character encodings.
 
fortrancase, nice
 
I stopped using the docs editor when it was broken briefly. :S
 
2:00 AM
well it was great.
 
It was great! I was sad when it broke, meant I had to set up my own environment. XD
I don't remember how I even set it up now, I just remember enough with how to use it. Well, I forget that even, but I documented how to use it for myself
 
so to run the build of the docs locally?
 
Yes
 
ah nice, I want to know that.
 
I set up a VM for it in Virtualbox a long time ago.
 
2:03 AM
I perhaps would do it as a dockerfile.
if not running bare-metal.
 
@hakre doc.php.net/tutorial/local-setup.php, sorry, took me awhile to find it
Had to go a-googlin'
There's also sammyk.me/how-to-contribute-to-php-documentation which I found useful too
Anyway, my nightly dose of Bake Off, then sleep
 
nice, thx. I like the part to use the php webserver to serve the results :)
same for me, maybe I do some little refactoring before.
 
2:20 AM
nice day
 
Wes
2:48 AM
but is it really
 
I hope that
lol
 
Wes
what's the linux equivalent of "start " . PHP_BINARY . " " . DIR . "/processes.php",
ie that creates a new console for the process, rather than launching it directly
 
3:19 AM
Does anyone here know anyone who works at Moz (moz.com) ?
@Wes as in a new terminal shell for it?
 
Wes
yes
 
... what kind of monster is running a process that needs to create separate processes, in a terminal like that?
just start a background process. or if its anything more than a one-off thing, write a systemd unit for it.
 
Wes
you are talking klingon to me
 
3:52 AM
@Wes Don't worry about the pings, I'm happy to answer questions about Amp. tearDownAsync should always be called after a test.
 
Wes
thanks :P but it's not called if the loop is still running, right?
 
@Wes is this for something like a long running process on a server?
or in fact any process on a server?
 
Wes
it's for testing. i am printing stuff so i'd like to see it in a console
 
4:09 AM
so is it running on a linux desktop env? like, in a Gnome terminal session?
and presumably you want some output from the original process (that starts it) to also be visible somehow (hence wanting it to be separate)?
 
@Wes Yeah, that is a problem which was the root of that issue I linked before.
I fixed it in that issue, but it's sort of a BC issue… so I'm not sure how to handle that.
@Wes So if your loop is still running, you have some active watchers that are causing an issue. You probably should set a timeout then to catch that I guess?
 
4:33 AM
@Wes The loop is replaced after each test to make it a true unit test. Put your setup and teardown in each test.
 
Wes
5:06 AM
@Trowski i was planning on terminating the watchers in tearDown
 
6:04 AM
Incorrect example on OOP The Basics page ・ Documentation problem ・ #80497
 
 
3 hours later…
8:40 AM
php-src stubs are saying that get_include_path() can return false. Even the docs don't say anything about it. When it can happen? Thanks.
 
error log file permissions setting ・ *Configuration Issues ・ #80498
 
Wes
@OndřejMirtes returns false when there's no include_path entry in the ini file
haven't verified, just tried to understand this:
https://heap.space/xref/PHP-8.0/ext/standard/basic_functions.c?r=db5979df#2180
https://heap.space/xref/PHP-8.0/Zend/zend_ini.c?r=fa8d9b11#458
 
Thank you!
 
morns
 
Wes
morns \o
sexy i.imgur.com/KHUUfqW.gif cc @Trowski @Danack
 
8:58 AM
morning
 
9:33 AM
hi
4
Q: No data supplied for parameters in prepared statement MySQLi PHP

PwnageAtPwnI've been reworking my website from unprotected mysql queries to mysqli prepared statements and it all went well until I got this: No data supplied for parameters in prepared statement. I've researched it to no avail and I am requesting the blinding awesomeness of this community to help me out. ...

I have kind of a problem like above. I tried the first and accepted answer given above, I am still getting above error
How to bind parameters depending on whether a variable is set or not?
if(isset($title)){
$statement->bind_param("s", $title);
}
if(isset($intro)){
$statement->bind_param("s", $intro);
}
and there is an error saying "Number of variables doesn't match number of parameters in prepared statement" in that line where i have mentioned to bind parameter
 
 
2 hours later…
11:43 AM
@RifkyNiyas do you understand the problem? The error message indicates that you're attempting to bind either more or fewer parameters than question marks in your prepared statement
Your code may need to be rethought out
Or use colon binding I think. I haven't done that in awhile
 
12:31 PM
@Tiffany There is no named placeholder support in mysqli.
@RifkyNiyas That accepted answer is very wrong. I downvoted it because it just spreads lies. Is there any reason why you are using mysqli?
@RifkyNiyas I have added an answer to that post: stackoverflow.com/a/65217005/1839439
 
Hi everybody :)
@Crell I was unavailable yesterday. Did I miss anything?
 
Morning
 
1:07 PM
simplexml_load_string does not work as on PHP 7.X ・ *XML functions ・ #80499
 
1:31 PM
@beberlei are you around ? (about pecl.php.net/package/hdr_histogram)
 
cmb
1:55 PM
@Jeeves is this change expected: 3v4l.org/c4DSH? /cc @NikiC
 
@cmb yes, round() now accepts int|float instead of mixed
 
cmb
@NikiC but 3v4l.org/14uHo confuses me
 
@cmb Same cause
Previous round() accepted mixed and performed a cast to (number)
Now it accepts number=int|float which does not perform object type casting
Object -> string is the only cast kind supported for params
All the internal casts are not permitted in params
 
(new Good())->day();
 
2:24 PM
@IluTov Levi had questions/concerns about using enums for ADTs instead of union type aliases. We debated for a while. No conclusions reached. Log around then is worth seeing for reference.
You may also have better reasons than I did for favoring enums to build ADTs on. :-)
 
3:04 PM
pg_fetch_result returns type is wrong according to the doc ・ PostgreSQL related ・ #80500
 
3:33 PM
@Crell I think Levis main argument is that he'd rather have a special enum type instead of using objects to reduce overhead but is that actually the case? Is there anything other than reference counting that makes the two different?
@NikiC Constants are reference counted. Is this actually necessary? Since these values will never be released until the end of the script what's the point of doing RC?
 
@IluTov Just a guess, but constant propagation and folding?
 
@LeviMorrison Ok yeah that's a fair point.
Although, this could be implemented for enum objects, and would likewise have to be implemented for enums anyway.
 
Wes
what if W3C is actually an evil organization that tries to prevent people from succeeding at their job, because if they succeeded at their job, there would be no need for W3C?
 
3:48 PM
@Wes or more likely, telling the difference between good and bad is really hard, and even clever people get it wrong.
 
@Wes I think that's called government.
 
Erm, no, he was arguing that this would be easier and just as good for ADTs:

class Some {}

class None {}

type Maybe = Some | None;
 
Still couldn't use them as array keys though?
 
@Crell I get that. The argument was, we can make enums dumber (no methods, etc) by adding a special (potentially faster) enum type (new zval type) and that ADTs could be solved with union types.
@LeviMorrison Correct me if I'm wrong.
 
Yeah, that's about right. An important aspect to that is that we have union types already; why make a totally new feature to make advanced unions instead of building on top of the unions we have?
 
4:01 PM
@LeviMorrison I can think of a few reasons. Enums with methods are nice, that wouldn't be easy with a special enum type. You can't mix enums with ADTs (often in ADTs cases don't have values but you'll still have to create new instances or share instances manually), we're not really building a totally new feature, we're borrowing a lot from objects, adding a new zval type would mean lots of changes in php-src and in all extensions. Object type would no longer mean object but could also mean enums...
I think it complicates things a lot. Unless there's a huge performance difference I don't think it makes sense to add a new zval type.
 
Is someone working on updating the documentation in regards to what this question asked? stackoverflow.com/questions/65210956/…
 
@IluTov To be clear, enums as a separate zval type is for simple enums, and yes, there would be a large performance diff :)
My proposal was to use objects for advanced cases.
 
I'm trying to output HTML to Docx. I'm able to output as Docx by changing the headers. The results are not good, with no formatting. Do you guys know any libraries?
 
The diff comes from the fact that for some operations you wouldn't have to fetch anything outside of the zval; it contains everything you need to know if two enums are equivalent, for example.
@IluTov If they are objects, why not make objects "better" or easier to use without calling it "enum"?
20 hours ago, by Levi Morrison
// Sorry, just realized that constructor promotion might make this more realistic:
// introducing new types
type Result =
    class Ok { function __construct(public $value) {} }
  | class Err { function __construct(public $value) {} }
;
As one possible example, something along those lines might be worth pursuing.
Where type works for any existing types, and can also define simple classes inline.
 
Oooh that would be nice.
 
4:14 PM
@IluTov One counterpoint @Crell mentioned was mixing simple and advanced doesn't work so well in that scheme.
 
Implications of using a custom zval for enums:
- Substantially more work for Ilija
- No support for methods, constants, etc.
- Doesn't extend to ADTs at all.
+ likely more performant
+ Possibly easier to support things like bitwise enum combination.
- Doesn't really resolve the challenges around primitive handling.
Doesn't feel like a net win to me.
 
@Crell What do you mean "constants"?
You mean constants on the enum and not on a case?
 
Some people were asking about constants on enums. It would be one way to do aliases.
 
I have not been following the enum conversation at all, but for me the most useful scenario probably would be something like this: if(in_array([Suit::Spades, Suit::Diamonds])). Would that be possible?
 
@Crell I would gently set that into the rubbish bin, myself. That seems like a very WTF thing to do...
But, putting an "enum" skin on objects seems very WTF to me to begin with, so maybe my WTF detector is off.
If you want methods and constants and such, just write a class.
 
4:27 PM
@Dharman Well, that's a syntax error... :-) But you can Suit::cases(), which gives you an array of values, and you could then in_array that. But it would be trivially true the Suit::Diamonds is in the array Suit::cases(), since it's a syntax error otherwise.
@LeviMorrison For constants, I'd agree. For methods, no. Methods on enums are highly useful and widely supported in many languages.
 
I mean, just check against a subset of possible values
There are 4 values in Suit but I want to check if it is one of two (obviously real word example would have more)
 
@Dharman As currently planned*, yeah. Suit::Hearts === Suit::Hearts, so an in_array() check should work fine.
 
Why spell it "enum"?
 
Because it makes intent clear. It's also familiar from several other languages.
 
Thus far the only compelling argument I've seen for spelling it that way is mixing simple and advanced cases. I haven't bought into any other arguments so far. With this status, I'd still advocate for simple enums only, and enhancing existing unions (which we want to do probably anyway) in some way.
 
4:31 PM
"You can kinda use type aliases to simulate enums" may be true, but it's also still not actually enums.
Nor can you do any optimizations on the knowledge that it's an enum, and not just "a bunch of classes".
Also, making the cases not free-standing classes means you can't instantiate them independently. You have to go through the enum, which is both good DX (IMO) and means you can worry less about class name collision.
 
This is also a con. I've seen enums that wrap existing classes just to "tag" them. Although in this case in PHP maybe they'd just use existing unions.
Things like this, I mean:
enum IpAddr {
  case V4(public IpAddrV4 $addr);
  case V6(public IpAddrV6 $addr);
}
 
5:10 PM
@LeviMorrison Where would the large performance difference come from? Identity comparison is trivial, if we can avoid RC for constants passing values would be comparable (and I doubt RC makes such a huge difference anyway).
 
Wes
5:46 PM
@Danack what are you referring to?
 
6:00 PM
2 hours ago, by Wes
what if W3C is actually an evil organization that tries to prevent people from succeeding at their job, because if they succeeded at their job, there would be no need for W3C?
 
@Crell Current output for var_dump of enums is object(Foo::Bar)#1 (0) {\n}, do we wanna change that to enum(Foo::Bar)?
 
@IluTov I'd say yes.
 
@IluTov No reference counting, no pointer chasing.
 
@LeviMorrison When would pointer chasing be relevant? Enums don't have properties, calling methods on enums wouldn't be possible with a new zval type approach. Comparison does not need to resolve the pointer.
 
@IluTov Yes, comparison does need to resolve the pointer.
How will it get comparison handlers otherwise? They are objects, after all.
 
6:09 PM
@LeviMorrison Not if you use === (which I assume is what most people use), right?
 
With objects I see both == and ===.
 
Wes
@Danack :B how specifically though? like you are saying they don't realize how bad some stuff they've made is?
 
6:27 PM
@LeviMorrison Isn't the object pointer directly stored in the zval? Then all zend_is_identical needs to do is compare the pointers. Either way, dereferencing a pointer is one instruction. I'm not sure this makes a meaningful difference.
 
 
1 hour later…
7:52 PM
Guys, I need some suggestions to understand the c / macro ecosystem. In this snipped the variable str (zend_string*)
where it's released ?

buf = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);
ZSTR_LEN(buf) = custom_func(ZSTR_VAL(buf), ZSTR_LEN(str));
RETURN_NEW_STR(buf);
 
8:21 PM
Never there, the zval return value is released when it falls out of scope, it then also releases the zend string
The custom func looks super fishy, the return value should be a zend_string refernece
 
Ok, I simplified the code, the return type it's equal to original source. The problem that I face it's a memory leak when in custom_func I use zend_string_extend
Also if I don't use the return type the problem it's the same
 
What are you doing in the custom_func
And why are you returning a new string
 
8:41 PM
Why did you remove the smart string free? As that's used to generate the allowed string for when you pass an Array, is that the mem leak?
 
no only in the past code
In my local branch, I use zend_string instead of char *. Then I tried to "extends" the size of the zend_string with zend_string_extends, but this causes a memory leak
 
You don't need to return a new string
Just RETURN_STR should do the trick if I understand you correctly
Might need to do a copy tho
 
But you think that the problem it's with last macro RETURN_NEW_STR ?
OK I saw return the val
 
Yes, because you are creating a new string while not freeing the other new one you created
Which is kinda pointless, just use the new string you already extended
 
Ok but this it's a fix because this code it's on master branch.
But I need to do some special stuff when I use zend_string_extends?
 
yes
But the doubt I came equal
 
So if you read it, it tell you zend_string_extends reallocates the string in a new buffer
So you need to release the previous string
and possibly the new one if you don't use it
 
Sorry but this
http://www.phpinternalsbook.com/php7/internal_types/strings/zend_strings.html#string-operations
where release? Ok, release foobar in the example.
But in the code that I linked, the release (my first question), it's when the var falls out of the scope
It's the same in my code automatically in the example manually or not?
 
I have no idea what changes you made compared to master, so I can't tell you where you should free it
 
9:07 PM
Also heap.space may help you in tracking stuff down, @BruceStackOverFlow
 
How about that, an article about programming languages that remembers to mention PHP! arstechnica.com/features/2020/12/…
 
@nikic Does this answer still hold true about why PHP measures CPU time rather than wall-time? stackoverflow.com/questions/21836971/…
I'm a bit sceptical, since the latter metric is measured e.g. on Cygwin
(on Windows, of course)
 
9:26 PM
So SVN currently is dead hitting a 502 Bad Gateaway
 
@BruceStackOverFlow None. The point is that you're passing the string somewhere else. If you were to release it right away it wouldn't live long enough for the receiver to ever see it. Whoever calls this method will be responsible for releasing it. If the string is then used in userland it will be stored in a zval which will automatically increase and decrease the reference count. If you don't know what reference counting is read up on that. :)
 
Is there no way to get public constants of a class using reflection (or otherwise)? The visibility doesn't seem to be a property on the ReflectionConstant object
 
@scorgn php.net/manual/en/class.reflectionclassconstant.php You should be able to check the visibility here.
 
Ah thanks, I don't know how I missed that.
 
9:42 PM
What's the official number of contributors to PHP 8.0? Do we have that number anywhere?
 
you probably have tooling of your own for this, but anyway I know numpy has a script that generates contributors and changelog for a release github.com/numpy/numpy/blob/master/tools/changelog.py
 
moin
 
Ok, I read the doc-teck, and ok I know what it's the refcount.
>The point is that you're passing the string somewhere else
Sorry but this point isn't clear for me

My code it's:
zend_string_r = zend_string_extend(zend_string_r, zend_string_r->len+4, 0);
printf("Len %ld \n",zend_string_r->len);
printf("Refcount %u \n",zend_string_refcount(zend_string_r));
In a while
- Ok it wrong in the loop by poor performance
- Ok I must use short macro (ZSTR_VAL,....)
but this it's in my debug context
btw thank :-)
 
@Crell I feel like someone was doing that recently, there were some fancy visualisations, I remember @Girgias being very large on it :-P
 
9:49 PM
@DaveRandom Yeah, I recall that graphic. My name was tiny, as it should be. :-)
 
@Crell Are you refering to RFC authors?
 
@AndrasDeak is paying more attention than me, it seems :-P
 
Also @Crell did you see the Twitter DM :')
 
@Girgias All contributors would be better. RFC authors I could probably count.
 
@Crell I think mine was absent (correctly) :-/
 
9:50 PM
Twitter doesn't like to notify me of new DMs unless it's in a thread I am already in. I don't understand why.
 
@DaveRandom if this will make you feel any better, same
 
:-P
 
Huh weird, but yeah the php.watch article is your best bet for total number of contributors to PHP 8.0
 
I don't think I have commited to src since like 7.2
there must be some tool that you can point at two points in history in git and it will tell you all of the intermediate committers?
like surely that is a script someone has in a gist
> Username auto complete is *tab*, not enter
:-P
 
@IluTov
the output it's

Len 44
Refcount 1
Len 48
Refcount 1
Len 52
Refcount 1
Len 56
Refcount 1
Len 60
Refcount 1
...
=== Total 1 memory leaks detected ===
@DaveRandom sorry :-( I miss clicked
 
9:55 PM
it's fine obv :-P
 
@DaveRandom something like git shortlog last_release_ref..this_release_ref --summary | cut -f2- might work as a zeroth approximation
 
Securely I wrong something, but I don't know where is
 
At least it's secure :)
 
actually, people have spaces in their names, ugh OK, fixed
 
00:00 - 22:0022:00 - 00:00

« first day (3707 days earlier)      last day (1246 days later) »