« first day (1747 days earlier)      last day (3205 days later) » 

6:00 PM
they want you to email them after they're fixed to ask for $
which is pretty cool, since it doesn't disqualify people who report bugs normally and don't think of $
 
Yes, I mean, can I mail them every time I fix an exploitable crash in PHP?
I'd be rich
 
probably :P
"Only critical vulnerabilities that demonstrate complete compromise of the system's integrity or confidentiality are eligible for a bounty"
low has the "remote" keyword :|
err
they all do
 
@RonniSkansing oh, you probably can't pass in the extra parameter since a while ago, and so need to use a function:
function getBackupRepository(EntityManager $em)
{
    return $em->getRepository('Backup');
}

$injector->delegate(BackupRepository::class, 'getBackupRepository');
 
Hmm.. this makes me consider doing something like J7mbo suggestion ..
 
I'm drafting an email to security@php.net with a PoC right now
too bad it's so narrow scoped -_-
 
6:09 PM
So I do not have to write binding each time I add a repo
maybe add in a autoloader
 
82
A: How to work with programmer with different preference of indentation width?

AlexFoxGillYou could use tabs to indent your code, then allow each user to customise their tab width. Alternatively, agree on a set standard and stick to it - there are far more important things to worry about in software development than tab width. That said, anecdotally most people use four spaces as stan...

Oh, nice.
 
@ThW That works
 
@RonniSkansing How many repos do you have in total?
 
none atm just started on a fresh project, but I guess there will be around 20
 
ThW
6:19 PM
@Orangepill I always wanted a valid reason to use (?J) in a pattern :-)
 
I have a register form, I want if user enter bad email (e.g. without @), I redirect him to the register form and show him a message. for sending that message should I use of session ?
 
@RonniSkansing Having 20 lines to fix stuff up is better than having magic autoloaded stuff imo.
 
Anyone know of a tool that can locate automatically config files for common services? Apache, PHP, MySQL, Mongo, FileZilla, etc.
 
Hmm.. would you consider having an array of repo names and a foreach?
 
@bwoebi This would be more convincing if I'd seen even a single project where tab indentation was done correctly
 
6:22 PM
@NikiC what do you mean with correctly?
 
@bwoebi Mix of tab and spaces
And many editors aren't able to deal with it correctly either
They'll normalize to tabs even the part of the indentation that is for alignment
It's a nice concept in theory, but it never works out
 
@NikiC This is the biggest problem with using tabs.
 
@NikiC because editors usually aren't smart enough to recognize what needs indentation and what needs alignment.
 
Otherwise I would prefer tabs as well.
 
@ThW What does that do?
 
6:24 PM
@RonniSkansing It'd be annoying as you'd still need to do stuff to pass the repo name through to doctrine. Seriously, just having functions is fine...
 
@bwoebi Yes, and humans are usually too lazy to fix up the editor generated indentation afterwards.
 
But if you use reformat tools, they usually fuck up fine grained alignment in every case.
 
So in the end what you get is a mess
 
ThW
It allows to use the same name for multiple subpattern - in this case value. So I can match different thing but access them with the same name in the match.
 
Which is why the whole "tabs let you choose your preferred indentation depth" is just wishful thinking
 
6:25 PM
@Danack I dunno why I am so scared of functions... maybe I can go in the middle with a closure
and thanks for the advice
 
@NikiC You know… that's why I don't use editor generated indentation … except in PHPStorm, which usually gets that right for me.
 
The code will only look exactly right if you use the same options as it was written with
@bwoebi So at that point you're sacrificing your own coding comfort for a useless indentation ideal? Good job.
 
@thW I was asking just complaining about a reg blowing up when I tried to use the name name in capture groups... like two days ago
 
They're slower - PHP has to do work to create them each time the bootstrap is run. whereas just doing $injector->delegate('someClass', 'someFunctionName'); does much less work.
 
@NikiC you very quickly can hit 4x tab. And it always reminds me to not nest too deeply.
@NikiC well, at least my code looks right (I think). … Because I sometimes view my code with tab-widths of 4 and 8.
 
6:28 PM
@bwoebi Your code might look right, if you're one careful person working on it.
Try looking at PHP with tw=8
 
by that logic hitting space 16 times would be a better reminder
 
@NikiC I'm always working with php-src with tw=8.
 
