« first day (4429 days earlier)      last day (744 days later) » 

00:16
OK, figured it out. Reading scripts from stdin is the default, so you just don't pass any arguments whatsoever
But a bit weird there appears to be no mechanism to explicitly read from stdin
00:37
Hey there, I've been asked a question but seems people don't read it, or do not get it well, so downvote by default.

Is there a way to change a PHP function on a server level, NOT on a project level?
@NemanjaJeremic I have no idea what that means. Maybe give an example of what you're trying to do?
Let's say there is shared hosting, and users are not supposed to use some function, for bare example "set_time_limit()", and instead to trow an error if that function is disabled by php.ini, to just do nothing.
Not that I'm aware of. Any I'd recommend never using shared hosting. Using something like Heroku is far more sane.
@NemanjaJeremic I don't recommend this because it opens a door for a whole mess of maintenance burden, and requires understanding php-src well enough... but branching off php-src and maintaining your own version that does what you want?
Thank you @Tiffany
for understanding the question
I've tried to make an extension with the same function name, but as expected it trow a duplicated function name error.
So as I understood there is no way to change it other than compiling the whole PHP, and making changes to the php-src?
00:51
I'm not sure that making an extension will override the function behavior, but my knowledge of php-src is limited
Thank you @Tiffany for answers, ill try to post question again redefined, with hope ppl will understand it instead of downvoting :D
@NemanjaJeremic keep in mind, your use case is pretty edge... there's not much of a use case to "disable function from working at a core level without throwing an error" ... it's a bit silly
Like sure, I understand why you want to
But it doesn't change my opinion that it's a bit silly
Basically the only people who would want this are shared host providers
You could override it with an extension by manipulating the function table, but it's would be a lot of effort for something that anyone with malicious intent could find a way around
the tl;dr is that shared hosting is terrible :-)
Evening Tiffany, did you hear back about your talk yet?
00:58
I think today's the last day that CFP is open
So probably hear something in the next week or two
fingers crossed, is it an in person or remote one?
In person
Thank you all, as I said ill try again with question on sow :)
phptek 2023 is in Chicago :o
:o
A conference and party with Crell and Sara?
01:01
I dunno if my talk will get picked. I haven't spoken at a PHP conference, so that's a downside of picking me, and I'm not sure how much interest there is for a PHP docs talk, but from what I've heard from some people at Longhorn, seems like there is
It could probably be arranged
But before that, PHP UK
Exciting. I see Ian is speaking at it. Pretty good excuse to fly over :P
Ooo, @Girgias' talk looks interesting
@Tiffany It's the same PHP UK one if we are talking about the CFP for Chicago
well maybe improved, which currently it clearly needs compared to the version I gave in Paris lol
@Girgias you submitted it to phptek as well?
@Tiffany Yeah
01:08
Maybe will attend both :P
Kinda wondering if someone will just shout out "what about readonly properties?" and you just take a long, drawn out deep breath before launching into another hour.
:trollface:
I mean, I should upload my slides from the EN version of the Paris one I gave to PHP London, but it has huuum issues, and I've rethought the structure
So hopefully it'll be better :D
Yeah
I'm thinking I might offer a talk next year, I'm thinking of something along the lines of "Nested ifs and nested loops, and why having so many of them that their left edge goes off the edge of the screen will make your boss cry"
01:12
wat
I mean, if it can be made entertaining enough
I'm currently trying to figure out some code which has 72 columns of indenting to some of its loops
discounting the class + method, that's 16 nested control structures
I'm just ranting. I wouldn't actually do a talk on that xD
01:55
@MarkR I'm afraid to ask where you found that, since I probably know the answer.
@Trowski Search for 72 spaces, you'll find it :P
I was hoping it was in Fuel, but alas. That method length is pretty epic too.
 
7 hours later…
08:49
\o morning folks
I'm currently working on github.com/php-rust-tools/parser, and I'm finding myself spending too much timing making the parser context aware, so when parsing a type for example, it know whether to look for self|parent|static.. etc or not, depending if we are parsing a class, or a function ..etc.
It seems to me that PHP parser itself doesn't do this ( 3v4l.org/uELYa ), and only catches those mistakes at compile time. so my question, should i bother with this, or should i do the same as PHP, and parse these tokens as valid types all the time?
my thinking is that the earlier we exit, the better, since this parser is not intended to be fault tolerant.
09:56
@QuolonelQuestions Try with $(which php) instead php in .sh script. Not sure if can help, just something that's crossing my mind. Edit: Oh, you've solved it? Nice. :)
10:18
Morning
@cmb Yep, I temporarily fixed it. Had to compile with PHP 8.0 and for some reason that's what happened. Luckily that doesn't happen too often...
cmb
cmb
@alcaeus Ah, that is been fixed as of PHP 8.1.0 (heap.space/…). So consider to eschew -Wstrict-prototypes when building PHP 8.0.
 
