« first day (1435 days earlier)      last day (3513 days later) » 

12:00 PM
E_LOTS_AND_LOTS_OF_ERRORS_COMBO
 
hi
i have a question about PHP output controller functions
 
I have no idea what that sentence means, but shoot :)
 
is it always safe to use them
the Ob_start() ect..
and buffering functions of php
 
ah buffering you mean?
 
12:02 PM
yes
is it always safe to use them ?
 
Well with questions like "is it safe to use X" the counter question always is: "safe against what?"
 
does all the framworks use them when referring their view files
??
 
I don't think all of them do. There are other ways of doing it
 
for including the view file processing variables and stuff and then render
 
But the question still stands: safe against what?
 
12:05 PM
well , each function has a good and a bad practice
 
@Rizerzero example?
 
you can say that Mysql_query is not safe
if you dont escape inputes
inputs
 
Now you can not. mysql_query can be perfectly safe
 
you mean PDO prepared statement are safe
 
No that's not what I meant
prepared statements can also be less safe
It's all about how you use it
 
12:07 PM
yes
so i have never used buffering and i wanted to know the risks ;)
the right and wrong way of using them
 
use them, try them
 
imho one of the risks is it eating warnings
 
yes but it's a production project so
 
ask after you understand them, then decide best
 
@Rizerzero So? You are not developing on a production machine right? Right?
 
12:08 PM
no but
i don't want to lose time
 
remember: nothing is 100% safe or 100% secure, ever, never ever
 
do the thing and figure out that it's not the right way
and find an other workaround
 
@Rizerzero Well at least you would learn something in the process. It's not like it would be a waste of time
 
@Rizerzero what are you trying to do? show some context
 
@CS
sorry
, yes it's never a waste of time
 
12:10 PM
@C<tab> :)
 
thanks
i'm not used to chat here
@CSᵠ: works fine
no yet ;)
 
You've run across a random PHP function you've never used before and want to throw it into a project that's in production? For what?
 
so @Rizerzero why are you in need of ob_* ?
 
@derp FDD!
 
well this is the first time
 
12:12 PM
Faith Driven Development FTW!
 
FDD may refer to: Feature Driven Development, a project management approach Feith Document Database, the original branding of Feith Systems' BridgeLogiQ flagship product Floppy disk drive Focus-to-detector distance, a distance between the focus of an x-ray tube and detector in dosimetry Forces for the Defense of Democracy (National Council for the Defense of Democracy), a rebel group in Burundi Former District Deputy, when used after the name of a member of the Knights of Columbus Foundation for Defense of Democracies, a policy institute based in Washington, D.C. Franchise Disclosure Document ...
 
to be fair , it's an old framework that is not totally mvc , and i want to enhance that , so that i can improve the code and speed of development
 
@CSᵠ They got it all wrong ;)
@Rizerzero First thing first. Forget about the misused term MVC
 
??
@pee
oups
 
It happens a lot ;)
 
12:14 PM
MVC was a hype aaand.. it's gone
 
@PeeHaa> what do you mean about mvc
 
The MVC label is useless and in the php world almost never makes sense
 
MVC wasn't even used faithfully in Smalltalk.
 
separation of concerns is what you are looking for
 
do you use a framewok in you pro projects ?
 
12:15 PM
I've built my own library instead
 
yeah, SoC is the best, new 2014 thing
 
@PeeHaa i built my own also
@PeeHaa but it's not that easy , not that great , but it is just a perfect answer to the expectations of my clients
 
@Rizerzero In the end that's kinda what it needs to do :)
 
it's not great , but it has the advantage to work withe bundles ,
 
As in symfony bundles thingies?
 
12:18 PM
sort of
but not that great , symfony is awesome
but heavy at the same time
 
Yeah it's pretty heavy from what I have seen
 
specially for small shred hosting project
and when you build it you learn so much ;)
 
@Rizerzero I never do stuff that needs to be deployed on shared servers (thank god)
 
KiSS SoC OOP
 
@PeeHaa you're lucky
i dont want to use the buffering , because i may be disabled on some shared hosting
compaines
 
12:23 PM
@Rizerzero I don't think that will be an issue
Not 100% sure though
 
so for the moment i need i templating engine , maybe twig , and enable the rendering of the views
 
