« first day (2019 days earlier)      last day (2947 days later) » 

12:12 AM
I'm writing a blog on how to write tests for PHP source. Other than checking code coverage for gcov.php.net and writing failing tests to confirm bugs on bugs.php.net, are there any other places you can think of to go to see what tests need to be added? :)
 
12:53 AM
@LeviMorrison can we have the new union type patch on 3v4l.org?
 
til: castle black was built on the future site of the overlook hotel
 
 
1 hour later…
2:05 AM
Why doesn't define('WP_DEBUG', false); hide the errors? wtf wordpress
 
you're using wordpress. it's one giant error staring you in the face all the time.
 
Oh.. there were 4 cache plugins installed. (wtf?). And two CDNs. (wtf!?).
 
2:46 AM
mornings.
 
Morgen
 
I made a mistake the right thing and went full yield from. then read the actual f****** rfc and realized why pushing to production php5.6 shared hosting server failed. fml
 
Ekn
3:16 AM
mornings
 
3:37 AM
mornin Ekn
 
 
1 hour later…
5:05 AM
morning
time to go to work
have a nice-next-8-hours-or-so
 
mornin @RonniSkansing have a great day
 
hey, really hoping i can get some help here.
I am working with woocommerce...yeah I know....and I am looking to build a plugin to add a shipping method. How WC does shipping, is you tap into a hook and use a class to extend it's shipping class.
So class foo extends wc_shipping {
but i need to add multile methods, which means multiple repeated blocks of code
so I wanna do something like class $variable extends wc_shipping, but obviously that wont work
so is there a way I can just do something like

class foo extends wc_shipping {

__construct() {

return new some_class()
}
eg thru deflection or something
 
5:38 AM
morning
 
g'mornning
wanna take a stab at my issue? :)
 
@marcio I have no objections; I don't know how to get it there ^_^
Anyway, I now have Ubuntu 16.04 LTS running on leviathon with the basics for compiling from source.
So it will be easier for me to build stuff at nights if my kids let me.
@JoeWatkins I'm going to bed but didn't you say you had GC issues with type expressions? I think I reproduced it at the very least.
 
5:58 AM
@LeviMorrison huh ?
@marcio bob is going to ask sjon to put it up, after fixing some leaks, I think ...
 
6:17 AM
moin Joe
 
moin :)
 
nin
 
indeed
 
moin
 
6:23 AM
at beginning i thought nin means "no it's not" :P
 
yes, that's well established by now Chris ...
 
nine inch nails
 
I have to go riding/driving round the island, depositing family members in various places ... lata peepz
 
@JoeWatkins people forget things. I often go into projects involving MySQL thinking "it can't be that bad" when I haven't used it for a while. That's why it's important to keep reminding people of things on a minute-by-minute (or moin-by-moin) basis.
 
o/
 
6:43 AM
mornin
 
yo mornin tereško
 
Good morning!
 
Ekn
mornin
 
morn
 
7:01 AM
hai guys how to upload 1gb zip file into a database, either in mysql or sql server.
 
Moin
 
moin
@Crysis Don't. Just upload it to your filesystem and save a reference in your db. It's much more stable and efficient.
 
@Oldskool i cant understand can u pls elaborate.
u mean just store the file info in db and store the main file in directory right?
 
@Crysis Databases work best if you just store metadata in it. Id's, references, names. But real binary data is huge and makes performance sluggish.
@Crysis Yes, exactly that. For example store it to /my/uploads/fileA.zip .. and store that path in your database.
 
7:19 AM
@Oldskool if u move a large file to folder it takes the copying time right? if the size is 5gb it wil take time, so i have analyzed and found something called SSIS in mssqlserver 2014, have u have any idea about it.
 
morning!
 
if you try to save the file in a remote sql server, then no matter what new tech they provide, the copying is gonna take more time than copying to the filesystem because of the bandwidth bottleneck
 
