« first day (4616 days earlier)      last day (318 days later) » 

3:33 AM
For reasons (mainly just learning and practice), I decided to rewrite a PHP extension from scratch that I had begun working on about a year ago. Everything seems to work fine, and when I build the extension as a basic extension with no classes or functions, it builds fine and shows up in phpinfo, but when I add a single, basic class and try to build it, I get a ton of errors, mostly of the `unknown type name 'zend_class_entry'` variety.

So, something's not linked up properly, but I can't figure out what it is. Everything appears to be set up just like my previous project, but I can definit
I have #include <php.h> in my main header file. I don't have zend_types.h included anywhere, but neither does my other project, and it seems to know how to pull all those things in. Nevertheless, when I do include it, I still get errors about missing symbols all over the arginfo file.
I'm sure it's something simple that I'm forgetting, so I'm hoping someone might know what I'm missing, or you'll say something that will help me remember what it is I'm missing. :-)
 
 
3 hours later…
6:28 AM
@ramsey can you share your code somewhere? Might be an include ordering problem for example
Sounds like a compile problem and not a link problem btw
 
 
5 hours later…
11:34 AM
Morning guys!
 
12:02 PM
@ramsey "but I can definitely see that the auto-generated .dep files don't contain all the dependencies I would expect to see." - I think that file only gets updated after a successful compile of the C file, so as Nielsdos said, it sounds like a compile problem.
 
 
4 hours later…
4:15 PM
@nielsdos just wrote a email to RMs about missing headers (can't add you in CC as I don't know your email, hidden in commit)
 
@RemiCollet You could use the one they used on their RFC: wiki.php.net/rfc/mb_str_pad
 
@RemiCollet alright, thanks for handling it. You can indeed use my public one Girgias linked, or use my php.net one (nielsdos at ...)
 
4:38 PM
@Krzysiek Regex101.com is my go site! I still mud for gaming and I do all my triggers there. It's in my utilities bookmarks at work along with pastebin and various PHP, SQL Server and SSRS references. I use regex a lot in vim substitute, lately. A huge and powerful formatting tool.
 
5:14 PM
@nielsdos I've pushed the code up here. github.com/ramsey/php-ecma-intl-ext
 
6:03 PM
I can repro your problem. Put this line on top of calendar.c:
#include <php.h>
and maybe the include for config.h
my php install on my desktop if frankensteined so I get some unrelated (well, I think unrelated) warnings too. But doing that change fixes the errors at least
 
6:52 PM
Any idea why Realpath would return FALSE for a local file that does exist and is accessible? I also checked my code to make sure the correct value was being passed to realpath(), and that I could open it on the server. Here's the very cleverly redacted dir: S:/OUR Archive/States/Testing/Secret/Sneaky/Bababooey/Documents/RS/030_290.TIF
 
@SlamJammington If it's longer than 255 characters, and you're on an NTS build, and you're using relative paths, then I'm pretty sure it's this bug: github.com/php/php-src/issues/10992
I know title says mkdir, but applies on most functions that use a file path
 
It's less than 255 characters and I'm using a full absolute path. However, S:/ is a shared drive based on "C:/Shared/" on the same machine, I wonder if that has anything to do with it
 
@SlamJammington Hmm okay then it's probably different... It sounds like it should just work. So the logical follow-up question is indeed if it also happen without shared folders
 
7:20 PM
It doesn't happen in non-shared folders, but earlier in the same program I access files in the same /Documents/RS folder without issue. I have no idea why a file I can access in a folder I can access would return false. Does realpath() throw a tantrum if there's an issue with file encoding? That's my only other guess so far
 
It doesn't look inside the file, so encoding shouldn't matter
If the PHP process does have access, but realpath fails for the shared folder then this sounds like a bug. It would be helpful if your bug report includes a simple reproduction case with some brief steps on how we can reproduce it :).
 
I'll try my best, but this situation is so specific it may be difficult for anyone else to reproduce the issue
 
I see. In my opinion having a bug report even if we can't reproduce it is still helpful. This is because someone else may experience the same issue and share more info. Eventually we can have enough info to fully find and fix the problem.
 
7:39 PM
Ah shoot, I forgot my company uses PHP 7.4 so it's unsupported, guess I just have to find a workaround or something
 
\o
 
o/
 
8:04 PM
@nielsdos Ah ha! When I was looking through this stuff, I wasn't looking at it clearly. That include was in my php_common.h, which I had intended to include in calendar.h, etc., but I failed to include it. :facepalm: I also needed to include zend_enum.h, and that got rid of the other warnings, etc.
Thanks, @nielsdos!
 
