« first day (3527 days earlier)      last day (1418 days later) » 
00:00 - 20:0020:00 - 00:00

12:15 AM
Something something hunter2
 
hunter2 s thompson?
 
1:21 AM
Fear and Loathing in Bash Dot Org
 
Whether a numeric constant needs to be an integer ・ *General Issues ・ #79694
 
1:38 AM
Hello
@Tiffany
Hello @TheodoreBrown
I uploaded laravel project to server but there is an error The server encountered an internal error or misconfiguration and was unable to complete your request.
 
 
5 hours later…
6:19 AM
morns
 
6:32 AM
Request nullability of mixed in php 8 be reconsidered ・ Compile Failure ・ #79695
 
 
1 hour later…
7:35 AM
@Danack ^ BTW, thank you for the answers, guys!
 
8:14 AM
Git mergin'.
 
8:26 AM
I want to create a minimal C library with just one function as an example for PHP FFI but I cannot get it to work: gist.github.com/sebastianbergmann/…
The last time I created a C library from scratch was over 20 years ago :-/ Any help appreciated!
 
@SebastianBergmann not sure but might be ld problem if you didn't setup LD_LIBRARY_PATH or some custom ld config
 
@makadev Maybe. Just noticed that I get the same error message if I use "doesnotexist.so" instead of "library.so". I expected it load from the filename but it does not seem to do so.
 
@SebastianBergmann no clue eihter, but maybe you need to "extern" the leapyear?
@SebastianBergmann ah wait no code is all right
 
8:42 AM
@beberlei According to strace, PHP never looks at my library.so. So it is an LD_LIBRARY_PATH issue.
 
@SebastianBergmann did you look at the full example? it does things differently than the basic one, php.net/manual/en/ffi.examples-complete.php
specifically the FFI related declares in the header
 
@beberlei I don't see how this would help with PHP/FFI not finding the library.
Copied library.so to /usr/lib64/library.so from where it is opened, still the same error, though.
Just checked, the library actually works when used from a C program: gist.github.com/sebastianbergmann/…
 
9:02 AM
@SebastianBergmann uhm seems you are not creating a shared library, i've just checked you example and neither file, ldd nor objdump like it objdump: library.so: not a dynamic object. Also you library check is simply compiling library.c and test.c into a single binary.
your*
 
Ah, hm. So I not only feel stupid but actually am stupid. Thanks!
 
cmb
@SebastianBergmann hmm, that -c flag for gcc seems not right.
 
@cmb Thanks! Removing -c did the trick.
 
9:16 AM
\o
 
cmb
o/
 
10:04 AM
@JoeWatkins ohi!
@NikiC so i ran bench.php and wordpress homepage with a similar setup to dmitrys phpng wiki page against instrument branch, bench.php instr according to valgrind for bench.php 3,585,689,871 before, 3,667,865,093 after. for wordpress 4,810,674,172 before, 4,818,021,306 after. time based evaluation shows instrument branch slightly slower, bu tnot sure how much i can trust that on my laptop
the fastest i could get before was 0,38 secs, and with the patch 0,40
 
@beberlei hai
 
the lowest on wordpress php-cgi -T 10 before 9,42 after 9,72. highest before 9,99, highest after 10,21
so that would roughly count at 2% overhead for wordpress, 5% for bench.php
@LeviMorrison ^ benchmarked the thing (6 messages above)
@JoeWatkins how are you?
 
I'm good, thanks for asking ... just spending time doing other things in free time ...
 
10:20 AM
@JoeWatkins that is great, wish i could manage that :)
 
Good morning everyone.
 