lol
Go read a macro.
 
seriously^^
 
user895378
@bwoebi is your screen 2 meters wide?
 
6:29 PM
@Danack .. oh.. so maybe I should pull out all my closures from the bindings/bootstrap lol
 
Reading a macro at tw=8 looks like rain is falling in your code
 
@rdlowrey working with screens larger than 2560 px usually^^
 
He is working on a beamer :-)
 
Needs refactor
 
@NikiC you mean the backslashes? That's why I always put them just behind the line and don't align them at an arbitrary offset…
 
6:30 PM
@RonniSkansing It's not a big thing, but it's one of the things Auryn gets right that most other DICs don't....
 
@bwoebi I usually do that as well, for that reason.
 
@NikiC See…
But if you look at that… lxr.php.net/xref/PHP_TRUNK/Zend/zend_types.h#608 … every single macro has a different offset… that's insane.
 
Well.. I will refactor the bindings file for function .. Great. I am ready to get digging again [=
 
@bwoebi to me, even 2 seconds is too much to wait for a single test
 
@ircmaxell for a single test, yes. But you can compile the outputs from all the tests together and then it's fast enough
 
6:35 PM
@bwoebi yes, and a compile error tells you nothing about what broke
test should be small and as self contained as possible
 
@ircmaxell it still does?
compile errors have very specific line info?
 
@bwoebi a good test tells you what broke just by the test name. Without having to dig through every line of output
 
@ircmaxell I wish…
 
I'd like to at least try to do that
I'll try generating a C AST, since then at least it's structural
 
@ircmaxell but that'll break the test every time you try to do a small optimization. while the output of php run with the extension will be constant.
 
6:40 PM
@bwoebi I'm talking about testing the output of a very specific expression. So the output of an ArrayDimFetch instruction
not the output of PHP code
 
hm, yeah, okay.
@rdlowrey (like 410 chars fitting into a single row.)
 
user895378
Why would you want that many characters in a row, though?
 
@rdlowrey to avoid line breaks on long lines? :-D
 
user895378
Bob, sometimes I wonder about you ;)
 
@rdlowrey Not sure what you're telling me, Daniel? ;-D
 
user895378
6:46 PM
Short lines are good. Why would you want to avoid line breaks?
 
@rdlowrey to have output less cluttered?
@rdlowrey there's nothing worse than reading a backtrace with line breaks.
 
user895378
There's nothing worse than reading code without line breaks.
 
@rdlowrey You misunderstood me. I meant avoiding line breaks in the output
not in the code.
 
user895378
ohhhhhhh okay then
 
Like frame #2: PHP_CodeCoverage->append(data=unknown type: 10, id=SebastianBergmann\Money\MoneyTest, append=true, linesToBeCovered=array(1), linesToBeUsed=array(1)) at /Users/Bob/phpunit/vendor/phpunit/php-code-coverage/src/CodeCoverage.php:287 … A very normal backtrace line… as long as there are no line breaks.
 
7:23 PM
0
Q: Cron job doesn't execute php file and normal file

RafeeI have two files, that needs to be executed every evening. PHP file contains the latest records from database, and creates a source file in same directory. And a normal file, even doesnt execute. I tried to check in /var/log/syslog. found that below. Log file Jul 29 13:56:01 ocs2 CRON[7016]:...

 
> Jul 29 13:57:01 ocs2 CRON[7117]: (CRON) info (No MTA installed, discarding output)
You're missing a mail transfer agent, like postfix. Get it installed so crond can send email with the output from the command.
 
whats that mean
 
Also, source is a bash command. You probably want to not use source and just have the shell script itself as the command.
In either case, once crond can send mail, you'll find out what's going wrong.
 
source is useful to modify your environment
otherwise don't use it
so if you edit .profile, use source to apply the changes
 
^^ that
 
7:28 PM
okay.. then do i need to execute that file using this command ./filename
??
 
@Rafee No. The ./ syntax is a hint to the shell that you're invoking the file in the current directory. You just need the path to the script. That's it. Nothing else.
@MarcelBurkhard, I fear you're correct.
 
hmm.. okay.
 
other than that it's not an ubuntu specific question IMO and not php related alltogether ^^
 
A auryn cookbook would be nice
 
Well there is some docs and if its not enough in my experience it takes a few minutes for someone in here to help you :D
 
