« first day (4232 days earlier)      last day (707 days later) » 

Ben
12:47 AM
HI
 
@JRL chat makes a good rubber duck. I've also talked to myself before.
 
Ben
So I'm trying to decipher the code and file structure my ex colleague has left me, and I have no understanding of PHP. I have managed to host it all on my web server, but when I go to the address, it's just errors. the latest I've run into is:
Parse error: syntax error, unexpected token "fn", expecting identifier in C:\Sports Website\base\model\base_m_fn.php on line 14
And the corresponding line in the corresponding file is:
 
You need PHP version 7.4 at least
 
Ben
class Fn
I have that installed.
 
Or maybe not?
Oh. There's a conflict.
fn is a reserved keyword as of 7.4.
Rename the class to something else across the project.
 
Ben
12:50 AM
Oh ok. So if I change that to e.g "func" that should fix it?
 
JRL
@Tiffany enum isn't a reserved keyword?
 
:54581077
Er... Mobile SO chat is prematurely sending messages when I'm trying to new line, and that was an accidental send
@JRL unsure, I think it should be but I'd need to verify and juggling a couple of other things.
Realized a way that page can be improved, and need to make note of it... and if enum isn't documented, that's another...
@Ben if you have composer installed, include filp/whoops if you don't have it already. It makes dealing with PHP errors sightly more bearable.
 
Ben
1:06 AM
The other thing is they seem to have incorporated some kind of "debug" functionality - I keep running into lines like this:
Fn::dbg( $GLOBALS["MSG_ERR"], "MSG_ERR" ); // find the TES values
Which it complains about: Parse error: syntax error, unexpected token "::", expecting "("
So based on you previous statement, I might need to run an earlier version of php
 
@Ben if you want to get the application running, yes, but this isn't recommended because older versions aren't supported and may have security vulnerabilities that won't be fixed.
7.4 is still supported with security fixes, but 8.0 is actively supported
@Ben :: is a static call to something
 
Ben
Yeah - I just want to get it running so I can then hand it over to someone else to fix. That way I'm not just giving them a directory and saying "fix pls"
 
Though, just going by the snippets you've pasted, makes me think of the legacy codebase I used to maintain that ran on 5.3.
 
Ben
1:25 AM
Well so far I've gone from getting specific errors to just a http 500 error...
 
1:39 AM
Check web server log
 
Ben
That's actually a smart idea haha
I've got "Coder brain" haha
 
Np
500 errors usually mean web server log will have more info
usually
 
Ben
2022-05-18 01:24:25 ::1 GET / - 82 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.67+Safari/537.36 - 500 0 0 46
That doesn't make such sense to me
That's the last line in the latest updated file
 
2:17 AM
are you running IIS?
IIRC, 46 indicates a subtype of 500 error, but I may be wrong
 
Ben
I am, yes - I also have the PHP manager running, and it seems to have its own log.
[18-May-2022 12:18:16 Australia/Brisbane] PHP Fatal error: require_once(): Failed opening required '_PATH_TO_BASE_DIR_spwb/include.php' (include_path='.;C:\php\pear') in C:\Sports Website\base\controller\base_c_execution_decision.php on line 26
 
you'll need something like php.net/manual/en/function.set-include-path.php to change the include_path to the root directory of the application, or the src directory, or wherever code is located
set_include_path will go in a front controller
I am stepping away for awhile
 
Ben
There are more lines like it (10 or so) on the same time stamp. So I think it's basically the structure of the directory
Thanks for the help! :)
 
 
5 hours later…
7:14 AM
@JRL Yeahno, so it is, but one can use it as a class name and such IIRC
readonly is reserved but can be used for function names (due to WP)
 
 
1 hour later…
8:23 AM
@Ben Looks like you're missing the setting of a constant called PATH_TO_BASE_DIR somewhere
 
 
2 hours later…
10:16 AM
Morning
 
10:50 AM
$message = "a\n\nb\n\n";
How can i replace multiple line breaks into one only?
Ah ok, this working: str_replace("\n\n", "\n", $message)
my prev attempt was with single quotation
 
cmb
more general solution: preg_replace('/[\n]+/', "\n", $message) (this folds multiple consecutive NLs to a single NL)
 
11:28 AM
Yeah thanks!
 
12:08 PM
as suggested the other day I am following this guide to build a secure PHP app:paragonie.com/blog/2017/12/… what i noticed is that it does not mention anything regarding throttling login attempts....do you think I should implement such a mechanism?
 
 
2 hours later…
2:34 PM
@Sara These PRs look good to you? I'll have to merge them by hand, but wanted CI to run to make sure I didn't break anything. PR for 8.0, 8.1, and master.
I guess I'll need a note about the bugfix though.
 