I'm going crazy here
/home/nikic/php/php-7.4/ext/sockets/sockets.c:868:13: warning: AI_IDN_ALLOW_UNASSIGNED is deprecated
868 | REGISTER_LONG_CONSTANT("AI_IDN_ALLOW_UNASSIGNED", AI_IDN_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
I want to suppress this warning, to make -Werror build work with newer glibc
I've been mucking about with diagnostic pragmas for half an hour now, and am starting to come to the conclusion that it's just not possible?
It seems like this warning is not part of any error category (in particular not -Wdeprecated-declarations, which would usually be the right one)
 
Is that still a beta of GCC, or a released version? :-/
 
It's gcc 9.3
 
An ugly trick would be to replace them with their actual values
 
10:26 AM
#  define AI_IDN_ALLOW_UNASSIGNED \
  __glibc_macro_warning ("AI_IDN_ALLOW_UNASSIGNED is deprecated") 0x0100
#  define AI_IDN_USE_STD3_ASCII_RULES \
  __glibc_macro_warning ("AI_IDN_USE_STD3_ASCII_RULES is deprecated") 0x0200
Apparently this is how it's implemented ... no wonder -Wdeprecated-declarations doesn't work
 
yuck
 
Good morning everyone. I'm creating a friendly URL, as this is the first time I'm doing it, I would like to know if it is correct.
<IfModule mod_rewrite.c>
    RewriteEngine On
    Options All -Indexes

    # ROUTER WWW Redirect.
    # RewriteCond %{HTTP_HOST} !^www\. [NC]
    # RewriteRule ^ %{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # ROUTER HTTPS Redirect
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # ROUTER URL Rewrite
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/site/ [NC]
 
Put your code in a gist or something
 
@Derick Are you talking to me?
 
@Tiago yes
 
10:34 AM
Ok
 
@Tpojka is it really merging though?
 
@Derick @NikiC Martin and I are torn by the attributes syntax thing, having <<>> or #[] vs @@ what is now discussed. can you give guidance how we should proceed on voting? 2/3? ranked choice? I am not sure what would be fine
 
You need to do a STV vote really
Like we did for PHP 8 RM. Happy to run that for you.
 
@Derick @Tiffany ideone.com/gH9Adw
 
@Derick so would you put up a completly new wiki page with just that vote and it links to all 3 RFCs that discuss the syntax individually?
 
10:36 AM
@Tiago Won't be able to help you with that though, I don't know Apache anymore
 
@Derick I "fixed" it: github.com/php/php-src/commit/…
 
@beberlei Don't think it needs to be three pages?
@NikiC Noice :-)
 
@Tiffany Did you see the link? Can you help me?
 
I just woke up and haven't yet had caffeine so probably no
 
@beberlei That's pretty significant
I was hoping for less
 
10:40 AM
@NikiC its benchmarks on my machine, so i wouldn't specifically trust them too much, but I re-ran everything a few times and out of order, so its not completly unscientific
@Derick ok, so you think we should use wiki.php.net/rfc/shorter_attribute_syntax - have two sections each explaining pro + cons for @@ and #[] over <<>> and then do the vote in this RFC?
 
I just need a simple instruction. Is this correct to use?
RewriteEngine On

    RewriteRule ^ - [L]
    RewriteRule ^/?$ site/index.php [NC,L,QSA]
    RewriteRule ^joblisting$ site/joblisting.php [NC,L,QSA]
    RewriteRule ^job/$ site/job.php?id=$1 [NC,L,QSA]
 
@beberlei or are the three syntaxes in three different docs already?
@beberlei want to do a quick (video) chat?
 
10:55 AM
@Tiffany Sure thing. :D
 
@Tiago have you tested it yourself yet?
 
@Tiffany Yes
 
And?
 
@Tiffany Even if it works, I would like to know if it is correct.
 
the $1 here doesn't have anything to refer to: RewriteRule ^job/$ site/job.php?id=$1 [NC,L,QSA]
you need to "capture" something in the pattern to fill that placeholder with
 
11:04 AM
@IMSoP Along these lines, I would like to open the project.
localhost.dev/job/project_name
 
Why don't you just let php handle the rewriting?
 
rewrite rules have three parts:
- a pattern that matches the URL the user typed in
- a template for the URL to actually serve them
- some flags in square brackets
 
@IMSoP As well?
 
All you really need in apache is FallbackResource /index.php
 
@PeeHaa As well?
 
11:06 AM
as well as what?
 
Only
 
as PeeHaa says, you can just pass everything to one PHP script and handle it there
 
@Derick usual whereby?
 
but if you do want to use RewriteRule, find a regex testing tool and get the pattern part right first
 
yup
 
11:07 AM
I scored wrong. I mean, if you have a better way, you can tell me.
 
the pattern ^job/$ won't match the input job/project_name
in other words, my usual mantra: Break The Problem Down
 
@IMSoP How is the correct form?
 
@Tiago sorry, I have someone paying me to do work right now, I can't do yours for you
I'm trying to give you some hints on how to learn
 
@Tiago the part that you want to capture that you wish to use with $1 should be surrounded in parentheses
 
@Tiffany RewriteRule ^job(/)$ site/job.php?id=$1 [NC,L,QSA]
Like this?
 
11:18 AM
Probably something like job/(.+)/$
Maybe
You should read up on regex and how the different symbols work
 
> find a regex testing tool and get the pattern part right first
don't worry about capturing and placeholders for now; just understand what the pattern means
 
@TheodoreBrown are you up yet? for the vote on attribute syntax, would you be fine if we do a seperate page "attribute_syntax" with three sections each for every syntax, a pro / con list, and the same code example for each showing how it looks, at last a link to your proposal, the original rfc and the Pull Request for rusty attributes for details and hold the vote there?
 