SQL Server Integration Services (SSIS) is a component of the Microsoft SQL Server database software that can be used to perform a broad range of data migration tasks. SSIS is a platform for data integration and workflow applications. It features a fast and flexible data warehousing tool used for data extraction, transformation, and loading (ETL). The tool may also be used to automate maintenance of SQL Server databases and updates to multidimensional cube data. First released with Microsoft SQL Server 2005, SSIS replaced Data Transformation Services, which had been a feature of SQL Server since...
 
@AnmolRaghuvanshiVersion2.0 I don't think so. It's a terrible thing to do, but the question itself is clear and valid IMO.
 
7:23 AM
that's why asked :)
 
@DaveRandom I don't know "please suggest a better way" always raises a flag in my head that this is going to become an opinion-based "I think X is better" waterfall of answers.
 
@Oldskool True, it is subjective. But I'm hesitant to just cv it without explanation (writing a comment now)
 
posted on April 26, 2016

New Cyanide and Happiness Comic

 
but does connecting to 35 database is good?
 
user image
4
 
7:25 AM
@Saitama LOL, not that difficult, just take exactly that photo and send it to the boss ;-)
Should give him a good laugh too.
 
:P
 
Basically that is a bad question only because of a lack of understanding of the technical problems from the OP, and that lack of understanding is exactly why he is asking the question. It reads to me like someone who is looking to improve there code and themselves, rather than a "give me codez" request.
 
True, but I still feel this is somewhat applicable:
> Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.
Although that depends on the time and effort the answering parties take.
So, yeah this is a bit of a tough one.
It could be answered with some benchmarks/personal experiences. So I'll just give it the benefit of the doubt for now.
 
@Oldskool Yeh I CV'd it with a comment and an invite here
 
@Gordon wat u r trying to say, we can use it or not?
 
7:31 AM
@DaveRandom but OP don't have much reputation for chat
 
@Crysis it doesnt look like its going to help with storing large files
 
@AnmolRaghuvanshiVersion2.0 Oh :-(
 
@Gordon is there any way for storing large file into database.
 
Anonymous
mornin
 
o/
 
7:35 AM
19 mins ago, by Oldskool
@Crysis Databases work best if you just store metadata in it. Id's, references, names. But real binary data is huge and makes performance sluggish.
 
nmirnign
 
Ekn
indeed a good morning PeeHaa
 
ohai @Ekn
 
moguhh
 
7:40 AM
o/
Only 4 hours to go on the rep magnet @VicSeedoubleyew :-)
 
!!rebecca
 
@Gordon Only 2 days, 16 hours and 16 minutes left until Rebeccaday, OMG!
 
\o/
 
\o/
 
@Gordon ok thk u.
 
7:46 AM
2 messages moved to bin
 
> The study indicates that if objects are larger than
one megabyte on average, NTFS has a clear advantage
over SQL Server. If the objects are under 256
kilobytes, the database has a clear advantage. (taken from [this research paper](http://research.microsoft.com/apps/pubs/default.aspx?id=64525))
So, if you're talking about 1GB files, the choice is abundantly clear.
 
Also: common sense
 
^ that
 
You neither store your bike in the fridge
 
7:49 AM
@PeeHaa Yes, but this acknowledges it with benchmarks and test results.
 
Pffff. Who needs numbers when we can wildly guess :P
Damn my ewngrish is totallyt bropkenb todayfe
 
@PeeHaa Well, it seemed that after a few friendly suggestions OP still wanted to store stuff in the DB. Sometimes they need a little help to realize their mistake with facts :)
And it's actually an interesting paper :)
 
Now we also need to find the paper that says that sql server is a danger to life and sanity :-)
Hold on. I'm going to insert coffee.
 
LOL, well yes.
But OP mentioned he was using SQL Server, so this paper seems useful.
 
Especially, when it running on UNIX platform )
 
7:52 AM
morgen
 
moguhh
 
@lisachenko That is going to be possible soon.
MS finally woke up ;-)
 