@LeviMorrison I don't have a ton of context for this, but at a glance I would say that so long as you've done a --debug build and had no leak reports, then I'm happy. ((Honestly, even if it does leak, it's CLI, the process is about to exit anyway))
Extra super double general: `preg_replace('/(\r\n?|\n)+/', "\n")`
This not just fold newlines, but carriage returns as well. It has the benefit of handling Windows (\r\n line ending) and legacy (pre OSX) Mac (\r line endings) all into a unified format (Linux style \n line endings).
 
@Sara The stream resources will still get freed but it won't call close or fclose on the underlying handles. We don't need to close the standard streams; the platform will do that (I mean, have you ever closed stderr in a program before?)
 
@LeviMorrison Right, which is why I'm unconcerned. Just worried about an associated emalloc hanging off the resource somewhere, which I know the memory manager will deal with, but I like to be tidy. And no, I never close stdout / stderr :p
Mostly 'cause I never open them.
 
Exactly, the platform does that, not the program.
 
But we do dup(1) / dup(2) in one of the codepaths, so maybe a little different here
 
2:45 PM
I'll double check, but those paths should be unaffected.
 
Not sure if these are STDIO file handles or POSIX FILE* streams under the hood here.
 
Yo Sara when are you working on the resource to object conversion for streams :p
 
Again, not actually super bothered at the end of the day, but ideally we want a --debugbuild to not show leaks 'cause it makes things annoying for extension developers looking for their own leaks.
@Girgias When I've decided I no longer want the will to live.
 
See that was me on Monday after one of my exams
One can always bounce back
 
@Girgias Maybe the foundation can sponsor someone to do that.
 
2:47 PM
Otherwise, book recommendations for streams and stuff like that so that I can have a read on them during the summer
I wonder who could do that
 
My book from 2006 covers them for a chapter, but probably not in a way that will help here.
 
I mean, maybe a more generic CS book about streams and IO lol
 
The crux is down to the lifecycle management that's.... quirky in the case of streams.
php_stream has persistence logic built in, and that makes the conversion.... less simple.
 
I really feel the thing which is going to make us move majors from 8 to 9 is rewritting streams
Tbf, I don't even want to look at the stream_context resource to object conversion again, as that's also pain
 
And contexts are SUPER BASIC by comparison to actual streams.
 
2:57 PM
i know
 
If we make a phpt test for a github issue, is there a filename convention for that?
 
gh99999 where 99999 is the issue number
I think
 
Thanks, that seems to be right:
$ find . -name "gh*.phpt" | head
./Zend/tests/attributes/gh8421.phpt
./Zend/tests/generators/gh8289.phpt
./ext/spl/tests/gh8121.phpt
./ext/spl/tests/gh8273.phpt
./ext/spl/tests/gh8366.phpt
./ext/opcache/tests/opt/gh8074.phpt
./ext/iconv/tests/gh7980.phpt
./ext/iconv/tests/gh7953.phpt
./ext/intl/tests/gh8364.phpt
./ext/zlib/tests/gh7953.phpt
 
Similar formatting for referencing it in NEWS files, so that link conversion happens automatically.
e.g. https://github.com/php/php-src/blob/282655083ebb4980826253e2b8e3d6d2d2901ff5/NEWS#L10

Fixed bug GH-7771 (Fix filename/lineno of constant expressions). (ilutov)
 
cmb
@Sara you could use \R instead :)
 
3:10 PM
Our release scripts will turn GH-\d+ into github.com/php/php-src/issues/\1
@cmb Is that PHP regex specific? I've never seen it.
 
cmb
@Sara no, general PCRE escape sequence; see "Newline conventions" on pcre.org/current/doc/html/pcre2pattern.html
 
3:26 PM
@cmb TIL. Well, there's a quarter century of time wasted.
 
3:39 PM
o/
 
4:12 PM
is there any particular cadence that new [patch] versions of PHP are released on? For the last few months it seems to always be on a thursday
 
@kguest TL;DR is every four weeks on a Thursday, yes.
 
thanks :-) I just realised our internal status page for a product I work on, pings secure.php.net/releases/active.php to see what the latest on-branch version is, and I don't think we need to do that too often :-)
 