@Tiffany Did not work :(
 
3 mins ago, by IMSoP
> find a regex testing tool and get the pattern part right first
I gave you an example to work from
 
@Tiffany RewriteRule ^job/([^/]+)/?$ site/job.php?id=$1 [NC,L,QSA]
 
11:24 AM
Use a regex tester thing and play around with it
 
I did it that way, is that correct?
 
@Tiago wat
 
I ask if it is correct, because not always what shows results is the best way
@Tiffany RewriteRule ^job/([^/]+)/?$ site/job.php?id=$1 [NC,L,QSA]
 
6 mins ago, by Tiffany
You should read up on regex and how the different symbols work
it takes maybe 30 minutes to read through a tutorial that goes over the basics of regex
 
@Tiffany Thank you, you helped me a lot!
 
11:30 AM
@Tiffany And it takes like 30 days to fully understand the depths of what pcre syntax is :-P
 
@bwoebi easier to help someone fix their broken regex when they have a general understanding of how the symbols works
work*
 
Hello, does anyone know how to force https on a Symfony 5 project? I tried doing it via the access_control param in the security.yml to no effect.
 
@KerrialBeckettNewham enable HSTS at the server level?
 
@Tiffany did that, of course.
 
then it should be on HTTPS already
HSTS enforces HTTPS before the connection reaches the server ... I think, maybe it's the application...
 
11:43 AM
@Tiffany yes, that's what's strange. it's on social login. generates the Valid OAuth Redirect URIs, but it's generating http...
 
@KerrialBeckettNewham where is it generated?
that is, is it generated on a different server?
 
not sure, using knpu_oauth2_client package. I would assume inside that.
@Tiffany no, at least 90% certain
 
(FWIW, I don't know that much about oauth or symfony, but I'm pretty familiar with setting up HTTPS on different servers, and figuring out how to get correct tokens from third-parties)
 
The https is functioning as expected, it's only on the social login that it has this bug
@Tiffany I added a http version to Valid OAuth Redirect URI to google login and login was successful. so I know the issue is with the http. just no idea why
 
hmmm
... TIL Eve Online has an oauth connector
@KerrialBeckettNewham I'm not seeing an access_control option in their docs
 
12:03 PM
@Tiffany symfony.com/doc/current/security/access_control.html using requires_channel: https.
 
There's access_type for google
 
@Tiffany yeah, that's for ensuring identity of the user it seems
 
@MátéKocsis this is a "I want things to work precisely to fix my current immediate problem" request..
 
@KerrialBeckettNewham how do you have HSTS set up? a header in a server conf file?
 
@KerrialBeckettNewham you've done the stuff on this page symfony.com/doc/current/security/force_https.html?
@Tiffany hsts is probably a distraction imo... if the app is generating http urls, then that's the problem that needs to be solved not the stapling...
 
12:18 PM
@Danack I agree
@Danack something similar, but not exactly that. i'm just specifying certain endpoints.
@Tiffany No, I'm using docker, nginx-proxy and letsencyrpt
 
@beberlei I'm not necessarily opposed, but would it be possible to include this section directly in the Shorter Attribute Syntax RFC before the vote? It could be more confusing to have multiple documents to read.
 
@Danack my thinking was that if HSTS is enforced, it may be easier to debug where the HTTP URL is being generated using wireshark or fiddler or something
 
@TheodoreBrown having multiple things being voted on in the same doc is also confusing.
 
Good morning everybody o/
 
@Tiffany I have the profiler available, I know which method is failing at.
 
12:31 PM
@TheodoreBrown After reading your RFC again there are a few things that should be changed. You state that both @@ and #[] syntax would "supersede the syntax for grouped attributes". While this is true for @@ it does not apply to #[] which would support attribute grouping just fine and it would feel natural as it reads like a PHP array. #[Foo, Bar] would be perfectly valid.
 
@kooldev Okay, I can change this.
Done
 
Another thing is the nested attributes example. The @@ notation is fine while the #[] notation should probably only use a single # fronting the attribute. Something like this: #JoinTable["UserGroup", #JoinColumn("User_id", "id")]. The Problem with using #[] for nested attributes is that it could (if grouping is considered) resolve into a single attribute or an array of 1+ attributes. An implementation of nested attributes can be found here: github.com/koolkode/php-src/pull/6
 
@KerrialBeckettNewham sorry, your problem is probably a bit over my skill level
 
@kooldev Changed
 
@TheodoreBrown The last thing I want to point out is that I took some time scanning through the code search results for #[ (grep.app/search?current=10&q=%23%5B&filter[lang][0]=PHP) and only 2 of the first 100 matches are actually affected by #[ becoming an attribute token.
Most of the results are actually something like preg_match('#[...' which is obviously a fals positive. It feels like most of the time #[ occurs in string literals. I am not sure if these results can by filtered out as it is just grep...
 
12:44 PM
@TheodoreBrown @kooldev we had this multi syntax problem with the oriignal RFC as well and couldn't adequately resolve it, you start out explaining everything with one syntax, and then only have one section about the alternative syntax. both #[] and @@ have different implications on nested, so its hard to mix them in a comparison vs <<>>
 
Yeah. I wasn't sure about the best way to approach it. Maybe have examples with both syntaxes in the proposal section?
 
@Tiffany Oh 100% same here, thanks for trying though. :)
 
@TheodoreBrown for completeness we should also show <<>>, and it should have its own pro/con section, because it has the benefit of not producing any BC break over the other two proposals
 
@TheodoreBrown Out of interest, although having the syntax work on both php 7+8 is a neat trick, how many projects that currently use doc block syntax do you think will actually bother translating their current annotations to the new system? Instead of just switching to the new syntax at an appropriate version...
 
@Danack i think that question should be targeted at @kooldev and me, as we have worked on the #[] syntax, @TheodoreBrown has proposed the @@ one
@Danack the major benefit of #[] is the compatibility of Attribute classes with PHP 7. Since attribute classes need to be tagged with <<Attribute>>, you cannot use an existing Doctrine Annotation class for example for PHP 7 and for Attributes with PHP 8. same applies to a PHPUnit @test and <<Test>> attribute
 
12:53 PM
@Danack Maybe @beberlei and @kooldev feel differently, but from my perspective I don't think almost any projects would use the forward compatibility, which is why I don't think it's a very good argument for the #[] syntax.
 
its more a way for libraries to support both PHP 7 style "attributes" and PHP 8 at the same time, for applications its not necessarily important
libraries could also ship support for attributes earlier, because they can still allow php 7 to use the code
 
Potentially, yes. This is a very temporal benefit, though. It will be irrelevant once most people are depending on other PHP 8 features anyway.
 
I think we should leave out nested attributes completely from the syntax-related RFCs. Both @@ and
#[] allow for an implementation of nested attributes just fine.
 
1:08 PM
It's an argument against <<>>, though.
 
@TheodoreBrown Nested attributes could also use <<>> but I am pretty sure that nobody would want to write attributes like this: <<JoinTable("UserGroup", <<JoinColumn("User_id", "id")>>)>>. Both @@ and #[] would be a big improvement over that.
 
How useful are nested attributes at all? Wouldn't it be possible to write them in a non-nested way?
 
@Derick There are definetly attributes that can be flattened (like the ones Benjamin used in his Doctrine examples). There are however cases were attributes might be used multiple as values for different arguments for example. One such example might be this one: github.com/koolkode/php-src/pull/6
 
1:24 PM
@Derick possible but annoying. Particularly when un-nesting them would result in needing to add 'target' information. Some code I'm planning to migrate to annotations is:
    new InputParameter(
            'id',
            new GetString(),
            new MinLength(4),
            new MaxLength(2048)
        ),
        new InputParameter(
            'type',
            new GetString(),
            new MinLength(4),
            new MaxLength(2048)
        ),
 
Good afternoon everyone. I have a problem installing a composer package. It is saying that my php is 7.1, but the version that is sleeping in the terminal is 7.2. How to fix this?
I am using phpstorm on a macos.
 
That could be un-nested, but would require putting extra info in, about which rule targets which parameter.
 
I think complicated things like this shouldn't be done with annotations.
 
@Tiago you can add --ignore-platform-reqs if you just want it to install. Or you could figure out what is going on with your versions of PHP.
 
@Danack Where do I put this command?
 
1:28 PM
@Derick for various reasons, including not having to update stuff in multiple places when one thing changes, it's probably a good trade off imo for my use-case. But there are probably also better examples of nested.
 
And to change the version as he is accusing, how would it be?
 
@Tiago at the composer install --ignore-platform-reqs
 
@Danack Understand. And to solve this problem, how should it be done? I had already installed other packages and did not give any error. Weird...
 
@Derick I agree that very complicated things should not be moved to attributes. But one thing to consider is that we already allow arbitrary const expression as argument values. If we do not support nested attributes that's fine but people will start (ab)using nested arrays for everything as that is already possible.
 
it might be you need to upgrade PHP on your machine. But I can't see how you installed PHP, so have no advice on how to do that.
 
1:33 PM
the conceptual issue I have with "nested attributes" is that the new attribute syntax is currently just a constructor call
that's different from Doctrine-style annotations, which are basically their own language
so in a Doctrine annotation, you can't write @Foo( new Bar ) not because creating an object in that scope isn't allowed, but because the declaration isn't parsed as PHP
 
@kooldev @Derick doctrine ORMs nested annotations can easily be replaced with non-nested, its not so simple for other libraries that are using doctrine annotations and went a bit more crazy :)
 