7:35 PM
@RonniSkansing I dunno, feels more like it needs chemistry set instructions than a cookbook.
 
I tried to run with ./fullpath/filename it gives an error
bash: ./opt/lampp/htdocs/ats/cron_jobs/tt4: No such file or directory
but the file exits too.
and i have already change the permission to chmod +x
 
+zend_string*
+double
@ircmaxell
 
@JoeWatkins ?
 
$code = <<<'EOF'
<?php

class Foo {
    /**
     * @var int
     */
    public $int;

    /**
    * @var string
    */
    public $string;

    /**
    * @var double
    */
    public $double;
}
EOF;
 
7:45 PM
ah nice
 
this
 
so I'm planning on refactoring that typeInfo thing a bit, because I think we need much more info there. Because for simple types this is fine, but for type unions (int|float) it's not nearly enough...
 
yeah
 
oh no, an eternity since my last visit here.
 
need dtor
 
7:46 PM
so the good news is that I could not actually exploit the bug I found
:D
 
wait... are you compiling php code to a php extension???
 
@JoeWatkins yeah. I think I may make it an actual class instead with different methods
@marcio yes
@ircmaxell @Londiniumcom Why not help with some of the existing compilers?
 
I'm still going to author a patch later ;)
 
@ScottArciszewski yay
 
/me waits for @ircmaxell to be near laptop
 
7:49 PM
@JoeWatkins feel free to work on anything, including that corner
I'm not quite sure what it should look like yet, so the more implementation I can see the better the refactor can be
 
roger that ...
 
@ircmaxell ok, I see the php-compiler repository and it will support types on properties ^^
 
@marcio there are a total of 6 projects based around 4 core libraries
 
got dtor
 
nice!
 
7:58 PM
@ircmaxell yea, I noticed your recent repository folly 2 days ago. The php-optimizer itself is very important. Do you think it's possible to have such kind of improvements totally independent from the core src?
 
@marcio what do you mean?
 
reading this made me kinda sad: microsoft.com/en-gb/windows/gaming
 
@ircmaxell the compiler optimizations like constant folding, DCE etc. Can we have it without spread it like thin butter on the php core?
 
@marcio "spread it like thin butter"? I don't get what you mean
 
@ircmaxell there was an attempt to do some forms of constant folding recently, on ast level, but it failed. And I started to wonder if these things really belong into core.
 
8:04 PM
Core does constant folding. Not perfectly, but it is done
It also does DCE
It does not do constant propagation, or anything involving variables really
 
@marcio you can't really do it on the AST level
at least not generically
 
the only elimination I noticed was on situations like: 3v4l.org/081v0
 
@marcio DCE primarily refers to removing code that cannot be reached by control flow (which is done)
I think you're thinking more about elimination of dead assignments?
 
@NikiC only with opcache?
 
8:13 PM
@NikiC can you point me where one of these optimization is implemented in core?
(I'm not doubting in any way, just curiosity)
 
@marcio ext/opcache/Optimizer/block_pass.c
 
*optimizations
 
There are two types of DCE that can happen. Type one doesn't need to happen (code generated just won't be reached, the binary size may be smaller, but practically not much gain)
 
@NikiC ah, ok, so it's part of the opcache, thanks
 
the other type of DCE is where you eliminate executable code (not dead in terms of unreachable) that doesn't affect the result.
That can have MASSIVE performance benefits
 
8:15 PM
@marcio Most non-trivial optimizations are currently in opcache
 
Well, opcache actually does rather a lot of trivial operations. The trick is just that building the CFG is non-trivial.
 
what do you mean non-trivial?
CFG is trivial. Moving to SSA is not.
though with the paper @NikiC gave me, it's O(1) at least
 
@ircmaxell CFG is trivial as long as you don't try to latch it into an existing instruction structure with lots of idiosyncrasies ^^
 
^ this.
 
Doing optimizations on PHP's opcode stream, you gotta be very careful. Many totally innocuous looking changes turn out to break stuff in some weird edge case
 
8:30 PM
 
"code editing"? lolz
wait ut
wut*
everything there is wrong
except mabye repository (spelling wrong though)
 
Oh my gods.
The sheer concentrated stupid.
 
@NikiC true
 