Say you have 8.1.6 released on Thursday May 12th. 12 days after that, on Tuesday May 24th, we'll create the PHP-8.1.7 branch, and tag and build php-8.1.7RC1, two days later, we release that (on Thursday May 26th). 12 days after that, we tag and build php-8.1.7 final on Tuesday June 7th, and we officially release it two days later on Thursday June 9th. Then the next cycle starts up.
All that said, sometimes we're late (or deliberately delay), and the release ends up on Friday, or even a week off.
But the intent is every four weeks on Thursday, with all branches in sync on which week that is (8.1.6 releases the same day as 8.0.19, for example)
@kguest Glad to see you're at least using the JSON API. :)
Oh, and time of day is 100% dependent on which RM is doing the release. :) If they're in Europe, you'll see it earlier than if they're in the US, for example.
For your purposes, I'd probably ping early Monday mornings, when you'll actually want to act on it.
If you're worried about catching security releases quicker, then obviously ping a couple times on Thursday/Friday and check for `"tags":["security"]` in the JSON payload.
 
@Sara Gotta fix my messages then. I wrote Fixed GH-####, not Fixed bug GH-####.
 
that's nicely detailed - thanks!
given that we don't build from source (does anybody,these days, do that any more?) I think we can just store/request the info somewhere and populate it via a n [hourly] cronjob every thursday/friday.
but yes, our concern is security focused
 
cmb
4:40 PM
@kguest you could subscribe to the php-announce mailing list instead (or use NNTP to fetch the announcements).
 
How do I get a type name as a string? I'm using ReflectionType::getName() but apparently it's not documented, yet it works...
 
@cmb I'm already subscribed ;-) having this displayed on a status page means our IT dept can easily check it too
 
I guess that's because when I call ` public ReflectionParameter::getType(): ?ReflectionType` I get a ReflectionNamedType class, which is a ReflectionType subclass
 
cmb
@yessure yes
 
Do I really have to check if every return I get from ReflectionParameter::getType() is a ReflectionType before calling getName() ?
that's insane
:/
 
4:45 PM
use Mockery as m;
$fqn = m\MockInterface::class;
 
@LeviMorrison Might be fine either way, but best to follow style. :)
 
I just saw this weird syntax, can anyone tell why i cant use MockInterface without `m`
 
What's the commit message to skip CI stuff for php-src? [ci skip] or something? Does it need to be in a specific place?
 
@cmb I feel like the JSON API would be WAY more reliable. :)
@LeviMorrison Honestly can't recall. It's not like we block push on a successful CI run...
 
Yeah, no need to waste resources when all I did was change NEWS.
 
cmb
4:47 PM
@LeviMorrison Yes, that. I put it at the start of the commit message to be sure.
:54587057, your're probably right. Although subscribing to a mailing list avoids the polling.
@yessure ReflectionParamater::getType() always returns a ReflectionType() (or null); you need to check the specific subclass, though. Union and intersection types don't have a name.
 
@cmb ah okay makes sense now
Though I'd propose to move getName to ReflectionType
lol
noo makes no sense
forget what i just said
 
What PHP version did we enhance/fix --EXTENSIONS-- in?
 
cmb
@yessure There is ReflectionType::__toString() but that is deprecated; I don't think anything like that will be added. :)
@LeviMorrison 8.1
 
Thanks.
 
cmb
but there is still an unresolved issue: github.com/php/php-src/issues/8508
 
5:00 PM
Reflection is weird
 
@cmb So... should I avoid it then for a test in zend-test ?
 
cmb
No, use it. That bug needs to be fixed, though.
 
I wrote a basic dependency injector container. I guess I'll just leave it as is.. it just autowires classes by getting the parameters type name
 
@yessure have you looked at amphp/injector?
 
so handles only ReflectionNamedTypes
 
5:02 PM
I think it's production ready?
 
@Tiffany no, I'll take a look now!
wow it's huge
 
it may be what you want
@yessure gist.github.com/tiffany-taylor/5ed553c1efd7c4cdf3ca19a8ddbf18cd this has been my only foray with Reflection, lol
I can't remember if this was committed as part of the test
nope, it was committed: github.com/covie-io/sdk-php/blob/main/test/Unit/…, but was pretty heavily revised cause I was doing too much originally, I guess
 
lol nice
 
 
4 hours later…
9:14 PM
@cmb yes, it won't have any effect because a TypeError is going to be thrown. But I don't have any plans to remove the attribute any time soon. Maybe in PHP 10.0 (unless people still use it extensively. I know Symfony currently does.
 
 
1 hour later…
10:15 PM
I never knew how badly I needed generics in PHP until I started writing TypeScript
 
heh
 
 
1 hour later…
Wes
11:23 PM
does anyone know how to solve this? (refusing to allow an OAuth App to create or update workflow .github/workflows/build.yml without workflow scope)
 
Wes
11:47 PM
nvm solved it. it was Windows' credentials manager ¬__¬
 

« first day (4232 days earlier)      last day (707 days later) »