@Tiago do you have multiple versions of PHP installed? Does your environment variables need updating so that it's pointed to the correct version?
 
@IMSoP Actually there is not that much of a difference between the two. Doctrine's annotation reader aggregates all values and feeds them into an annotation class constructor that takes one associative array as argument.
 
@IMSoP the conceptional problem with nested attributes is also, how would target and repeatability play into this? Its an argument for having new NestedSomething()
 
@kooldev but you don't write an array, you write a bunch of named parameters
it's not like it runs eval in a restricted scope or something; it's a completely custom syntax
 
1:37 PM
@IMSoP Only if you call newInstance() on a ReflectionAttribute. You can call getName() and getArguments() and have that array anytime you like.
 
@kooldev huh? I'm talking about the fact that @Foo( arg1=42, arg2='hello world' ) has no array in it at all
 
@Tiffany Yes, I have some versions installed, but all local sites are set to php 7.2 on the mamp.
 
@beberlei There is a target "NESTED" that allows attributes to be used in that context. Repeatability is not relevant in this context at all.
 
@Tiago command-line PHP is separate from any site configuration
 
@IMSoP Depends on how you access the attribute. If you call getArguments() it will be translated into an array.
 
1:39 PM
@kooldev again, I'm talking about the syntax
you don't have to write @Foo( ['arg1'=>42, 'arg2'=>'hello world'] )
 