@RonniSkansing the worldwide computer literacy levels are disturbing
 
8:35 PM
@RonniSkansing wait... is that even real?!
 
@AwalGarg yes
 
huh
 
The way your heart skips a beat whenever a new attack against Tor is announced. #justblackhatthings http://t.co/R0P2ksDMvl
lol
 
Bobs-MacBook-Pro-2:amp bob$ php -r 'exit(PHP_MAJOR_VERSION < 7);'; echo $?
10
Bobs-MacBook-Pro-2:amp bob$ php -r 'exit((int) (PHP_MAJOR_VERSION < 7));'; echo $?
1
 
user image
12
 
8:38 PM
@bwoebi what now?
 
snort bwahahahaha
 
@bwoebi holy crap
What's even going on there.
 
@Charles a check against IS_LONG.
 
@ircmaxell which paper? this is the only paper on chat history lafo.ssw.uni-linz.ac.at/papers/…
 
@bwoebi But ... but how does it get 10?
 
8:39 PM
@Charles because it prints true as string.
and dies with exit code zero
 
@bwoebi wat
 
If you call exit() with an integer it dies with the exit code equivalent to that integer
 
@Rafee well .. pornhub is a social network
 
@bwoebi yeah but shouldn't the comparison result in a boolean? how the hell is it getting string true?
 
@Charles I mean, it's a boolean
 
and the result is bool(true)
 
@bwoebi Right but boolean true should be integer 1 so the exit code should be 1 and not 10 and ... ow my head.
 
@Charles but it's not casted to integer, but to string…
 
@bwoebi but whyyy
 
no idea
 
8:41 PM
@Charles Because PHP supports die('error')
 
I'd like to fix that … if anyone agrees?
 
It can either cast to string or to integer
It decided to cast to string
 
does it make sense to cast bools to string?!
 
Which I would say is the wrong choice and you should fix it
 
Fix as bugfix in 5.x too?
 
8:43 PM
also for double I'd say
 
yeah
I'm just not sure if we can change that in PHP 5.x?
because it's a behvaior change…
^ @NikiC ?
 
@NikiC but but but ... string
comparison boolean should not be stringified and ... oh gods
 
@Charles yeah, you see.
 
@bwoebi This is why /r/lolphp exists.
 
@Charles I'm probably going to put it there, but first I want to fix that
And I'm not sure if I'm allowed to fix it in 5.6
 
8:52 PM
@bwoebi Gods forbid someone is using it as intentional behavior....
 
@Charles yeah, that's why I think I could. But I want to ask other people first about whether they think it's okay.
 
Want to loose hope in humanity? Watch this list: youtube.com/playlist?list=PLmWeueTF8l819bt3sC72soaG4JtfqJFcg
 
@tereško Martymer81's deconstruction of "spirit science" is related and also delicious.
 
@Charles I have seen I think everything from Martymer81
 
God Russia is a fucking asshole dumpert.nl/mediabase/6671909/81478ccb/…
2
To be expected, but still...
 
8:59 PM
@PeeHaa I think it's telling me that I am a bad person for using uBlock and is insulting me in some pagan language
 
thats cookie policy stuff
 
@tereško Oh yeah. yay for our great cookie wall of the EU
 
damn.. almost 2 almost pages..
 
lolwat. first time I got a captcha while browsing google search results…
 
@bwoebi They know that you're breaking PHP. They're on to you.
4
 
9:01 PM
The domain you get redirected to is cuntcookielaw (freely translated)
 
HAHA
 
haha
 
Sounds more Australian than EU.
 
@bwoebi I always got that when browsing with tor
 
@PeeHaa I'm not doing anything like that nor using a VPN…
 
9:02 PM
That is strange
 
it is.
 
So, my employer has temporarily brought on someone who broke away from the consulting firm they worked at to go independent; a consulting firm the employer has retained in the past. Well, while I've been working my ass off to build a usable dev and testing environment, and move away from the archaic and broken practices of current, this twat walks in and just starts shouting CONFLUENCE! JIRA! SCRUM!
And, unfortunately, the boss is listening.
 
lol
 
What the actual fuck do I do?
Besides quit, that's already in the works.
 
@DanLugg Good. Buying Atlassian products means they get more money to spend on the stuff my employer sells them. Keep me employed, please!
 