@FlorianMargaine morgen
Sooo tomorrow it will be a day off and terricrap weather. Such a shit country
 
@PeeHaa Yeah, I'm also thinking of just staying in. Outdoor activities are not going to be too much fun if the predictions come true.
 
Anonymous
@PeeHaa UK ?
 
Anonymous
7:55 AM
Because it sounds like you're describing UK...
 
@JayIsTooCommon same shit different country
NL
 
Anonymous
hah
 
Netherland?
 
@PeeHaa :-)
 
!!google NL
 
7:57 AM
its a PR
the plugin is available in here
 
@PeeHaa your fridge is obviously pathetic
 
We are not merika man :p
 
@Jimbo must store his bike in the fridge... :P
 
Ekn
lol
 
I didn't knew google.com/shopping that website exists.
 
8:03 AM
72
Q: Files - in the database or not?

Jack DouglasWhat is the best place for storing binary files that are related to data in your database? Should you: Store in the database with a blob Store on the filesystem with a link in the database Store in the filesystem but rename to a hash of the contents and store the hash on the database Something ...

 
@Duikboot nice
 
Anonymous
@Duikboot shop from banggood
 
Anonymous
!!google banggood
 
yeah they will bang good
 
@FlorianMargaine The first disadvantage is imo the biggest one
 
8:05 AM
:D haha, I just stumpled on that Google site, Duikb00t has nothing he want's to buy.
 
Anonymous
Everything is really cheap, and the descriptions for the good are sometimes fun to read.
 
banggood site is so unexpected fast.
 
Anonymous
> Singing bird hear you whistle, whistle, this is a single bird, if more bird, you whistle,
hear the birds sing together, after a after singing, other singing along, and let a master - other birds singing along
 
Anonymous
 
Hahaha :D
 
8:09 AM
@PeeHaa meh, you have to have your data somewhere anyway
whether it's in a big db or in a big fs doesn't make a difference imo
 
@FlorianMargaine bigfs is much easier to backup incrementally
 
@PeeHaa uh, no?
 
uh yes
 
I usually take VM snapshots though, so I guess I'm biased there
 
8:12 AM
I do that too, but on top of my daily rsyncs
 
Hey champions!

Which one is best pattern and Secure

First One

$CompanyRes = array();
$Company = "select * from `ws_company` where `cm_status` = 1";
$CompanyQuery = mysqli_query($this->connection,$Company);
while($rowCom = mysqli_fetch_assoc($CompanyQuery)){
$CompanyRes[] = $rowCom;
}


Second

$CompanySts=$this->pdoConnection->prepare("select * from `ws_company` where `cm_status` = 1");
$CompanySts->execute();
header("Content-type: application/json; charset=utf-8");
$CompanyRes = array();
while ($row = $CompanySts->fetch(PDO::FETCH_ASSOC)) {
 
That Jeeves is running at Jeeves' Playground #2, so you can try that plugin in that room
 
Please guide me
 
@Mr.Developer They do different things
 
unrelated, but I have 2 favorite links on dba.SE, so I might as well paste the other one: dba.stackexchange.com/questions/2450/…
 
8:16 AM
Also learn about properly handling encoding and learn what prepare does/is
@FlorianMargaine Yeah don't get me started on that :P
 
@PeeHaa :D
 
ping @NikiC
 
wotd
!!wotd
 
puckish: mischievous; impish.
2
 
Easily misheard ^
Stop acting so puckish!
 
8:32 AM
It would be nice if it is used in a sentence too when running the command for the mentally impaired like myself
 
morning
 
Ekn
o/
 
Maybe even auto pin it when there is not that many pins yet @Fabor
Morgen bob
 
auto pin?
 
Pinned star ->
 
8:38 AM
Good morning y'all!
 
if (pinned message < 3) pin !!wotd
 
@PeeHaa Jeeves has bullied me... I've given up on him.
 
@iroegbu how?
 
:P
What did it do?
 
I was trying to implement translation... It just didn't work or I ran out of patience or both.
 
8:39 AM
@PeeHaa did you take a look at the PR ? ;-)
 