@IMSoP OK, this is correct but there is an RFC in the makings to support named arguments in PHP (Nikita Popov is working on it). If this makes it into PHP attributes will support that. <<Attr1(1, 2, someProperty: 3)>>
 
@kooldev you're still missing the point; let me try again to explain
Doctrine annotations are only loosely based on PHP syntax; for the most part, they are their own simple language, with @Foo and arg=42 being native syntax for that language
that language doesn't have a new keyword, instead using @Foo for both the top-level declaration, and for the creation of objects within the tree of arguments
native attributes are different: other than the new token for the top-level declaration (whatever that might be) they inherit all their syntax from PHP's constructors
so, if those get named parameters, attributes do as well; there's no proposal to add them only in that restricted syntax
 
@IMSoP "or performance cost of Reflection?" - are you implying that reflection has a greater overhead than normal functions in PHP? The 'weight' of reflection is only an issue in languages like C++ which normally don't have the reflection info added, so compiling it with reflection info adds to the size of the code. That's not an issue in PHP, unless I've missed something you mean.
 
@IMSoP I get your point but your statement about them "inheriting the synatx" from PHP's constructors is actually wrong. The do not inherit the syntax, see for yourself: github.com/php/php-src/blob/…
The syntax for attributes has it's own dedicated syntax rule in the parser and can be changed independently of function call / new syntax.
 
as far as the user is concerned, that's how it's been described; it may be reimplemented, but it's not been described as a DSL
 
1:49 PM
@kooldev The attribute arguments do inherit expression syntax
 
@Danack I defer to experts; "Reflection is slow" is a common perception, and already mentioned in that thread; if it's not true in this case, feel free to correct the OP
 
@NikiC Absolutely but the "constructor call" has it's own rule. We could sneak in named arguments or something fancy without affecting the remainder of PHP. Of course it has not been done, but it would be possible.
 
regex is slow
 
@kooldev I think that would be a very different version of attributes from what was voted in
or at least, taking it in a very new direction
 
@kooldev Right, but I also don't think we're ever going to do that :)
 
1:52 PM
@IMSoP Nothing has been added that was not part of the RFC. And the RFC mentioned the part about named arguments in it's "Future Scope" section.
 
nope, it says "Integration with a potential named arguments proposal for function calls"
that's basically the opposite of "add a custom attribute-only syntax for named arguments"
 
@NikiC And I am not suggesting to do that eighter. If PHP ever gets named arguments we happily use them. :-)
 
anyway, I'm not saying Thou Shalt Not Have Nested Attributes
just that they're an awkward extension to a syntax that's otherwise equivalent to a normal constructor call
 
If we read <<Foo>> as new Foo() why should it be awkward that <<Foo(<<Bar>>)>> would be treated like new Foo(new Bar()). (I am not proposing that syntax by any means!).
It is pretty much the same thing as @Foo(@Bar) and the annotation parser would do $b = new Bar() and pass that to new Foo(['value' => $b]).
 
@kooldev because <<Foo>> doesn't mean new Foo, it means "attach Foo as an attribute to something"; the constructor is only run if you ask it to via reflection
the nested <<Bar>> isn't attaching the attribute to anything, it only has meaning if you evaluate it as a constructor call
 
2:02 PM
@IMSoP What is @Bar attaching to in this example: @Foo(@Bar)?
Isn't that more or less the same situation?
 
it's not, that's what I'm saying
 
@IMSoP Now you've successfully got me confused...
PHP attributes do look like constructor calls in disguise but they are not actually constructor or function call at all. Internally an attribute is stored as a structure that has a name and a list of (positional) arguments. Apart from the name this is just like an ordinary array in PHP. You can access both parts individually using ReflectionAttribute and eighter getName() or getArguments().
 
