« first day (1495 days earlier)      last day (3453 days later) » 

10:00 PM
you don't know the business requirements behind it
you don't know where the input came from
 
"data-loss" is a very philosophical word.
 
it's not filtering
 
During various discussions on this topic it has been thrown around to justify various differing and contradictory behaviors.
 
True. We've had philosophical (well, not, but they're impractical) debates on this
 
and it's not sanitization
it's not replacing input filtering, no matter how much people will use it for that purpose
 
10:01 PM
Then remind me again, what are these supposed to be used for?
I'd be using them for input validation mainly.
 
@NikiC then you're doing something wrong
you use them for application level checks
 
@NikiC oh btw, I tried to debug this var_dump bug on DateTimezone objects... didn't get anywhere. Couldn't find anything different in the debugging.
 
not checking data that came in from outside of the application
 
@AndreaFaulds have you checked how several database drivers handle 10.0 when handed off to PHP-land?
 
if you want to do input validation, you know something about the expected format of the input
 
10:03 PM
Aside from input from a form, that's another kind of "input".
 
@LeviMorrison No database will provide 10.0 for an integer field. And if it's a float field, then use to_float.
 
@NikiC You missed my point, actually. It's pretty critical to know how 10.0 is represented if I want to use it as an integer.
 
@ircmaxell All the more reason not to accept float-strings for ints, IMO. How would you get such a value into a string to begin with (unless you have a serious bug somewhere)?
 
If it's a string (I would not be surprised, here) then knowing whether it does "10" or "10.0" is pretty important.
Forms are not the only source of input.
 
@ziGi The half-assed ORM I currently use allows me to just manipulate the properties. I don't care for accessor functions.
 
10:04 PM
@TheodoreBrown then go full strict typing, and never do a single cast
 
@Charles yeah, I am wondering about this, I am starting to get blurred on the concepts. What is the difference between an Entity and a DO?
 
@ircmaxell As much as possible, yes. Casts are necessary when pulling values from a database, in some cases.
 
@ziGi will answer in a bit, gotta run to a meeting
 
sure, thanks for the attention, good luck
 
10:06 PM
@ircmaxell Casts are still necessary when interfacing with input and DB values. And I think for that purpose not accepting float notations, hex, binary, whatever, is much more valuable.
 
@LeviMorrison Good question. I know Python renders float(10) as 10.0
Lemme see what SQLite does.
 
New issue, “opened 3 minutes ago”… Aaaah, the smell of fresh “won’t fix”.
4
 
SQLite renders 10 (the float) as 10.0 in its CLI. Not sure what it renders that as in PHP, though...
 
> So you’re doing the same thing twice, essentially, for no conceivable gain.
You avoided error handling. That's a HUGE gain.
 
@PeeHaa yeah, I'm a bit aggressive today :D
 
10:08 PM
@LeviMorrison Er, no, no you didn't. Please re-read my response.
 
Do you know how much time is spent dealing with error handling on large projects?
 
@Ocramius :-)
 
@AndreaFaulds Reread mine. You are saying that a function which only validates and doesn't convert will be followed with a conversion which does all that work again, for no gain.
 
@LeviMorrison Yes.
 
The gain is that by being separate you avoided error handling.
That is a huge gain.
 
10:09 PM
@LeviMorrison You can avoid it anyway.
If you want to:
if (try_int($foo) !== NULL) { // $foo is a valid int! }
 
@LeviMorrison I don't see what you avoid. you still need to check the return value. How is that not the very same kind of "error handling"?
 
The difference is that, with try_int as it is just now, it'll return a converted version. You can just discard it, though. You don't have to use it.
 
@NikiC Because it's a boolean check versus a multi-type or forced exception.
 
@LeviMorrison boolean check vs multi-type... what's the difference?
 
@AndreaFaulds I'm wondering that as well
 
10:11 PM
People screw up == vs === all the time
 
@LeviMorrison Which is why the manual has BIG RED WARNINGS telling you not to do that.
 
You've said you are pandering to make things easy, but multi-type returns set you up for mistakes.
 
@LeviMorrison Don't use try_int then. Use to_int. Can't go wrong ;)
Or, actually.
if (is_null(try_int($foo)))
People don't seem to use is_null much. Maybe they should use it more?
 
You still don't address in the RFC why filter is insufficient.
 
@AndreaFaulds Most people always use === so it doesn't matter
 
10:13 PM
It's pretty important and I did most of the work for you at one point by a link to 3v4l with some of the retarded cases.
 
@LeviMorrison Alright, lemme do so then.
 
@AndreaFaulds I'd be okay with just try_int renamed to_int and don't include other kinds.
If how error handling is done is important enough to warrant two functions I'm not sure why you don't see the value in not forcing a non-boolean.
Anyway, back to work.
 