PHP is a templating engine
 
@derp right
maybe i'll think of using the symfony http and routing components
okay , thakyou for your answers guys , i have to go back to work
i have so much to code ;)
have fun !!
 
@Rizerzero good luck. later!
 
@PeeHaa thanks
 
12:33 PM
Can excel connect to phpmyadmin?
 
"connect" how? emotionally?
5
 
:D
I need a name for a library that lets you log in to services through php (without using the correct apis)
 
read data from
 
@PeeHaa "Brittle"
 
12:41 PM
That just about covers it. Thanks!
 
@derp lol
 
hey @JoeWatkins!
How are you today sir?
 
morning
done lots of sleeping, I'm good :)
yourself ?
 
@PeeHaa magical-blindfolded-login , or any combo of blind+login[+magic]
 
Extremely bad case of a cold, but drinking whiskey now so hoping it will be gone soon :)
 
12:43 PM
whiskey should cure it ...
 
@CSᵠ BlindMagicLogin ?
 
@PeeHaa could work
what kind of apis does it sign you in?
 
@CSᵠ I'm thinking about stuff like twitter, fb and stuff like that
 
@JoeWatkins if it doesn't vodka will, or an old scotch or brandy, hehe
@PeeHaa userbase?
 
@CSᵠ The world
 
12:48 PM
SocialConnect+
 
That's also pretty nice. Let me set up a poll
 
@PeeHaa aka. average Webmaster that knows what an API is? or avg. Joe?
 
@CSᵠ php developer (so the bar is pretty damn low :P)
 
roflmao
social connect then... needs some viral hype bling
 
@PeeHee what does "without using the correct apis" mean?
 
12:50 PM
@PeeHaa In that case just have a single function that returns a lollipop and sends the caller outside to play.
 
lol
"YOLO: You Only Login Once"
 
Good morning slackers (:
 
@salathe prolly login($user, $pwd, $url="")
 
@salathe Logging in using the actual loginform on the site instead of using the oauth api
@AlmaDo Morning
 
12:54 PM
what would be yollo pukkale then?
 
@PeeHaa Is this a hidden ploy to steal peoples' passwords? :P
 
@salathe No it isn't, but it can be used for that
 
@PeeHaa JabbaScript?
 
brb fooooodz. When I get back I expect an answer on my naming issue!
 
1:18 PM
@PeeHaa Naming a project with a derogatory name is just not a good idea imo. The opposite word, malleable, would be far more appropriate.
Though also the word mallet (with the same latin root) might be easier for non-english people to pronounce / understand.
 
mrongin
 
;)
 
@PeeHaa was that a serious question ?
 
@PeeHaa when you're back please un-pin my RFC (that's the wrong URL now anyway - and I don't need feedback anymore - it's gone to the list)
 
1:35 PM
@PeeHaa YOLO
 
for clarity the yolo entry should have "You" changed to "You'll"
 
fyi @rdlowrey I'm attempting to fix that callable bug. I think it's time to rip the Executable generation out of the provider/injector class. Not only to make the code sane, but also because the Executable stuff would be useful by itself.
 
@tereško totally
@Leigh done
 
cheers
 
1:42 PM
@DanLugg nice
 
Yea, they're a good band. Their sitar is just completely classic psychedelic though :-P
 
@PeeHaa how's "Janus" for the name?
In ancient Roman religion and myth, Janus (/ˈdʒeɪnəs/; Latin: Ianus, pronounced [ˈjaː.nus]) is the god of beginnings and transitions, and thereby of gates, doors, doorways, passages and endings. He is usually depicted as having two faces, since he looks to the future and to the past. The Romans named the month of January (Ianuarius) in his honor. Janus presided over the beginning and ending of conflict, and hence war and peace. The doors of his temple were open in time of war, and closed to mark the peace. As a god of transitions, he had functions pertaining to birth and to journeys and exchange...
 
Janus: The Roman god of why the crap is my facebook login no longer working
 
he was alos associated with Chaos (thought not int he same sense as roman Pan), IIRC
seems fitting
 