right; what I can't see is how that would be true of a "nested attribute"
 
No constructors are called and no objects are created at all. When newInstance() is called it triggers object creation and passes arguments to the constructor.
 
so this is where I'm confused: what would getArguments return for a "nested attribute"? another ReflectionAttribute object?
 
2:11 PM
@IMSoP Exactly! We have to do that because whe cannot convert the attribute into an object because you if you wanted an object you would have used newInstance() in the first place.
 
I guess I don't really get what that would achieve
 
If we use newInstance() all "nested attributes" are created as object and we get tree of objects and values. In essence just a regular fully-instantiated object.
 
yeah, I get that part; it's what happens when you don't create them that doesn't make much sense to me
 
If we call getArguments() we get all the non-attribute values as-is. For each "nested attribute" it returns a ReflectionAttribute and we can use getName() and getArguments() again to recurse into that attribute.
 
but why?
 
2:13 PM
@kooldev @@Foo([@@Bar])
You can't return a nested attribute here
That would require returning an AST representation, not an evaluated constant expression
Just returning ReflectionAttribute works if the "nested attribute" is a direct argument, but not beyond that
 
Wouldn't it just return an array containing a ReflectionAttribute?
 
Besides, the whole attribute syntax debate starts out from the premise that attributes should not clash with expression syntax
To support nested attributes you'd have to make them part of the expression syntax
 
@NikiC I am compiling nested attributes into AST zvals of type ZEND_AST_ATTRIBUTE. Child 0 is the name, child 1 the arguments. This is kept in memory (and even in Opcache). I am reading the stores AST on access.
@NikiC For #[] attributes I added a rule '#' attribute_decl to expr: in order to support this.
 
I need to get on with other things; but it feels like "nested attributes" aren't a very well-defined concept right now, so discussing possible syntaxes for them is rather confusing
 
@kooldev But what do you actually return from reflection?
I understand how the AST representation looks like, but not how it translates to the getArguments() result
If we want to take a completely absurd example: @@Foo(1 + @@Bar)
Unless you are allowing use of nested attributes only to certain contexts, like function arguments and array elements?
 
2:20 PM
@NikiC Whenever I encounter an attribute during import of values into reflection I create a new ReflectionAttribute that handles access to the nested arguments.
Let me check by running your example, I hav not tried that yet.
If I call newInstance() it yields Uncaught TypeError: Unsupported operand types: int + Bar
If I call getArguments() I get Uncaught TypeError: Unsupported operand types: int + ReflectionAttribute
 
@kooldev Thanks
Okay, I now get what it is you're doing
 
The code can be found here: github.com/koolkode/php-src/pull/6 (#[] syntax, but could also be implemented using @@).
The basic idea is to store nested attributes in AST format and have a callback (CG(attribute_callback)) that is called whenever such an attribute is encounterd within zend_ast_evaluate(). The callback can be swapped out by Reflection to toggle between newInstance() and getArguments() behavior.
The zend_attribute structure is created by these callbacks and used during object construction or to drive a ReflectionAttribute. In bothe cases the zend_attribute is discarded after use because it cannot be persisted in Opcache.
 
2:38 PM
@beberlei, @LeviMorrison I'm looking into github.com/php/php-src/pull/5582. Thanks @NikiC!
 
@kooldev What benefit do you see in this approach, rather than making nested attributes "just new"?
 
@NikiC Consistency with the way attributes are implemented according to the RFC. Unfortunately there is no need for attributes to be backed by a class in any way. If nested attributes would require this it would put attributes in an inconsistent state as far as that requirement is concerned.
 
2:54 PM
@EnricoZimuel hi i did some benchmarks, it might be too much overhead when disabled
 
@beberlei how much in %?
 
@beberlei and if you benchmark it compared to PHP 7.4.7?
also I really want to make a plane joke
 
Sorry, I need to jet.
 
@kooldev I see. Yes, this approach does seem reasonable when one starts out from the direction of nested attributes as a dedicated language feature. I'm not convinced that's the right starting point though :)
 
@NikiC What would be your starting point?
 
2:57 PM
@EnricoZimuel 2% ish
 
@kooldev Generalizing constant expressions to allow object creation.
 
@beberlei if we provide an API or ini to enable/disable the feature? I was thinking to something like a flag that we can use to skip the before/end execution.
 
@NikiC That would be a nice alternative and extension to const expressions. I tinkered a bit with that approach too. It is a lot more difficult to do and one thing that I do not like about it is that we require top-level attributes to be be marked with <<Attribute>> but within arguments we could use arbitrary classes.
@NikiC What I like about the dedicated language feature is that it would also require nested attributes to be marked with <<Attribute>> to communicate that they are meant to be used in this position.
 
@kooldev I think that would be mostly solved by type declarations
 