2 hours later…
12:30
\o
13:08
o/
13:41
\o
14:28
\o
\0/
14:49
@Derick Sorry for the delay in getting back to you, was sick the last few days. I've already seen the RFC and didn't have any further commentary (neither on the doc, nor the RFC itself).
Just one note regarding the BC section "warning for broken serialisation data becomes a new Error" – this is not a new Error, this is unchanged. In fact ext/date was my example of choice for my RFC: 3v4l.org/7HsR9
@Girgias I wanted to add something to php.net/manual/en/language.exceptions.php, but that would likely first require an entire paragraph that explains what a stack trace is in the first place (unless we already have that somewhere?). It might also make sense to cross-reference the attribute in the “See also” section of php.net/manual/en/function.debug-backtrace.php.
The explanation of the attribute itself (php.net/manual/en/class.sensitive-parameter.php) I consider to be complete, I don't think anything needs to be added there.
(Other than the #[Attribute(Attribute::TARGET_PARAMETER)] attribute, but this is an issue that applies to all the attribute classes)
@Tpojka That had nothing to do with it. I just mixed up heredocs (<<) and herestrings (<<<)
15:06
@SaifEddinGmati Can't comment on your question itself, but it sounds like you want to use the parser for production purposes, not sure if a "for fun" project using a hand-written parser is the right choice from a maintainability perspective, when nom (github.com/Geal/nom) exists.
In fact there appears to be a nom-based PHP parser at: github.com/tagua-vm/parser (pretty outdated, though)
@TimWolla nom is pretty limiting at least from my experience, and there's plans to build some php tools using it ( see repos in github.com/php-rust-tools )
@TimWolla state management would be a nightmare to do in nom ( ref github.com/php-rust-tools/parser/pull/148/commits/… )
I've only had great experiences with nom (and parser-combinator based parsers in general).
how would you carry the state when using nom? 🤔
Yeah, I wouldn't. The validation in the comment you linked is not really the job of the parser, but of a validator walking the parsed tree. So I didn't really have that "problem" yet.
But indeed, as each parser of a parser combinator library may be used independently, you can't really access "outer" state and can only rely on the results of your inner parsers. Of course you could perform the enum validation, once you fully parsed the enum (i.e. once you've seen the closing brace).
15:24
@TimWolla No worries - I'll remove that BC line - cheers.
15:58
\o
 
1 hour later…
17:16
morns
17:28
@Crell FWIW, I very much agree with @Stephen on the __set calling when visibility doesn't see it as an "existing" property. I did raise this before, but my comment was summarily discarded.
18:28
I have a DOMNode. How can I append some HTML structures to it from a variable like "<span class='$class'>$line</span>"; ?
It's an object of this class
https://www.php.net/manual/en/class.domnode.php
It provides the appendChild method, but to make it simple, it doesn't work!

$xml = new DOMDocument();
$xml->formatOutput = true;
$xml->preserveWhiteSpace = false;
$xml->loadXml("<span class='$class'>$line</span>");
$node->appendChild($xml->documentElement);
It returns: Wrong Document Error
$node->textContent = "<span> .... </span>"; of course works fine, but the result is a raw text, not HTML.
19:17
you may need to var_dump some of the variables you have to make sure you have the right context... DOMDocument/DOMNode and friends are difficult...
you may need to use the ownerDocument property
last time I worked with DOMDocument heavily, I had to have multiple tabs open for the PHP manual regarding DOMDocument, DOMNode, and various methods/properties because the manual pages will explain in explicit detail how stuff will work...
also... if you're loading XML, you need a root node and such
 
1 hour later…
20:24
What... a... day...
what happened?
20:39
empty() is considered to be bad... but it's faster!
is this the devil tempting me
20:52
@Derick If we change the behavior now, it's a BC break. I sympathize with the behavior being a bit weird, but it's existing weirdness. If we want to change that logic, that should be its own BC-changing RFC.
i think that I'll replace all if($string === "") and if($array === array()) with just if($string) and if($array)
yay or nay?
@yessure You'll find ample people vehemently arguing both directions on that.
I think that if the variables are named properly it should be okay.
I'd better read some more articles / blog posts on this matter before doing anything
As long as you're consistent, you should be fine. The things to watch out for are things like strings containing only spaces, so they're not technically empty.
Also for arrays, consider if (count($arr)) {}
21:15
@StatikStasis Click.
yes, consistency is important.
`if(" "){echo "x";}` prints `x`, and that's correct for me.
As always, good advice, thank you!
21:29
SQL in MS Access is expletive deleted
@JoeWatkins Are you about?
21:43
<-- naively thought he could cut and paste a query from sql server in Access and it would just work
@Tpojka =D
21:58
@Jimbus Just because it's two Microsoft products that have been around for 25 years does not mean they'd be in any way compatible. It's silly of you to expect them to be. :-)
@Crell It makes my head hurt :-\
22:51
Any reason why
$p = new (Point);
wouldn't work?
Guess it works if you define("Point", "Point") first. Heh.
But why? o0
Same as new($name); someone explained
Yeah, that's parsed as a function named "new" with an argument of the constant Point.

« first day (4429 days earlier)      last day (744 days later) »