@LeviMorrison Do you still have that 3v4l?
 
I don't have it bookmarked or anything, no. I know they changed how search works, but maybe try searching for 3v4l.org from me?
But... I do a lot of 3v4l
 
@LeviMorrison:
Er
Aaaaargh, why can't I post my new paragraph, stupid length limits
> For int and float conversion specifically, ext/filter provides FILTER_VALIDATE_INT and FILTER_VALIDATE_FLOAT. filter_var($foo, FILTER_VALIDATE_INT) and filter_var($foo, FILTER_VALIDATE_FLOAT). However, these are rather unwieldy, encouraging people to use the shorter explicit casts, and suffer from a performance and safety standpoint by their converting values to strings before validating.
> Furthermore, their use requires explicit error handling by checking for a FALSE return value. If the programmer forgets to check it, they are no safer than explicit casts.
Thoughts?
 
10:32 PM
@JoeWatkins or @bwoebi could this bug be solved with UString? bugs.php.net/bug.php?id=68447
 
Adding that paragraph to RFC.
 
@FlorianMargaine no idea…
 
@ziGi So actually, I don't know if I can provide a dictionary definition to "entity" (in the context of a data layer) and a "data object" that would make the two seem like separate things. I plead ignorance.
 
@NikiC You really believe that?
 
@AndreaFaulds I don't necessarily believe the arguments but at least there's something.
I think the bit on casting to string first should get more prominence
Because of odd things like object::__toString
 
10:37 PM
@LeviMorrison It accepts __toString-ables? I'll note that.
 
Yeah.
Everything gets cast to a string before it even detects which filter you are doing.
 
Duly noted.
 
A fair number of its bug reports are because of this string casting behavior :/
 
@LeviMorrison tbh, sounds like a failure of ZPP more than anything else
 
I don't think ZPP is doing the casting in this case.
I'd have to look again; it's been a few months.
 
10:39 PM
Is it not?
Oh, indeed, $variable is mixed
What the hell
Also, I think it was you who liked 10-day votes, right?
 
Well, it's more like "end on a friday"
With "preferably two weekends"
I just think 7 days is too short.
 
I made it 10 days, which means it ends on a Friday and includes one weekend
better than nothing!
 
Thanks.
 
hmm
how do I get a non-seekable stream in PHP? O_o
 
I need to cut out some projects. I'm just involved in so many and want to start more all the time.
Or I need to get hired to do it ^^
 
10:42 PM
@Ocramius Why do you need one? o.O
 
(don't tell me sockets, I need this for a unit test)
 
yo :)
 
@AndreaFaulds just a test for this thing: github.com/wnowogrodzki/zf2/commit/…
 
Are there some music addicts here?
 
@Ocramius Make a UNIX sock. Or a localhost one. Or something.
@Ocramius Maybe about:blank or data: might be non-seekable?
 
user895378
10:45 PM
@Ocramius Define "non-seekable"
 
yeah, that's what I thought, but it has to run also on winowNs
 