@EnricoZimuel it needs to be so deep in core, disabling means during compile
Which means there is high risk distributions ship without it
 
3:04 PM
We need a separate mechanism for top-level attributes, but for nested ones we should be able to just use the "usual" type system
Like this attribute accepts Assertion[] or something
 
@NikiC yes please ;)
Nested is a 8.1 at the earliest topic anyways, so much todo for 8.0 still
 
@beberlei I see. Anyway, my original idea was different, just proposing some new APIs for override function execution. Something like this gist.github.com/ezimuel/ac07dd3ff4ca321b608de185c52ef3c2
@beberlei similar to the approach used here: php.net/manual/en/function.override-function.php
 
The point is to not override tho? Or am I misunderstanding something
 
@EnricoZimuel userland or internal?
 
@Girgias you right, the PR github.com/php/php-src/pull/5582 is about extensions to register function-specific begin/end handlers when the function is called for the first time in a request. My idea is to offer some override functions in PHP itself.
 
3:18 PM
Why on earth would you want to do that
 
@beberlei both
@Girgias many use cases: AOP, traces, profilers, etc
 
If you want to profile I don't see why you want to override the function, you want to hook before it's called and after it exits
Not modify it's content
Pretty sure you can already override stuff by hacking the opcodes tho
 
Basically using these new APIs + register_shutdown_function() you can provide a trace in pure PHP.
@Girgias I don't want to change the code, I'm just using PHP code to instrument the call_original_function(). My idea is to do everything in PHP without the need of an extension.
 
These API are for C extensions tho?
Yeah, not sure if I like that idea
Disclaimer: I haven't been following this whole topic
 
@Girgias no, just API for PHP.
@Girgias do you know the Go! AOP project? github.com/goaop/framework
 
3:25 PM
I don't do Go, I needed to look into what AOP is
But github.com/php/php-src/pull/5582/files doesn't provide any PHP APIs, they are C level APIs
 
@Girgias this project gives you the possibility to intercept userland functions using a pre-loading mechanism with composer. It's a really smart idea by @lisachenko. If we can have the override_* functions we can intercept all the functions in a more robust way.
 
Are you talking about Z-Engine?
 
@Girgias yes, they are two separate topics but the goal is very close.
 
I mean fair enough, but you're playing with fire there IMHO, but I haven't looked that much into Z-Engine as if I want to do something I just do it directly in C
 
@Girgias no z-engine is a different project, for using zend engine API in PHP using 7.4
 
3:28 PM
Because FFI IIRC has a massive issue with callables and closures
@EnricoZimuel I know what it is
 
@Girgias I already did in C as extension. Because of that, I found an interesting (I hope) use case to offer just a simple API in PHP to override functions. That's it.
 
I don't see why it can't just be an extension tho
 
@Girgias because if people can use it in PHP they don't need to install an extension.
 
And I don't see why installing an extension is such a problem
Sure PECL ain't great but it's not that bad
 
@Girgias it's not hard but for many people can be a blocking step. I collected some feedbacks and many "customers" was complain about that. That's why I'm investigating different approaches.
@beberlei what do you think about these override_* function?
 
3:34 PM
Like, I imagine if you want to do AOP you still want somewhat decent performance, which FFI doesn't have from what I recall, you then also get into the issue how it interacts with OpCache, as I would imagine you would want the "aspected"/overiden functions to be in OpCache
Moreover, the JIT makes a bunch of OpCache hacks not work anymore, from what I recall being said here
 
@Girgias have a look into Go! AOP is not using FFI at all. It's pure PHP.
 
God this name is so confusing
I thought it was talking about Golang
 
@Girgias now I understand your confusion :-)
 
Wes
3:48 PM
@PeeHaa i started working again. things are pretty bad but getting better
i am actually doing new stuff, i am learning after effects. it's cool. much better designed than the average adobe product :D
could do stuff without looking it up on google. incredible lol
 
Oh nice. Sounds cool
 
4:02 PM
@Girgias the main problem is needing to touch a system directory....avoiding that would make it way more usuable.
 
@Danack True, but I don't think the argument that "everything should be bundled with php-src or written in PHP" holds much value, sure the most is in pure PHP the less C code there is to maintain, and PHP is fast but some specialized things are IMHO better as C extensions
 
@Girgias with php8 you cannot hook into userland functions anymore without running the risk of triggering the new stackoverflow protection at 1000 call depth. zend_execute_ex is the overwrite that already exists for that, but when you overwrite it, the engine does not run in hybrid (goto) mode anymore but for every userland call, opens up one C stack as well
 
@beberlei Isn't this what Levi's instrumentation PR is adding as a first class citizen into the engine?
Like said I only vaguely followed this whole thing
 
@EnricoZimuel imho you cannot get around building APM completly in C, levi and sammy are trying with the datadog tracer to run callbacks in PHP, but the way they are complaining about it, it feels the wrong path :P
@Girgias it "might" have too much overhead to be mergable
i need to do more proper measurements
 