@ramsey Ah right, I got an enum warning too but thought it was because of the wonky setup here :p
and you're welcome ^^
 
@nielsdos You're pretty familiar with the GC, correct? I'd like to make the GC safe for re-entry so suspending a fiber during __destruct isn't forbidden.
I suspect it may be fairly straightforward, largely making sure items are removed from the queue before invoking __destruct.
 
Sorry, I'm not familiar enough with the GC. PHP uses the algorithm described in this paper: https://web.archive.org/web/20130525112405/http://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon01Concurrent.pdf. I haven't read it yet but if it's like the other concurrent GC's. AFAIK inherently concurrent GC's assume exclusivity of the application state during some phases, so might be problematic allowing suspending etc.
But haven't dug into the GC algorithm and implementation yet unfortunately
 
o/
 
I'm probably looking for @IluTov or @Girgias then.
 
8:19 PM
Yep
 
Probably more Arnaud than me, I know nothing about the GC lol
 
8:33 PM
Does Arnaud frequent R11? Otherwise I can ping him on github I guess.
 
I haven't seen him here tbh
 
I think he has an SO account but rarely comes here
 
9:37 PM
@RemiCollet I'm pretty confused about what's going on with these patches; just responded to the thread and would appreciate some insight :-)
@RemiCollet Nevermind... spoke with Pierrick, and he's going to merge into PHP-8.0 and add to NEWS, and we'll go from there as usual :-)
 
@ramsey unsolicited advice: That probably should not be a backed enum.
 
@TimWolla Why's that?
 
9:52 PM
@ramsey Sorry, in this case I might actually be wrong, because the string values appear to be well-defined. I've just seen too many wrongly backed enums that just repeat the enum case and probably was overeager here.
 
@TimWolla In ECMA-402, they just use string values for all these things, and I was going for something with more type-safety and so I wouldn't have to validate all the input :-)
but, yes, they could just be strings
 
Personally I would prefer a static constructor, though: Calendar::fromEcmaString().
It's a little more explicit than some "opaque" backing value.
 
How is that different from Calendar::from() or tryFrom()?
 
Explicitness. The method name directly says on the tin what value it expects.
Becomes more relevant if there's more than one possible or reasonable "source" value.
 
It gets even more confusing because the strings are defined by Unicode CLDR and ECMA doesn't require that all the calendar types be supported by any given implementation
ECMA only requires that iso8601 be supported
 
10:00 PM
Does it depend on the ICU version which values actually work?
 
Yes
Well... probably yes
as in, they may introduce more in the future
but all those are supported by ICU 67.1 and up
 
That's going to be funny with serialized data and some enum cases possibly missing.
 
ah... good point
 
Anyway, what I wanted to say with my initial message: Often it does not make sense for an enum to be backed. e.g. enum SortOrder { case Asc; case Desc; } should not have a backing value, because it is not really meaningful to just repeat the Asc/Desc there.
 
Oh, right. I totally get that. The reason this is backed is primarily for being able to convert from the string value into a typed enum value
and then if you json_encode() it, you get the string
 
10:06 PM
Do enums support JsonSerializable? Honest question, I never checked.
I suspect they do. It might be preferable in your case, because explicit.
 
if I json_encode() any backed enum case, by default I get the value of that case
without needing to implement JsonSerializable
if I json_encode() a non-backed enum case, I get false
 
i.e. an error
 
10:57 PM
@Girgias Right, because there's no value
 
Yup :D Or if you thorw in the exception flag it would throw an exception
 
11:07 PM
@Trowski Yeah, you should try Arnaud or Dmitry. Let me know if you need a Slack invite. Dmitry is reachable there.
 
@IluTov I could use a slack invite. Thanks.
 
@Trowski GC re-entrance safety would largely be achieved by having a separate list of garbageā€¦ but it's probably not going to be that straightforward in all cases. Btw. @nielsdos Aarons issue is not about the actual garbage collection, but just things happening after the "Actually call destructors" comment in zend_gc_collect_cycles, i.e. the garbage destruction/freeing (which is a much simpler part of GC).
 
11:31 PM
@bwoebi Right. Technically zend_gc_collect_cycles already has protection against re-entry. One issue would be if a suspended destructor never resumed. Is that programmer error or something which should be considered?
 

« first day (4616 days earlier)      last day (318 days later) »