« first day (1643 days earlier)      last day (3531 days later) » 

13:04
For the asked question it's a perfectly valid and a safe answer. Whoever complains it's not safe - how about a deal that I set up this particular code with the $galleries as provided in the question and you exploit it using aforementioned "sql injection vulnerability". If you cannot - you pay me USD200. How about that? — zerkms 15 hours ago
@zerkms You know not only OP reads that right? And OP will use the same technique for dynamic parameters
@ircmaxell <jeopardy>What is aspergers syndrome?</jeopardy>
@SergeyTelshevsky Be aware that there is no session component included. I keep trying to get people to write one but no one wants to :P
I want to call that out for the BS it contains, but I also don't want to bother...
13:21
Hello, do you know some implementation of "good" di integration for symfony?
What I mean?
I want create some relationship like interface -> implementation and use it in __construct parameters without binding (implementation like in Magento 2).
But if I want get some implementation/class I get it also without bindings, for example:
public function __construct(RequestInterface $request, CollectionFactory $collectionFactory) {...}
user895378
@Ocramius Hey. Read your question on twitter this morning. What does your technology stack currently look like?
@Martin Then you should.
@AntonOgorodnyk This is a good implementation of DI. It may be difficult to integrate it with Symfony, as Symfony doesn't really support actual DI (as opposed to a service locator).
You'd probably need to replace the routing and dispatching bit of symfony to use it......which isn't the worst idea in the world tbh.
Jimbo did something with Auryn and Silex
@Danack
@Danack Do you know some good framework based on interfaces and with DI?
13:30
"Framework based on interfaces" wow
Vanilla PHP is pretty good with interfaces and DI
@AntonOgorodnyk Using DI kind of gets rid of the need for a framework...this is as close as it's going to get, but you could just start with github.com/nikic/FastRoute as the routing thing.
@Patrick Thanks
@HamZa Thanks to your bounty on this I've gotten +24 upvotes. Thank you for the attention!
@Danack Yeah that's what I did with silex-auth-skeleton, that I'm remaking into Aurex now ;-) and will shortly be done
13:32
@Patrick If someone hasn't stepped forward by next week, I have a session library that I need to rewrite finish off.
@Danack awesome. If you need some help let me know. I just can't find the time to start from scratch :)
@Danack Fuck yeah. throws money at screen
@LeviMorrison heck people are still upvoting the first answer
@marcio Yes, but the gap did shrink a bit.
@LeviMorrison E_ENGRISH :-)
ow wait. nope
13:36
o.O
E_PEBKAC :D
this will take a while :D
hehehe that was stupid. MIssed the word did
Sorry @LeviMorrison <3
I'll see if I can find time to properly refactor my http package into smaller classes. Then with a decent session package I would finally not have to use httpfoundation anymore \o/
13:37
Good morning
When trying to install PHP in CI, I have this:
@marcio It's a somewhat popular question, so hopefully it's making an impact even at #2.
A new version of configuration file /etc/php5/cli/php.ini is available,   ││ but the version installed currently has been locally modified.││││ What do you want to do about modified configuration file php.ini?││││install the package maintainer's version││keep the local version currently installed         ││show the differences between the versions││show a side-by-side difference between the versions││start a new shell to examine the situation││││││<Ok>
the question is - how to force overwriting the config?
--force // random guess
> install the package maintainer's version
it is happening in container and there is no "user" who can "press" a "button"
13:39
oh lol
@AlmaDo RedHat or Debian?
so far I tried sudo apt-get -o Dpkg::Options::="--force-confnew" -o Dpkg::Options::="--force-overwrite" install -y <package>
@Machavity ubuntu (so, debian)
dpkg force options didn't help. Is it some kind of weird re-invoked php-related window?
@AlmaDo If there's absolutely no way to tell it to overwrite it, you can do horrible things with expect
e.g. somehow invoked by child process and not related to dpkg?
13:41
@Danack crap...
thanks.
@bwoebi Thanks for the RFC: Basic Scalar Types, is the right solution for #PHP. We hope to prosper. The "declare strict" is a horror! :(
@AlmaDo but try the -y just after apt-get instead of the end?
hmmm.
@marcio But the asked question is not going to be exactly the same as the thousands of people who frequent the question and copy/paste.
So yeah, I don't care :) /cc @zerkms
@bwoebi someone is late to the party...
13:43
@Danack yes
@NikiC I'm not sure if he thanks me for having brought it up at all or if he's just late.
There are also several questions closed as duplicates of this one, and they are not all guaranteed to be free from attacks either. This is why I bothered to answer at all.
didn't help
user895378
phonebook incoming ...
user895378
@Ocramius The easiest thing to do is to setup round-robin DNS. That way new connections will distributed more or less evenly to the different websocket server boxes and you aren't holding open 65k connections in your proxy at the same time.
13:44
"--force-yes " also?
user895378
@Ocramius Another approach would be ... you could make your canonical websocket endpoint URI something like ocramius.com/chat. Because the websocket handshake follows HTTP/1.1 protocol any redirects should be followed by the connecting client. This allows you to 3xx redirect from ocramius.com/chat to ws1.ocramius.com/chat, ws2.ocramius.com/chat, etc.
user895378
Because the redirect URIs use a different host name from the canonical URI clients will open a new TCP connection and accomplish the load-balancing you're looking for.
user895378
@Ocramius That said, the websocket protocol doesn't mandate that clients follow the redirect (though it would be silly for them not to):
user895378
> If the status code received from the server is not 101, the
> client handles the response per HTTP [RFC2616] procedures. In
> particular, the client might perform authentication if it
> receives a 401 status code; the server might redirect the client
> using a 3xx status code (but clients are not required to follow
> them), etc. Otherwise, proceed as follows.
user895378
13:45
@Ocramius Basically, you just want to avoid a situation where you have a load-balancing proxy that maintains all 65k connections at the same time and proxies websocket communications to and from backend boxes. The persistent connections is what you want to spread around. You don't want them all open on a single load balancer at once.
@Danack I will go with sudo rm -Rf /etc/php5 :p
@rdlowrey what are you replying to?
user895378
@Ocramius I would expect a good backend websocket solution to handle ~10k websocket clients concurrently depending on how CPU-bound the websocket app is. You just need to make sure you have enough websocket worker boxes to handle the expected peak concurrent load.
@LeviMorrison maybe the author of the answer could be convinced to drop it. But yeah, let it be.
user895378
@bwoebi this:
user895378
13:46
Specifically worried about websockets and > 64K connections - how to load balance? Handshake/UPGRADE to different machine?
@marcio There were multiple people asking for a change in the comments on the answer, which is why I wrote my own.
Author didn't seem to care.
@bwoebi this would be a hell of a BC break now ;)
@marcio Ah, yea… and? :-P
@bwoebi not really, but on the PHP game when you don't like something you use the BC break card :D
@marcio Just put it down and walk away...
13:49
VOTE NO TO ENUMS! IT BREAKS MY ENUM CLASS! -hopefully no-one
it breaks my enum class :( but I don't care because now I have f*king real enums :)
user895378
@LeviMorrison I don't know if I articulated this clearly the other day, but I do like your enum implementation.
@marcio Well… I usually play it in a combo with the common sense card, but even that doesn't seem to help…
user895378
I was just trying to raise as many questions as I could think up.
13:52
@bwoebi use the super-secret-JIT-compiler-project card it causes some damage.
I might try implementing Swift-like enums. It's more complex but would serve more use-cases.
@LeviMorrison in what way is this now a difference to your current RFC?
or do you mean with values?
Your RFC is actually a subset of what swift does…
@LeviMorrison But what swift does fine is not exposing the a getter for the constant name
Not 100% sure but I might be having a problem with the "Thread Safe Resource Manager" thing
@marcio TSRM usually shouldn't be any problem since PHP 7…
14:06
Anyone know if I can mark directories / files, in GIT, to be left alone and not under version control only after a user has checked out the files?
So I can commit a repo with some templates there, (not .example, I don't like that), but as soon as they modify those templates, they're not tracked in git and they don't try and push them
you can ad it to .gitignore and do a forced add when you need to modify the ignored file - see stackoverflow.com/questions/8006393/…
@bwoebi k, I might be doing something silly then
14:21
@marcio Thanks man, is that how frameworks tend to do it then? With a default setup folder ready for you to start working with but not commit back with?
Sounds like it might be easier to make the templates into a separate, read-only repo?
@Jimbo no, usually the config files are fully versioned. You probably just want to set a different write permission for these files depending on the environment?
@DaveRandom I think he wants something like "composer create-project my-pacakges/app-template"
@Jimbo I dunno what exactly you are doing but this might suit your needs better ^
Good morning again
@bwoebi Thanks for the RFC: Basic Scalar Types, is the right solution for #PHP. We hope to prosper. The "declare strict" is a horror! :(
@marcio I'm basically wrapping a micro insert-marketing-name framework with some useful stuff, and I'd like to provide that with a directory in which they can do their own work using the stuff in the framework directory, but ignore any changes in their work directory... so that when I update the framework parts (for when the micro-framework is updated), they can do an update with composer and it doesn't affect their own codebase
user895378
14:40
STH is the gift that keeps on giving.
user895378
@ircmaxell morning
@Jimbo That sounds like something that is solved by using the composer scripting to copy files into place.
@rdlowrey I'm so sick of monday morning quarterbacks
@Jimbo Ok, I got you right then. Just create your base-app repo with all the dependencies|boilerplate and use it as a private composer package on your network getcomposer.org/doc/articles/…. Then you will be able to use "composer create-project" with it.
user895378
@ircmaxell On the bright side, this will all go away once PHP7 is out for a few months and folks realize that all the FUD was just that.
14:44
it'll never go away
user895378
lol
@rdlowrey Didn't Python 3 say the same thing?
user895378
@Machavity Python 3 broke massive BC. PHP's STH does not.
user895378
Large-scale BC breakage is what stymies adoption. PHP avoids that as much as possible so that people don't have a good reason to avoid upgrades.
@marcio From what I read, composer create-project is just the same as doing a checkout followed by a composer install. So with this method can I update some files and they can do a composer update to get these files from the 'base framework' (not vendor stuff)?
14:52
> What did the cheese say when it looked in the mirror?
"Halloumi!"
@Jimbo no, and it's probably not the best idea. If you're using composer already, just distribute these files you want to update regularly through ./vendor and use some post install or post update command to copy these files from ./vendor to the app folder.
@marcio Oh nice, never thought of that... copy the files that they'll be editing into the App/ folder if they don't exist, and then whenever I update the base stuff it's just a composer package that their App stuff references, and it won't be overwritten. Very nice, cheers
15:08
is there a convention for defining option array keys in phpdoc annotations?
enum DayOfWeek: int {
  Sunday = 0,
  Monday = 1,
  Tuesday = 2,
  Wednesday = 3,
  Thursday = 4,
  Friday = 5,
  Saturday = 6
}
How should I store the type int on the zend_class_entry? It's probably needed for at least Reflection and it may be useful for other things too.
sunday = 0? ew
@LeviMorrison
Do you really want to assign them values? :-(
15:15
Oh, this is in addition to what we already have, not replacing it.
@LeviMorrison Not in any way an answer to the question but... please allow a trailing comma on the last member value, or (possibly better) use ; terminators for member decls (would be more consistent with prop/const decls in regular classes).
@PeeHaa can you ask in android room that someone gives me access?
@DaveRandom Only Hack uses ;
Everyone else uses commas.
lol
Not a big deal anyway; that's just superficial syntax.
@LeviMorrison also… btw. The : int part is superfluous… we only allow compile time values there anyway I suppose.
so it's self-documenting what type it is.
@bwoebi No, they must all match the same type.
15:16
Oh totally, just nitpicking I guess, mostly because I don't have anything useful to bring to the forum on the actual question :-P
@LeviMorrison I would not make that part of a return. I would instead focus on generics (since then you could do enum<int> DayOfWeak {
I see no point in typing that.
@tereško Sure. Hold on
@PeeHaa already got approved
anyone know of a skype-like application that works on lan?
Anonymous
15:24
@iroegbu yahoo messenger :)
lol... Yahoo messenger is still a thing?
Anonymous
to some people, yeah
Anonymous
I helped someone recover password some time ago
@PeeHaa , maybe you know anything about FB based authentication in android for webview
I am kinda stuck here ... and it's not like I speak Java-ish
@iroegbu afaik skype will not relay media traffic to the internet if it doesn't have to, i.e. you need an internet connection to authenticate etc but if you make a call then only centralised signalling is sent to the internet (a matter of bytes/sec), session signalling and media transmission never leaves the LAN
15:27
@LeviMorrison um, why did you change your mind on enum values?
I didn't.
Skype is specifically designed to be p2p, even if it can't resolve it via network segmentation sniffing then any half-decent router/gateway will transparently NAT it so it doesn't get sent to the internet
This is in addition to what I have already done; it's not replacing it.
I'm not sure I see the distinction
@iroegbu Possibly Skype for Business - which is a fantastic example of why programmers shouldn't be allowed to design websites.
Anonymous
15:30
why can't declare(strict_types=1); be actually set inside the .ini file? why on-per-file basis?
enum Foo { Bar, Baz } // strongly typed, not convertible to anything
enum WeakFoo : int { Bar = 1, Baz = 2 } // still typed but can convert to int implicitly and explicitly
aha
@DaveRandom athentication rules skype out, sadly
@LeviMorrison cool.
still -1 unless strong evidence to the contrary
15:33
@NikiC You don't think it's useful for when you've get a set of enums that need to match the values in an external API? (and yes, technically a separate mapping of enums to values would be the correct way to do it I guess, but, PHP).
hmmm, not sure I like the implicit conversion...
enum HTTPStatus: int {
    OK = 200,
    ...
}
Anonymous
@DaveRandom are you gitlab savvy?
@samaYo I am, and I'm hating it
@samaYo Depends what you are doing
Was this Zend/RFCs directory forgotten there? It doesn't seem to serve any purpose
Anonymous
15:42
@DaveRandom well, you know me. Pretty much the basic stuff :) I installed gitlab on CentOs7 and now, all my virtualhosts are pointing to gitlab. It is overriding my nginx server{} directives.
Anonymous
@Ocramius why? too slow, or not having as good as github's gui? other than that, I like it.
Crashes continuously
Anonymous
oh, mine is slow as hell. I have no idea why but it seems there aren't much alternatives so .. :/
Anonymous
I can't complain though, afaik I am now in the top 5% of highly skilled-developer's club when it comes to using smart tools.
@nikita2206 it should be removed, it's from a time RFCs were not a thing
Anonymous
alright, smartly chosen tools.
Anonymous
I wander if I had never joined SO or this room, what tools I would be using now aside the certainity of microsoft notepad as my IDE, XAMP as my server and copy/pasted folders with names of progress for commit messages as a way of svc :)
Anonymous
/sometimes, I wish I had a clone, so I could give myself a good-job high-five and a hug :p
@ircmaxell In what case?
@LeviMorrison just generally. doing 1 + $enum seems... off
16:01
@ircmaxell Sure, but realize that won't work if you use a strongly typed enum (no : type tagged on).
then again, just passing it to PDO could be nice
The people who want the C-style enums want the conversions happening.
hmmm.. perhaps...
hello everyone, i have a index with &nbsp; and is telling me that that index dosn't exist. anyone with a tip how can i accces the index?
yeah, so then you'd have a ::fromOrdinal() static method to convert back?
so $nextEnum = BlahEnum::fromOrdinal($enum + 1);?
16:03
posted on April 16, 2015 by kbironneau

/* by Alan */

Presently there's not a shortcut but it's always possible to do this: SomeEnum::values()[$ordinal]
But I could maybe do fromOrdinal($int).
well, what happens if I do something that isn't supported as a array key?
like another object?
It fails the type check on fromOrdinal, which requires an integer.
lol
O, you mean in the values() case?
either
Then it's just like any other array-key issue.
Nothing special required.
16:05
I know
I'm saying
enum Blah: Foo {
    something: new Foo(1),
    eih: new Foo(2),
}
or more realistcally
Anonymous
@DaveRandom don't forget to ping me, if you know the answer
enum TaxRate: float {
    product: 7.5,
    service: 10.0
}
ordinal() is your position in the list, not the value you hold.
so how do I go from value back to enum?
SomeEnum::fromValue($value) ?
(TaxRate::product)->ordinal(); //int(0)
@ircmaxell Maybe. Right now I need to work out shift/reduce issues ^^
Way more important than fromValue.
16:08
@samaYo gitlab really needs a dedicated box, and it needs a shitload of resources (many GBs of RAM, for one). I suspect you'll find that what's really going on is that gitlab installed its own web server and nginx is failing to start because port 80 is already bound.
> zend_language_parser.y:513.24-53: warning: rule useless in parser due to conflicts: @9: /* empty */
definitely
I assume 513 is the line number.
What's the 24-53?
And what's the @9?
@samaYo recommend just using bitbucket if what you want is just free private repos
@LeviMorrison byte range?
16:11
enum_declaration_statement:
                T_ENUM { $<num>$ = CG(zend_lineno); }
                T_STRING backup_doc_comment '{' enum_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_ENUM, 0, $<num>2, $4, zend_ast_get_str($3), NULL, $6, NULL, NULL); }
        |       T_ENUM { $<num>$ = CG(zend_lineno); }
                T_STRING ':' T_STRING backup_doc_comment '{' enum_value_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_ENUM, 0, $<num>2, $6, zend_ast_get_str($3), $5, $8, NULL, NULL); }