'nin
 
o/
 
I should probably share the file so, someone else can pick it up and complete...
 
@Saitama Not after yesterday. Should I / are the issues fixed?
 
yep
 
8:44 AM
I've broken some things and I've put some useless var_dumps
 
@iroegbu Those are the best kind
 
I assume this should be part of the header instead of the body
 
var_dump over XDebug - any day, any time
@PeeHaa if you put it in the head, you'll get errors from the api about missing args
 
hey if a php site don't filter user input ,can we see the php info page?
example login-callback.php?redirect=text.php if redirect url parameter not filter by website can i visit php info page?
using code injection
 
sigh microsoft
 
8:50 AM
Google isn't free...
 
Yeah was just sighign about the fact they don't just use an authorization header like the rest of the world
 
gist.github.com/iroegbu/… works as expected though
 
What in specific doesnt work?
 
Anonymous
@Jimbo o/
 
8:59 AM
\o
 
@Jimbo yo
 
@Jimbo o/
 
@PeeHaa It doesn't translate...
API responds with message you send
 
I'm quite surprised internals didn't blow up at intersections/unions ...
nobody has even said we're trying to turn php into something else yet ... disappoint ...
 
@JoeWatkins Just wait to you put it on vote :P
 
9:10 AM
so, you have something to go by, this works as expected. It translates perfectly
 
@PeeHaa I'm not involved in any of that ... I'm going to bravely leave that up to other people ...
 
:-)
 
actually this is just in my way ... I only started to get it out of the way, so mission accomplished, I can go back to typed props in a month or whatever ...
better than waiting a year ... we already waited a year for a union patch ...
 
True
 
9:18 AM
:)
 
still 485 php rep to go for my own gold badge... so close, yet so far away ;-)
 
Stop while you still can :P
 
@PeeHaa can't you see the man is asking a question? besides the useless comments.. xD
 
Anonymous
@PeeHaa He's getting sassy
 
It's just so fucking annoying and scary at the same time when you tell OP what he has sucks so bad it's not funny anymore and they don't listen
 
9:34 AM
@PeeHaa "secured connection is not an option", well then, security is not an option either...
 
Exactly
user image
6
 
On the PHP FPM status page, what's the difference between "listen queue" and "listen queue len"?
 
@PeeHaa PeeHaand :D
 
@JoeWatkins I've realized just now that you're forbidding any default except null for unions … any reason why or lazyiness? :-D
 
Ekn
can't unsee uni(c)o(r)ns anymore
2
 
9:41 AM
wel I thought about it for a while, and I'm not sure there is reasonable behaviour ... for non union types we don't allow to declare the wrong type ...
<?php
$foo = function (string $thing = 42) {};
?>
 
right
 
Fatal error: Default value for parameters with a string type can only be string or NULL in %s on line 2
so it seems to be reasonable to allow only null for unions, no ?
 
we might just call our verification function from executor and check it with strict types
$foo = function (string|false $thing = false) {};
any reason why that shouldn't work?
 
no, I obviously didn't think about it enough :)
 
Seeing the leaks on travis … looking
 
9:44 AM
 
Ekn
 
lol
 
@Ekn Pretty accurate.
 
Uhhhmmm does anybody see proper attribution on here nusphere.com/kb/phpmanual/function.ob-start.htm ? cc @JoeWatkins
I'm fairly certain there are some rules on copy/pasting docs verbatim
 
9:59 AM
@PeeHaa Not on that specific page, but here: nusphere.com/kb/phpmanual/index.htm
 
Hi Guys, how to return http status code with a rest api? I tried like this
 
@Oldskool I doubt that is enough
 
http_response_code(198);
print json_encode($result);
 
