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.
@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?
@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
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
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.
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"
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.
@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. :)
@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.
@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 )
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).
@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.
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
@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 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.
@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. :-)