enum_declaration_statement is on line 513.
Anonymous
@DaveRandom I am using gitlab for offline svc, I have an account with bitbucket, but that requires internet connection, which is mainly the reason I want to self-host and why I can't use bitbucket.
How far ahead does the parser work? Only one token?
Anonymous
I guess, I could use my vbox to run gitlab, and use wamp for development ...
I may have to do more rejections in zend_compile.c
@samaYo Why do you need all the crazy gitlab GUI/tools/etc for that? You just need a git server, surely?
16:14
@LeviMorrison yes
Or just use local repos, you don't even need a remote
@samaYo why would you be developing without an internet connection?
@LeviMorrison you gotta move the lineno backup one token later
Anonymous
@DaveRandom mainly, it is easier to work with the gui, for creating issues and such, writting docs with syntax highlighting ... the server isn't visually expressive. I just feel like I have to use it, I want to feel comfortable in using it, if I ever get a job that uses gitlab, which I am sure there are to be many.
Is Z-Ray just a repackaging of Zend Server?
For every upvote I am getting on this the #1 answer is getting one too :/
Seriously; who upvotes an answer with a giant warning box?
> BEWARE! This answer contains a severe SQL Injection vulnerability. Do NOT use the code samples presented here. This answer is only preserved to prevent breaking links and for reference value.
What about that says "Yeah, this one is good; I'll upvote"
It also has no written explanation of any kind; it's just a code dump.
16:21
@LeviMorrison "It's great that we make people attentive about the issue!"
By every metric this is a bad answer.
Well, that's the only reason I could imagine.
It just gets upvotes because it has upvotes.
Upvotes beget more upvotes.
user895378
Welcome to SO lol
@samaYo You're creating a rod for your own back in terms of trying to maintain it, IMHO. I wouldn't bother, you'll spent more time on sysops than actually doing anything useful. Keep your local stuff as simple/sane as possible.
16:21
For the asked question it's a perfectly valid and a safe answer. Whoever complains it's not safe - how about a deal that I set up this particular code with the $galleries as provided in the question and you exploit it using aforementioned "sql injection vulnerability". If you cannot - you pay me USD200. How about that? — zerkms 19 hours ago
@ircmaxell I explained that earlier today.
That question has several that have been closed against it.
And not everyone looking for the answer uses number literals.
In fact, if they are using number literals they probably just hard-code the query
I know
I called him out on twitter for that
but that's the mentality of the upvoters
@NikiC Still has issues :/
> zend_language_parser.y:510.24-53: warning: rule useless in parser due to conflicts: @8: /* empty */
Anonymous
@DaveRandom yeah, I get that. gitlab was just the last piece in the puzzle, all my projects are on hold, till I get this thing working. But thanks for the great advice, I needed to hear that from someone other than myself :/
enum_declaration_statement:
                T_ENUM { $<num>$ = CG(zend_lineno); }
                T_STRING backup_doc_comment '{' enum_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_ENUM, 0, $<num>2, $4, zend_ast_get_str($3), NULL, $6,
 NULL, NULL); }
        |       T_ENUM T_STRING { $<num>$ = CG(zend_lineno); }
                ':' T_STRING backup_doc_comment '{' enum_value_statement_list '}'
                        { $$ = zend_ast_create_decl(ZEND_AST_ENUM, 0, $<num>3, $6, zend_ast_get_str($2), $5, $8, NULL, NULL); }