but its not working
Every time i get header response 200
I tried like this also
 header('HTTP/ 198 Reason Phrase As You Wish');
 
Anonymous
10:01 AM
Who is github gooh? Is that Gordon?
 
@user3454479 header('HTTP/1.1 198 Something failed');
@JayIsTooCommon Yes, that's Gordon.
 
Anonymous
ah
 
@JayIsTooCommon As in go-oh = Gordon Oheim, not all that cryptic ;-)
 
@Oldskool i tried like that. But its not working. Is it problem with different headers ? I have this header also
header('Content-type: application/json');
 
Anonymous
@Oldskool Of course, how silly of me :P
 
10:03 AM
to read the json data
 
@user3454479 Have you enabled error reporting?
 
Yes. I got Cannot modify header information - headers already sent by
Cannot include two headers?
 
@user3454479 Not if something else is already setting it.
Which is apparently the case.
Not that setting cookies/sessions also tampers with the headers.
 
To read the JSON data i am using like this
header('Content-type: application/json');
$request_data = json_decode(file_get_contents('php://input'),true);
 
As long as you put the status header above that, that shouldn't be the problem.
But I think the order might matter here. I'd go for status -> content-type -> content
 
10:06 AM
While sending JSON response i need to set http status code. For that one i tried like that.
 
But if PHP starts complaining about headers already being sent, you're likely either setting a session/cookie or this script is part of a framework that already crafts the request for you.
Bottom line is, PHP doesn't lie about headers already being set.
If it says so, it is so.
 
OK. @Oldskool. But i am checking with Postman tool for testing the webservices. I am not using any sessions
 
meh, our manual doesn't even do attribution properly ... that page has been static, forever ...
@PeeHaa
 
@user3454479 That doesn't matter. Something in your script is apparently still setting headers at a point where it's no longer possible.
 
Ok.
 
10:32 AM
@JoeWatkins will fix the opcache bugs when back home in an hour
 
cool
 
Wes
10:55 AM
morngnggng
 
ThW
@user3454479 The full message should contain the file:line that triggers it
 
@Wes /o
 
@JoeWatkins pong
 
@JoeWatkins pushed … let's see if it's now all fixed :-)
 
11:17 AM
@NikiC would you object to my rfc'ing that transformers patch ?
also, can you see anything wrong with it ?
@bwoebi cool
 
@JoeWatkins The patch itself shall go directly into 7.1 via simple PR I think
let Dmitry and Nikita look at it once and then you can merge it right ahead I think.
 
@JoeWatkins I would use a different approach
 
what would be different ?
 
expand the existing ast hook into something stacked + provide something for traversing the ast (we might even have that, not quite sure)
that is, don't fire transformations mid-compile
and don't limit people to statements. and don't require a new handler for every single kind that needs to be handled
 
not limited to statements
 
11:24 AM
Just provide the generic hook point and convenience apis for people to do the iteration as needed
Ah yes, we already have zend_ast_apply. It needs to be extended to handle declarations, but the traversation mechanism is already there
 
I wonder if that trojan sent to internals is someone trying to deliberately get commit access :x
 
@NikiC can you do something better ?
I'm not sure what you're saying is better ... I don't like one hook for everything, and single points of entry ...
messy ...
what if I just fired them at a different time ?
don't make me put everything in one function, that sucks when things get complicated
 
@PeeHaa thanks again for helping push the post to the top
is this how you got started too ?
 
they could be fired on creation, right ?
 
@VicSeedoubleyew np
 
11:32 AM
git.php.net/… … damn, that was my fault :x
 
@VicSeedoubleyew I started out with crappy vb questions :P
At some point I found this room and I've been stuck in here ever since :(
 
@bwoebi The patch does cover ($f='func_get_args')()
 
@NikiC if what you are doing can use one hook, we already have that ability ... it's kinda the point that when you have many different transformations, the engine invokes them for you, rather than you having to recv every zend_ast* and inspect it's kind .. which is what you have to do with a single point of entry ...
 