In Norse mythology, Loki, Loptr, or Hveðrungr is a god or jötunn (or both). Loki is the son of Fárbauti and Laufey, and the brother of Helblindi and Býleistr. By the jötunn Angrboða, Loki is the father of Hel, the wolf Fenrir, and the world serpent Jörmungandr. By his wife Sigyn, Loki is the father of Narfi and/or Nari. By the stallion Svaðilfari, Loki is the mother—giving birth in the form of a mare—to the eight-legged horse Sleipnir. In addition, Loki is referred to as the father of Váli in the Prose Edda. Loki's relation with the gods varies by source. Loki sometimes assists the gods and sometimes...
Y'know, the "everything is an object" paradigm would be helpful in the context of using spl_object_hash -- especially when dealing with callbacks.
 
2:00 PM
@DanLugg in what sense?
 
> eight-legged horse
the word is spider ...
 
lol
 
@Leigh Being able to $this->handlers[object_hash($callable)] = $callable;
 
arghhhhh arghhhh
 
@JoeWatkins No no no, it's "octo-horse"
 
2:01 PM
why did I think closures were objects anyway...
 
they are
 
@Leigh I know, right? Just like [$o, 'm'] is an object too! </sarcasm>
 
that's what I thought...
 
[] is callable, not closure
ok good
 
;-)
 
2:02 PM
Dan confused me with "would be helpful"
I was like.. why isn't it already helpful!
 
Yea, I could type-hint Closure, but then that narrows the usability.
 
isn't spl_object_hash pointless ?
 
Not at all (in my experience)
 
I'm sure someone said that it doesn't actually work as you think it will ...
 
Hi everyone, I'm having a strange problem using header(location:...php)
Can anyone help me?
 
2:03 PM
@JamesSmith have you tried header('Location: php'); ? - also make sure you terminate the script after sending a redirect, you might get unexpected results if you let it continue generating output.
 
@JoeWatkins No, it pretty much does; don't quote, but I'm pretty sure it kicks back an "id" associated with the object on the heap.
Mind you, they can be reused.
spl_object_hash(new stdClass());
spl_object_hash(new stdClass()); // will probably be the same as above
 
because unused object is unused
 
it would make more sense to return address of zend_object, lxr.php.net/xref/PHP_5_6/ext/spl/php_spl.c#785 is horrible ...
 
@JoeWatkins Translate for non-internals, what's that actually pulling?
object handle pointer, and hashtable pointer?
 
I did. I'm just a beginner in PHP. What I'm trying to do is to remove the post made by the user. My code for header is:
header("Location:profile.php")

The strange problem is that if I remove the latest post, I will not get the header error, if I remove the older post then I will get the header error.
 
2:06 PM
"handlers" is like a table of functions to be used under certain events (creation, destruction, operators (like GMP overrides))
 
Hmm. I really need to train my internals-fu.
 
@rdlowrey the artax api now should be pretty stable right or do you have some last minute changes pending?
 
@JamesSmith what is the error message
 
the address allocated by create_object handler if internal class, and by zend if not ... it cannot be reused, as far as I know ...
we'll test ...
gimme something that would definitely barf using spl object hash ...
 
The error is:

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\Project\socialbook\profile.php:304) in C:\wamp\www\Project\socialbook\profile.php on line 286
 
2:09 PM
your PHP storm has expired and will now shutdown...
 
@JamesSmith headers have to be sent before you start writing content
 
@JamesSmith that's caused because headers have to be sent before content. You've generated some output before calling header()
 
Dan Lugg (Cleric-Bullshitter)
    HP              203 / 203
    MP               81 / 81
    Exp           38293 / 823      until next level
    Internals Exp     0 / 82399873 until next level
@JoeWatkins I haven't a clue. Define "barf"?
 
give unexpected results
 
Nice to know Dan, I often need elemental wards...
 
2:12 PM
I did that already but no luck or maybe I'm doing it wrong. How can I fix that?

My code is:

if (htmlspecialchars(isset($_POST['remove'.$postid]))){
header("Location:profile.php");
$user->postId = $postid;
$postRemoved = $user->removePost();
}
 
ok, that's a little but nuts :P
 
@JoeWatkins TBH, I don't know what would constitute unexpected results; I know that dumping the hash of an object that's immediately GC'd puts you in a spot where the hash is likely to be reused.
 
you can't use isset like that @JamesSmith
 
@JamesSmith that tells us nothing
 