enum_declaration_statement is on line 510.
Anonymous
16:25
time to take time seriously :)
@LeviMorrison the problem is the second rule can never match
because the first rule always matches
I hate writing sub-rules.
I'm going to have to write one with T_ENUM enum_decl or something stupid.
T_ENUM T_STRING optional_return_type { $<num>$ = CG(zend_lineno); }
backup_doc_comment '{' enum_statement_list '}' {...}
that's how I'd write it
Except the statement lists are different
16:27
14 mins ago, by Levi Morrison
I may have to do more rejections in zend_compile.c
well, you could deal with that in the compiler...
^ Which would lead to that.
But I'd rather not do it in the compiler.
T_ENUM T_STRING ':' T_STRING { $<num>$ = CG(zend_lineno); } ...
| T_ENUM T_STRING { $<num>$ = CG(zend_lineno); } ...
nevermind
16:29
I think I can work this out in the parser still.
Just requires more rules.
well, try what I did above, maoving the lineno save later (@NikiC's suggestion)
so there's a token that differentiates the two
since right now, where you have it, it is unclear which of the two branches it should take with one-token lookahead, yet it needs to decide because you're running code
@ircmaxell Moving the save didn't fix the issue.
@LeviMorrison you need to move it for both cases...
@LeviMorrison this will be like dry up ice, Levi
@NikiC Hmm. Why does that matter?
They both start with the same sequence either way.
Does the lineno backup behave differently or..?
Let me clarify:
If both rules start with T_ENUM T_STRING { $<num>$ = CG(zend_lineno); } or T_ENUM { $<num>$ = CG(zend_lineno); } T_STRING , why does the former work but not the latter?
Seems like they should be the same for shift/reduce purposes.
16:37
@LeviMorrison well, does the first one actually work?
@NikiC It seems to.
It compiled at least
@LeviMorrison the next token after the code is executed is different in the first case, but the same in the second case
Working a test out now.
16:38
@LeviMorrison if you put it in a midrule it will only be executed if the lookahead token is match
@LeviMorrison The reason is that the parser will distinguish the two rules based on whether the enum name is followed by a ":" or a "{". Bison uses a LALR(1) parser, which implies that the parser has only a single token of lookahead.
Having a mid-rule semantic action before that, would require bison to already know which rule to take when it sees the first T_STRING
which it can't
Despite the rule being exactly the same.
I see, I think.
@LeviMorrison The code happens to be the same, but bison does not merge identical code blocks
could you add a "save_lineno" rule?
so T_ENUM save_lineno T_STRING...?
yes, that should also work
16:41
that may be a useful thing anyway, considering it's done in other places
Well, this doesn't do anything but it passes the parser:
enum DayOfWeek: int {
  Sunday = 0,
  Monday = 1,
  Tuesday = 2,
  Wednesday = 3,
  Thursday = 4,
  Friday = 5,
  Saturday = 6
}
Existing tests also pass.
@LeviMorrison this is a separate rfc, right?
Same one, if it works out.
Some people won't vote yes if they can't specify values. Their C heritage ruins them.
I've heard this from a few people now.
Swift supports both kinds, so it's not unreasonable to do both I think.
I think it's reasonable
The parser technically allows this right now too:
enum DayOfWeek: int {
  Sunday = 0,
  Monday = SOME_CONSTANT
}
16:49
Defining values is reasonable, right? Because then you could do binary enums (0, 1, 2, 4, 8, etc)
I think that's reasonable... at least for consistency
can you do
@ircmaxell I need to type-check it to be an int though, which cannot be done
enum Flags: int {
    a = 1<<0,
    b = 1<<1,
    c = 1<<2,
    d = 1<<3
}
@LeviMorrison it can be done, just not at compile time
@ircmaxell Which means I have to store the int info somewhere.
Currently I don't know where I would put it.
make it a private property of the enum?
->valueType
16:51
And then let the reflection abusers ruin everything?
;)
@ircmaxell Yes, by virtue of the same rule.
then I am happy, since I think that use-case is important
this is looking awesome guys
seriously
yeah, really nice work @LeviMorrison
Well it's not nice work yet if we want to support some of these constexprs.
Here's the zend_class_entry struct: lxr.php.net/xref/PHP_TRUNK/Zend/zend.h#128
wait, you're making it a user class?
16:54
That's how all enums are implemented.
hmmm...
you could create a "Enum" base class which implements that
then it would be implicit Flags extend Enum
I don't see how that fixes anything.
but the core class wouldn't be accessable normally...
Where do I store the int on the base enum class?
it will allow you to hide the type information in the object store
16:56
Nope, because it has to exist on the ce.
It can't be on the object itself.
oh wait, so this will be a class that you have to extend?
@LeviMorrison do you need the type flag at runtime?
@Rican7 Nono, no need.
not a new "type" (like interface)
ah, so it will be a new type?
@bwoebi To support this I do:
7 mins ago, by Levi Morrison
enum DayOfWeek: int {
  Sunday = 0,
  Monday = SOME_CONSTANT
}
(unsure about that)
Constexprs like this can overflow/underflow too so they have to happen at runtime too I think:
7 mins ago, by ircmaxell
enum Flags: int {
    a = 1<<0,
    b = 1<<1,
    c = 1<<2,
    d = 1<<3
}
16:57
well, okay. But do we really need values at all :-(
user924016
Mooorningssssh
@bwoebi Depends on who is included in "we".
@Rican7 that wasn't my point. Do we need any value at all? The ordinals just were an identifier in the values() array. Nothing with a value apart from that use case.

« first day (1643 days earlier)      last day (3531 days later) »