9:06 PM
@Charles I don't have so much a problem with Confluence. Jira can fuck off. And I'm not scrumming shit.
 
Jira's pretty easy to decrapify.
And their workflow mechanism is pretty decent as well.
 
@Charles I doubt they are having money problems :)
 
We turned their "scrum" burndown thing into a pipeline to fit our existing process.
 
Bah well, shit and fan.
 
@DanLugg at least he didn't shout "Zend Framework!"
 
9:10 PM
lol... he did.
I shot that right the fuck down.
Like, not even kidding. That was one of his first recommendations.
 
oh no
 
@rdlowrey Don't you have a redis client of some kind?
 
The usual solution to all your problems is to hire me.
 
At work we are going to investigate managing sessions with Redis (we need to move off of file-system based).
 
Like, I try not to be a dick most of the day, regardless of circumstance. But I find that every single meeting we're in, I'm compelled to oppose his ideas. Mostly because of valid reasons, but it's almost become an instinct now.
 
9:12 PM
@DanLugg this consultancy won't end well, don't quit yet, wait for it to fail ;)
 
user895378
@LeviMorrison Yeah we've got the amphp/redis thing but it's about to be updated to use the newly v1 amp under the hood so I'd give it a few days before using it
 
Does it have to run in non-blocking? How configurable is it?
 
@marcio Well, the problem is the boss has his head in the clouds. He's like a senior toddler who plays with paper and tells stories about the good old days.
 
I assume it requires PHP 7 then as well?
 
user895378
nope, php5.5 is fine
 
user895378
9:13 PM
If you don't want it to block you just do this:
 
user895378
$result = wait($redisClient->whateverCommand(...));
 
Even though I was hired under the premise to "fix all the things and modernize their practices", I'm guessing they didn't like the answer, per se (rewrite).
And wanted him to "corroborate" my ideas/plans, by which they meant redefine.
 
@rdlowrey Yeah, I think we are weeks away from investigating it.
 
@DanLugg I know that kind. Someone comes selling gunpowder as the latest invention and he chooses to believe it and gets all enthusiastic.
 
user895378
@LeviMorrison cool, well should be fine by that time. We've just finally got a stable underlying library to work with so we're having to go through and update all the libs to use that.
 
9:17 PM
@marcio Yep. Further to that, I was basically told outright that they don't exactly "trust my judgement exclusively", and because he's like "one of the family" they wanted his opinion.
 
Debian 8 has PHP 5.6 and we might be doing custom builds anyway.
Should be good for version compatibility.
 
@DanLugg So they really saying that you are smarter then them and they can't understand what you are doing so they want someone to dumb it down for them?
 
@DanLugg I work with consultancy 1/4 of my time and luckily it's usually to clean up the mess of the "CONFLUENCE! JIRA! SCRUM! Zend Framework!" gunpowder seller. Gunpowder burns quick.
 
Any Linux users here? I have been working on this PHP script at work and I'm at my whit's end, need some help
 
@samrap what's the issue
 
9:30 PM
@ircmaxell Awesoe :)
 
i need to do something quite simple, use shell_exec to list the cron jobs in the root's crontab. No matter what i try, i get an error. I know it is because apache user is running PHP, so I use 'crontab -u root -l' but then I get this error: must be privileged to use -u
 
@samrap Right, because you can only edit root's crontab if you're root.
 
orginally i was getting the error '/var/spool/cron' is not a directory, so i changed the permissions to be readable by apache
im not trying to edit, only read it
 
@samrap That's a huge-ass security issue and you should change it back.
What exactly are you trying to do as a result of reading the cron jobs?
 
i know it's not the best implementation but my lead is insisting we do it this way:
provide a user interface to update a cron file that will sync to databases
so the user will need to see what the current cron job is, and then potentially edit the times
 
9:35 PM
@samrap does this cron job really have to run as root
 
Are you trying to manage cron in general, or are you trying to work with specific cron jobs?
 
no, but we have no other users on this machine
specific cron jobs @Charles
 
@samrap add one
 
@samrap Can the cron job run as apache?
As in, the user.
 
Genius
 
9:36 PM
Because if so, then PHP would be allowed to invoke the editor.
 
Why is the root users crontab being used at all? Have you considered using /etc/cron.d instead?
 