well you can, but it's not going to do what you expect
 
2:13 PM
var_dump(spl_object_hash(new stdClass()), spl_object_hash(new stdClass()))
 
oh .. yeah, and isset() returns boolean, but htmlspecialchars() returns and expects a string
 
hm, does (string)false convert to '0' or '', can't remember
might be emitting a warning
 
@Leigh ''
 
if I don't use isset then I'll get undefined index error
 
string(32) "00000000395dd05e000000007b389bbf"
string(32) "00000000395dd05e000000007b389bbf"
string(14) "0x7fdc013538b0"
string(14) "0x7fdc01353930"
the problem is that it doesn't identify an object, but it's slot in the object store, it's the object store slot that can be reused, it makes more sense to use the physical address of the object which cannot be reused ... pad it out a little if 32 chars is preferable ...
<?php
var_dump(spl_object_hash(new stdClass()));
var_dump(spl_object_hash(new stdClass()));
var_dump(ohash(new stdClass()));
var_dump(ohash(new stdClass()));
?>
 
2:17 PM
could it be reused if you forced gc?
 
don't think so
yes
var_dump(ohash($o = new stdClass()));
unset($o);
gc_collect_cycles();
only in lab conditions though I think, when would you do that in the real world ?
 
long running process perhaps
 
is ohash exposed to userland in a standard install?
 
everyone uses php for websocket servers right :D
 
I just wrote it
 
2:19 PM
Hmm, seems the answer is "no" ;-)
 
it would have to be a long running process with one object, with exactly those instructions in exactly that order ...
 
Whether spl_object_hash (which should really lose the spl_ prefix anyway) is fundamentally flawed or not, it'd be damn fucking helpful if we had a var_hash which, if applied to anything would yield something. Byrefs could operate on the reference id/pointer/something, objects could do similarly, scalars could operate on value, arrays could be a XOR of the contents or (that was dumb) something.
 
we can do that too
address of value union
oh arrays would be a shit ... it would be costly to do arrays whatever you done ....
 
Sure, but that's the way the cookie crumbles.
The idea of kiboshing something because of potential for non-performance is weird to me; if you do something slow, you're going to be punished.
 
@DanLugg are you using it to de-duplicate?
 
2:24 PM
Various things; keying objects in an assoc too (I don't like the built-in)
 
$a = "string";
$b = &$a;

var_dump(ohash($a), ohash($b));
string(14) "0x7f5f27d50830"
string(14) "0x7f5f27d50830"
$a = "string";
$b = &$a;

function whatever($w) {
    var_dump(ohash($w));
}

var_dump(ohash($a), ohash($b), whatever($b));
string(14) "0x7f71d18a3d90"
string(14) "0x7f71d18a3d90"
string(14) "0x7f71d18a3d90"
that could work ...
 
That very much could work.
Is that because strings are interned?
 
no, it's because of how references work
 
Oh, okay; what is your ohash working from then?
 
$a = str_pad("sl", 14, "1as");
var_dump($a);
$b = &$a;

function whatever(&$w) {
    return ohash($w);
}

var_dump(ohash($a), ohash($b), whatever($b));
string(14) "sl1as1as1as1as"
string(14) "0x7f3a01a2a7c8"
string(14) "0x7f3a01a2a7c8"
string(14) "0x7f3a01a2a7c8"
 
2:31 PM
$a = 'foo';
$b = 'bar';
$c = 'foo';
var_dump(ohash($a), ohash($b), ohash($c));
 
string(14) "0x7fefcb75d8b0"
string(14) "0x7fefcb75d830"
string(14) "0x7fefcb760468"
<?php
$a = [1, 2, 3];
var_dump($a);
$b = &$a;

function whatever(&$w) {
    return ohash($w);
}

var_dump(ohash($a), ohash($b), whatever($b));
?>
 
I don't think those would be expected results given the inputs though.
 
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}
string(14) "0x7f608389a130"
string(14) "0x7f608389a130"
string(14) "0x7f608389a130"
 
So is it operating purely on reference to generate the hash?
 
yes
don't need to pass by ref to whatever() there, scrap code ...
 
2:37 PM
What is the widest scalar in PHP? float?
 
if you want to play around ...
addressof would be more appropriate name maybe ...
 