(Though for the latter it'd be pretty weird)
 
@rdlowrey see that commit
 
(And not sure if the former exists)
 
user895378
Like, what sort of behavior do you need?
 
10:45 PM
Maybe something on php://?
 
@Duikboot Music is good. Addict? I don't know what that entails, but I've never gotten itchy for a lack.
 
@rdlowrey See Ocram's unitest
 
@rdlowrey just creating a resource that I cannot rewind($resource)
 
HAH
I should make a unit-testing library
called UniTest
:p
 
user895378
@Ocramius can't you just create your own stream wrapper that doesn't do anything if you call rewind()
 
10:46 PM
away, eat
 
user895378
And use that for your test?
 
nice idea
 
I hate the amount of work behind it, but I can do that
 
user895378
It's kind of a lot of work just to test that, but it's the only way I know of (without firing up a whole socket thing).
 
10:46 PM
Is there a stack overflow site about music? And then more about the history of artists? ( Ok I can randomly google freddie mrcury and check what he has done in his life but I really would like to know more about the style and the impact of music in history like in the 60s etc. ( im to young to know that all )
 
yup
 
user895378
/me doesn't love the stream wrapper API.
 
Yes, but I already pointed out it was mixed ^^
@LeviMorrison Wait... what
That... doesn't handle __toString correctly
-.-
 
@rdlowrey hmm?
 
@Charles Ah pitty, I though that Entities are just plain objects holding data while Domain Objects have Business Logic and are composed of Entities
 
10:48 PM
(You're supposed to allow a cast handler too, not just __toString)
anyway /me actually away eat
 
It also doesn't handle NULL_ON_ERROR (or whatever the exact name of that flag is)
 
user895378
@bwoebi I just meant with regard to this:
 
user895378
2 mins ago, by rdlowrey
@Ocramius can't you just create your own stream wrapper that doesn't do anything if you call rewind()
 
@rdlowrey I think NOBODY likes streams at all
 
user895378
Yeah, I'm not the only one.
 
10:49 PM
(Although I swear I had a patch for it that got committed)
 
@bwoebi Sorry, wrong qualifier
Only referring to professionals there ;)
 
@NikiC At least I like using == "" for comparing against 0, null, false and empty string. Useful for e.g. fread(). (but not against "0")
 
@ziGi Oh, domain objects, not data objects? Yes, that definition isn't too far off from my understanding. I personally avoid the use of the term "domain" because some people can find it confusing.
 
@Charles still, what do you think of the explanation I gave about the business logic?
 
Domain Objects have business logic and interact with entities, not are composed of
 
user895378
10:58 PM
I do this quite often:
 
user895378
$data = @fread($socket, 8192);
if ($data != '') {
    // socket isn't dead
} else {
    // socket is dead
}
 
user895378
(re: using == and !=)
 
@rdlowrey yep, that's what I meant.
 
user895378
Also, I just encountered another situation where I actually need references.
 
@rdlowrey interesting, can't find a way to override how stream_get_meta_data() returned values work O_o
 
user895378
11:03 PM
@Ocramius try this link. I gave you a bad one before. Should be able to use function stream_metadata($path, $option, $var);
 
user895378
@Ocramius lol, look who asked that question.
 
yeah :-)
 
user895378
Time is a flat circle.
 
G'night.
 
11:06 PM
@bwoebi sure, there's always a few exceptions to the rule ;)
 
user895378
@ChrisBaker later dude
 
Just picked up "Richard Stevens - Unix Network Programming", hoping it can help me get a better grasp on sockets and network programming. If anyone has any good resources (preferly C), it would be appreciated.
 
11:35 PM
@TheodoreBrown :)
 
@AndreaFaulds Wiki is not loading for me; can you link me to your implementation?
For safe casts?
 
Looks like the static server might be down again :/
Specifically, shared.php.net. When it goes down, the wiki won't load because of shared CSS, until the connection times out.
@LeviMorrison If you want to read the wiki, I suggest using lynx (serious)
Oh man
 
Well, depending on how long its down you may want to extend RFC vote even longer.
^^
 
It formats quite beautifully in lynx
I should use text-mode browsers more :D
 
How does php.net/strpos look in lynx?
 
11:43 PM
The main body looks great.
But.
#                                               PHP: strpos - Manual (p1 of 76)
   #Add PHP.net search PHP Release feed PHP: Hypertext Preprocessor
   alternate contents index prev next alternate alternate alternate
   alternate alternate alternate alternate alternate alternate alternate
   alternate

   php
   [ ]
     * Downloads
     * Documentation
     * Get Involved
     * Help

   ____________________

   PHP 5.4.35 Released

   Getting Started
          Introduction
          A simple tutorial
   Language Reference
          Basic syntax
          Types
          Variables
          Constants
          Expressions
          Operators
          Control Structures
          Functions
          Classes and Objects
          Namespaces
          Exceptions
          Generators
          References Explained
          Predefined Variables
          Predefined Exceptions
          Predefined Interfaces and Classes
          Context options and parameters
          Supported Protocols and Wrappers
   Security
          Introduction
          General considerations
          Installed as CGI binary
          Installed as an Apache module
          Filesystem Security
          Database Security
          Error Reporting
          Using Register Globals
          User Submitted Data
          Magic Quotes
          Hiding PHP
          Keeping Current

   Features
          HTTP authentication with PHP
          Cookies
          Sessions
          Dealing with XForms
          Handling file uploads
...you get the idea.
The content comes after the manual's ToC
By contrast, the wiki has the ToC at the end
 
Hmm.
It comes after it in the source.
 
The content itself, though? Looks stunning.
 
I wonder why lynx is putting it before?
 
Perhaps Lynx does not quite ignore CSS.
 
...
Oh, it's not the sidebar.
It's that stupid ? hotkey contents.
 
11:45 PM
Ah.
Oh god wow
I just tried ?
That's... that's dumb.
Couldn't that just load an iframe or something?
There's also a list of keyboard shortcuts, which is also annoying in a browser where JS isn't enabled.
Perhaps you could hide it in the source somehow. Like in a <script> tag.
 
It's JS + CSS enabled anyway; may as well put it at the bottom.
(like, very bottom)
 
... at first I thought that you took up my "late night video" recommendation
 
gs seems to be broken.
 

« first day (1495 days earlier)      last day (3453 days later) »