i tried that @Charles for some reason I was getting an error, let me try again so i can see what it was
'/var/spool/cron' is not a directory, bailing out.
that's the error i get
when the cron is set under apache
shell_exec('crontab -l 2>&1'); is the function call. If i try with -u apache i get a permissions issue error
Forgot i changed the permissions back. If I add read permissions to /var/spool/cron/* I get this error: System error You (apache) are not allowed to access to (crontab) because of pam configuration.
 
0
Q: Non-root user is not allowed to use crontab due to PAM restrictions

RajI have the issue that I am not able to use cron with my normal user ( other than root ) [coins@COINS-TEST ~]$ crontab -l Authentication service cannot retrieve authentication info You (coins) are not allowed to access to (crontab) because of pam configuration. Could you please explain me how ...

Also, you shouldn't need to use -u. Excluding it will edit the current user's crontab.
Also, I seriously hope that this is an internal-only system...
 
Yea I had found that answer about an hour ago, but my entire /etc/security/access.conf is commented out @Charles
And unfortunately, it is not
 
Yikes.
 
9:43 PM
The only thing the user will be able to change is the time, and it will obviously be verified and sanitized before editing the file
 
Okay, I got it. You manually create a cron job that, once a minute, dumps the current cron job list and accepts input to change it. Problem solved!
(This is actually a serious answer.)
 
That is actually not a bad idea. Dumb it into a text file somewhere and then the PHP script can read from that
 
@samrap btw Cron is not a good fit for this....you would be better off just having a background task that is running all the time (but just sleeping mostly) and doing stuff when required. supervisord.org is good way of managing background tasks.
 
I don't have the time to read through the documentation of that. The lead recommended it as a cronjob and this is only my second day here so I doubt he will change his mind...
 
> I don't have the time to read through the documentation of that.
Yes, because getting started on the task is more important than thinking about the task.
Even if you don't have time to evaluate it, you could read it for 10 minutes, and then ask your lead if they had considered it.
 
9:52 PM
Yea I will do that, you're right
 
The problem with cron is that it's tied to a single machine, and hard to figure out if it's running correctly or not, and hard to pause, or re-schedule, as you're finding out.
Having a task that is managed by supervisord gives a nice little web page where you can see if the task is running or not, see it's log files, pause or restart it if necessary.
 
^ this
 
And having the task be able to read from whatever data source to check to see if it should be running or not, is far less fragile that twiddling cron files.
 
Seeing failures and restarting in a reasonable interface is huge imo
 
oh, and the ability to have the running tasks be distributes across multiple machines is also nice.
btw @cspray a beard question. Do you ever have problems with ingrown hairs ?
Because I feel like ripping part of my beard off to get at one....
 
9:57 PM
@Danack Not at this point. When it was a little bit shorter, yea. These days my problems are more like: "My beard got caught in my zipper" and "I wish the wind wasn't blowing my beard back into my face"
And other things that you don't think about until you have several inches of hair hanging off your face
 
Yep - I have issues with seatbelts....
 
Seatbelts are also a bitch
 
I will still need to have a web interface that allows the user to update what time of day the process needs to run. I don't see how supervisor helps with this
 
Sometimes I feel like the maintenance of the longer beard isn't worth it. Then I remember I really hate shaving.
 
10:01 PM
@samrap It doesn't. But it means that you can just store that information in say a database, and just allow the task to check "Is it time to run now?" and if so, run what needs running, and if not, just sleep for 1 minute.
 
maybe some people here can help, although not php related...
0
Q: fakeroot cdebootstrap: Failed to unshare: Operation not permitted

Florian MargaineOn Debian, when running: $ fakeroot cdebootstrap stable /tmp/foo cdebootstrap downloads the packages, but when it has to extract them, I get this error: E: Failed to unshare: Operation not permitted How can I run cdebootstrap as non-root?

 
Ah @Danack I see, what about just using an /etc/init.d service for that? Is it similar to supervisor
 
@samrap If you are good at making RPMs/DEB packages then maybe....though supervisor is still a lot easier to deploy new tasks in - it's just a case of sym-linking the config file into the supervisord conf directory, rather than installing a new service, and having to setup monitoring/restarting yourself.
 
@Danack hehe
@Danack relevant
:P
 
Ok thanks for all the help @Danack
 

« first day (1747 days earlier)      last day (3205 days later) »