@NikiC shouldn't be prohibited IMO.
Like Dmitry wrote:
> but the following code is still legal and should provide consistent result


function foo() {

$f = 'func_num_args';

var_dump($f());

}
 
@bwoebi From a user perspective, $f() and call_user_func($f) is the same thing. If we forbid the latter, we should also forbid the former
 
11:35 AM
@JoeWatkins what would you want? register that you're interested in a specific type of AST node and have a callback invoked as the tree is walked? (maybe I'm misreading)
 
@NikiC good point
 
@bwoebi Also, please don't forget the getClosure() fiasco, where we went for the "minimal" set of things we can forbid and that turned out to be a bad choice (and we fixed it completely now)
 
@Leigh something more like this
 
> Also, I'd eventually move the dynamic call check to the zend_is_callable_ex fetch? [set a flag in arginfo or similar? … We anyway have 4 byte of padding (64 bit at least) left in that structure...]
That way you can get the warning immediately instead of in a delayed way. With the patch here, you only get the failure message when the callback actually happens. [Also not slowing down these functions.]
 
If there is no strong reason to carve out an exception for $f(), I wouldn't do it
 
11:36 AM
^ that point still holds though
 
@bwoebi What about parse_str() though? It is only problematic if the second argument (destination array) is not used
 
@Leigh github.com/krakjoe/transformer this is much nicer than trying to work with opcode directly ...
 
@NikiC If you pass parse_str directly as callback, you do it wrong, though
 
@JoeWatkins It also means that all your transformers run in parallel
That can be fine and can be desirable, but it may also cause horrible interferences
 
so long as documented, I think that's useful actually
 
11:38 AM
@JoeWatkins It's useful sometimes, but doing it this way forces it on everyone, there is no escaping it
 
but it doesn't because a global ast hook does exist
 
@NikiC if you want parse_str as callback, use function($a, &$b) { parse_str($a, $b); } … seriously.
 
@bwoebi That's ... true as well ^^
 
@NikiC good that we agree
 
@JoeWatkins think I get it, similar to what I said but performing the transforms during compile rather than walking the tree post-compile
 
11:40 AM
@bwoebi But I would find it pretty weird if is_callable('get_defined_vars') would return false. I mean it is kinda true, but ...
 
@NikiC if I just moved the invoke to zend_ast_create, would you be happy with that ?
 
@bwoebi Furthermore, for example func_get_args cannot be used in global scope. Should we handle that as a function flag as well?
Why would some errors be handled at the callability level and others not?
 
@NikiC uhm… that isn't caused by that here though
 
@bwoebi hm?
 
if (is_callable($f)) { return $f(); }
this is already a problem with current patch if $f == 'get_defined_vars'
 
11:42 AM
actually it would have to go all over zend_ast.c :s
 
@bwoebi There are so many, many, many different ways a function call can fail, I don't think we change anything about that situation
This is just one more error among many
(See the func_get_args in global scope example)
 
not quite all over, really ... it may not be so simple to make sure stuff doesn't get visited multiple times though ...
 
While that's true too… It's just more helpful to have it the other way if possible.
(afk for few mins)
 
@PeeHaa hahaha
 
@JoeWatkins why not just as a separate pass? Are you concerned about efficiency?
 
11:52 AM
I'm open to that, point me at a thing ?
(that would be better, I think)
that's odd ... the line number changes when I moved the invoke ..
 
@JoeWatkins a zend_ast_apply before the compiler (we need to fix zend_ast_apply to handle decl nodes first ... but we should do that part anyway :D)
 
well a separate pass would be much slower actually ... I mean a lot slower ... right ?
also, it's not like you can read the next node anyway, even if it exists, right ?
 
ping @ScottArciszewski
 
I think I am a little bit concerned about the efficiency of that ... is there any reason I can ignore it ?
 

« first day (2019 days earlier)      last day (2947 days later) »