Aargh, I still need more votes on Integer Semantics RFC. Speaking of which...
bugs.php.net/bug.php?id=68064 - this bug demonstrates why we need it
 
@JoeWatkins I torched my nix VM, I'll have to setup
 
> bitwise shit
how do you do that ?
 
hahaha
@krakjoe could you help me out here by voting? ;)
 
2:40 PM
@DanLugg I don't think one can consider that to be a notable event
 
@AndreaFaulds when does voting close?
 
@AndreaFaulds Please, please… people… vote! No. :P
 
@Leigh Tomorrow. That's why I need votes rather urgently.
 
probably wont get my VCS account approved by then :p
 
@AndreaFaulds I'm not happy with the implementation, shifting fine but casting is "silly", your words ...
 
2:41 PM
I usually have something like 4 VMs and at least one of them usually in a state of "animated dead"
 
@JoeWatkins There's no sane thing we can do for an INF cast except throw an error. However, this RFC is not going to touch that.
 
If the RFC was only for the shifting changes… there'd be a very different result, I suspect.
(I'm not suggesting anything be done, at this stage)
 
@JoeWatkins did you see weltlings msg on irc?
 
I really don't get what's so bad about defining the behaviour of integer casts
I'm not saying you should rely on it being zero, I just want us to do one thing consistently
It has to be defined to something
 
@AndreaFaulds But your RFC effectively does say we can rely on it being zero, that's the point of the change.
 
2:45 PM
@salathe Not at all
Just because a behaviour is defined doesn't mean you should rely on it
It simply means it'll do the same thing across platforms
 
@AndreaFaulds I'd rather it be officially "undefined"
Why bother making it consistent if you can't rely on the value?
 
Avoids undefined behaviour in C
 
"Just because a behaviour is defined doesn't mean you should rely on it" wat.
 
@Danack (int)"abc" will always produce zero, but you really shouldn't rely on that
You should validate your values
 
except that is pretty much defined behaviour..
 
2:50 PM
Explicit casts do not do any validation
Yes, it's defined. Doesn't mean you should use it.
 
@AndreaFaulds Why not?
 
I use it because it's defined
$value = isset($_POST['value']) ? (int)$_POST['value'] : 0; // I know value should be 1+, so lets treat 0 as a validation failure outright before performing more validation
 
@Danack Because using explicit casts without validating your input is a bad idea
Unless you don't care what you get back
 
LOL, so let's remove all casting?
 
@salathe No?
 
2:55 PM
@AndreaFaulds They're completely separate things. I validate at the top level where the validation has meaning, but at the lowlevel when I'm about to store some data in an integer field in a DB then yeah I do cast to force values to be of the correct type, so to avoid a DB error.
 
Why not?
 
To be honest, I can't think of a good argument against removing explicit casts
 
Or calling any external api that has to have a certain type.
 
Casts which are completely unsafe are not a good idea
 
@AndreaFaulds comparison...
 
2:56 PM
@Danack actually, if you're using MySQL, just put everything in quotes and let the DB work it out, it knows the field types and will convert accordingly.
 
get an valid id as a string, get another valid id as integer, how do you compare them? Using ==?
 
@Leigh "123noodles"
 
@Leigh I don't like that - I prefer to have MySQL give errors on data truncation, as it catches errors in programs, rather than silently losing data.
 
@Leigh Try that with Postgres :P
 
@salathe well of course, real DB engines have standards :p
 
2:58 PM
I'm a major advocate of the "lossy casting is fatal" school of thought.
 
@Leigh For example trying to store too long a string in a varchar(16)....having it truncate silently is bad.
 
@DanLugg Ditto
Anyhow
 
Even with float -> int.
 
The reason this RFC makes INF and NAN cast to zero is so that I don't have to have this bikeshed when it comes to bigints
 
It shouldn't be treated as an implicit floor. Use floor. floor. FLOOOOOOR.
 
2:59 PM
Because inevitably the same argument will come up when I finally put that RFC under discussion
If it bothers you, I could make them cast to rand()
 
casting INF or NAN to int should be fatal tbh
 
@Leigh Sure, but that's beyond the scope of this RFC
 
?
 
oh, and /0 should be non-fatal, but return INF ;)
 

« first day (1435 days earlier)      last day (3513 days later) »