Wes
back in the day software was self explanatory, or it came with big ass manuals. now software is explained in 10 minutes videos on youtube, which are 1 minute content plus 9 minutes of nothing just to make it longer for the ads
 
4:13 PM
@beberlei I saw Dmitry's comment about that, however IMHO if the overhead is equivalent or lower to the performance of PHP 7.4, then it's fine
 
@Girgias I really wasn't saying that....
 
@Danack I know, I was ranting about something related :P
 
@Girgias i might setup a company laptop in terminal only mode, so that a benchmark doesn#t get interfereed with gnome processes. I rebooted before, but you never know whats running
 
@beberlei I used a very similar approach of datadog and I've an extension that call before/after PHP code for internal function. I'm working now with zend_execute_ex but it's not that simple, as you said. I'm also investigating with AOP approach, as you did in your POC here github.com/beberlei/php-ast-tracer-poc
 
@EnricoZimuel AST would be extremely nice, but it requires a few changes as well, another topic levi and sammy worked on. The problem is that you have to do a lot of rewriting to make sure you get access to the return_value
 
4:18 PM
@beberlei Meanwhile I'm benchmarking my Math code via a crappy laptop using PHP within WSL1 without OpCache, and when I want to see "actual" performance I just upload it onto the Linode server lol
 
since you need to detect all exit points also to take the "stop" measurement
@NikiC just realized i never checked if opcache was enabled during those wordpress tests, obviously it wasn't so scratch all results for now
@LeviMorrison ^
 
@beberlei actually I'm thinking using a different approach, something like @lisachenko did in his Go! AOP framework. Instead of adding before/after code into the function that I want to intercept I would like to use a proxy function that calls the original one, extending the class.
 
@EnricoZimuel i believe that is what datadog does with an opcode handler
 
@beberlei I don't think they are using an AOP approach for that. Maybe I'm wrong.
 
Child exited Segmentation fault, __strchr_sse2, putenv ・ Apache2 related ・ #79696
 
cmb
4:36 PM
@Jeeves, I'm afraid that OPcache is not compatible with mpm_event Apache.
 
@cmb The trace also contains putenv though
Could be a thread safety issue
 
@LeviMorrison meh, with opcahce enabled in php-cgi wordpress segfaults with the patch
 
I think @Danack hit some issue with putenv and threads, if I remember right
 
I think I was just groaning at the terribleness of it...
Apr 5 '19 at 15:25, by Trowski
Umm, also… wtf? https://github.com/krakjoe/parallel/commit/b9f49d7c9261d9ee792c6c7624b511e1eb83f8f5
Apr 5 '19 at 15:54, by Danack
getenv and putenv have are not thread safe. Joe's put a mutex around them for php7.4, but seems to have forbidden their usage in that library as otherwise they would be causing crashes.
@Jeeves "PHP Version: 7.3.19" probably the problem.
Haven't looked to check.
 
4:51 PM
@Danack Looks like you're right, not seeing any locking on 7.3
 
@Danack how do you find all those messages from ages ago so fast?
 
I'm good at remembering stuff that I've talked about. I've never used putenv in my own code, so searching for that, chat.stackoverflow.com/search?q=putenv&room=11 gives the first result.
 
It's well known that @Danack has an internal indexing system where he remembers chat messages and youtube videos
 
sorry, i meant on the page.
Small chance that my brain might be wired a tiny bit non-standardly: exeter.ac.uk/news/research/title_467790_en.html
 
5:13 PM
@PeeHaa Wait, is @Danack a bot?
 
More machine now than man, twisted and evil.
 
I trusted your pull requests!
 
cmb
@NikiC oh, indeed, seems more likely.
 
5:29 PM
@TheodoreBrown @kooldev so I asked the RMs about guidance and they came back with 2/3 vote to re-open the syntax discussion and then a secondary vote with simple majority. just to be sure that we don't cause trouble down the road by circumventing process.
 
it puts <<>> at advantage, but thats also fair, as the primary vote to include attributes was not complelty independent from the secondary vote. You could argue that the same RFC with a vote for @@ or for #[} might not have been accepted at all
 
 
1 hour later…
6:38 PM
@beberlei Okay, so 2/3 vote for "use shorter attribute syntax?", and simple majority between @@ and #[]?
 
7:29 PM
Why do people think mb_internal_encoding() would be equivalent to setting default_charset in php.ini
 
7:46 PM
Because character encoding is awful and evil and no one understands it.
@TheodoreBrown Did we figure out if it was possible to do RCV?
 
@Crell It sounds like the RMs would prefer a simple majority.
 
ugh.
 
00:00 - 20:0020:00 - 00:00

« first day (3527 days earlier)      last day (1418 days later) »