« first day (1845 days earlier)      last day (3109 days later) » 

10:00 PM
@NikiC yes. Splitting it into three votes means you can ensure the necessary majorities
 
@NikiC you forgot the "both okay" vote^^
 
@NikiC @Andrea it came up as "something against null", but union types was never discussed and was put on draft recently. I genuinely have the impression the interactions are not being taken into account by the majority of voters.
 
Except that makes things complicated if void wins the 2-way 50%+1 vote yet its 2/3 vote fails
god voting systems are complicated
 
Better just not do anything but Yes/No votes
Everything else is subject to interpretation
 
@NikiC oh yeah, this would be confusing as hell
 
10:02 PM
@Andrea another use for union types … a class implements like up to three independent interfaces. Now some function wants to do different things depending on which interface it implements. So, as an user you don't want to pass each instance up to three times depending on which interfaces it implements, but only once.
@NikiC well, we'd just need clear rules how to evaluate.
 
I am really glad I didn't do the three-way (four-way) for scalar types that I had planned
@bwoebi that's & not |
we should totally add &, that sounds useful
 
@Andrea I said up to.
so, you may implement one, two or three of the interfaces.
 
ThW
@Andrea For & you could just define an additional interface
 
@bwoebi oh I see now. You're describing a feature called Bad API Design
 
^ this
 
10:04 PM
@ThW yes
 
@ThW but this wouldn't include "string"
 
Abe
@Andrea but sometimes we use code that we can't change
 
@Andrea except that you're putting nearly all the unions in that category. Not sure, but I quite like the Host::use() function in Aerys.
 
ThW
I would like to see union types, it is specific and flexible - the others I am not sure.
 
Is there a quick way to figure out the next biggest number to use for ZEND_VM_HANDLER()? :)
 
10:06 PM
@bwoebi do you see why I don't like unions
 
ThW
@marcio that would be scalar type vs interface,true
 
@SammyK Check zend_vm_opcodes.h
 
@SammyK yep… go to zend_vm_opcodes.c and search for NULL… else use the biggest number + 1
 
ThW
but you can not extend string
 
@NikiC Thanks! :) cc/ @bwoebi
 
10:07 PM
@Andrea no, I'm not. (Or basically: I'm not undertsnading why you think all the unions are bad API design)
 
@ThW fortunately, but you can be a "class { __toString(){... }; }"
 
ThW
That would need something like a 'stringable' like the 'callable'
@marcio I use that - I defined a MyFrameworkStringInterface for it. But I would prefer that any magic method had a corresponding interface.
 
unfortunately, yes. Because we reject objects that have __toString, on arguments typed as "string" on strict type mode, it works on non strict mode though.
 
ThW
but union types should allow string|MyStringInterface?
 
Abe
@Andrea unions are the only alternative to method overloading, which is required sometimes. php abused unions, sure, but sometimes they are actually needed imho
 
10:11 PM
@ThW I expected that, because the array|SomethingThatCanBeIterared case.
^ forgot the name of the interface
 
ThW
array|Traversable
 
yup
 
@Thw do i need to increase the PHP memory limit?
 
ThW
@Sashi How should I know? It is a strange number except for hitting a resource limit
 
@Abe that's the problem
I don't like unions because I think that if your function does different things given different types, then you should split it into multiple functions
 
10:15 PM
Ok did you find any coding error in my code
Only in uploading its creating such issues
 
@Sashi Instead of us telling you if your code is broken, why don't you tell us what error message you're seeing?
 
ThW
@Andrea Well, PHP has not overloading depending on the arguments.
 
and then what @Andrea. Name the function differently according to the types being passed? like createFromString, createFromArray? Not sure how this is better than two create functions with different types...
 
@FélixGagnon-Grenier yes, that works
 
ThW
Union types allow you to be specific even if you expect different types.
 
10:18 PM
@ThW yes, but people implement it anyway using conditionals
 
And if you're about to come back with "I don't see any error message", then you need to turn error reporting on and go chase down that error message. That's your due dilligence, it's the minimum responsibility that you have towards your code before any developer should even start to think about looking for outside help.
 
Its showing Invalid user ID. when i am uploading the file. Only at 139 and not going to 140
 
ThW
@Andrea And with union types they can add restrictions to these calls
 
@ThW sure
 
ThW
10:19 PM
without it is only specific type or mixed
 
I don't dispute that union types describe some existing APIs well, actually
 
Abe
what if you have a function that does the same thing but accepts a restricted set of types?
Collection::add(Foo|Bar|Baz|Stuff $item){
$this->stuff[] = $item;
}
i don't think you want 4 methods having all the same method body just because of that
 
@Sashi That's not a PHP error.
 
ok
its in wordpress file upload
 
I just think they encourage poor practices
 
10:20 PM
Increasing your memory limit is unlikely to help. Check the 140th file being uploaded for any data issues.
 
Abe
@Andrea of course, but sometimes it's the only reasonable practice
 
Ok
 
@Abe generally there should be a common superclass
 
hum... is overloading as c++ does it really bad practice?
 
Abe
@Andrea but not necessarily i have control on such definitions
 
10:21 PM
@Andrea You keep saying that you think people just shouldn't write code like that. Is there anything that would persuade you that they're useful?
 
or is it bad practice in the php spice?
 
And, I'm sorry to say, but if it is a problem specific to Wordpress, you're unlikely to get more help from people in this chat, because most people here are passively hostile towards Wordpress.
 
or actively ^^
 
@Ghedipunk : is this MSG coming from my plugins or its a wordpress msg
 
@Abe true, but adding union types just as a workaround for bad class hierarchy design doesn't seem right
 
10:22 PM
If your plugin doesn't contain the line "Invalid user ID" then it's coming from Wordpress.
 
Where else does my opcode need to be defined before running zend_vm_gen.php? I assumed it auto-generated stuff when I did ZEND_VM_HANDLER(182, ZEND_MY_FOO)
Currently getting this:
ERROR (/php-src/Zend/zend_vm_def.h:4258): Invalid ZEND_VM_HANDLER definition.
 
@Danack I don't think union types aren't useful. I just think that most of the use cases seem to either be bad practice, or things that could be done better with another construct
 
what other construct?
duck type all the things?
 
int|float could be replaced with a superclass. We don't currently have one, but we should add one
this has the advantage that it's more concise and clear, and means we could add other types inheriting from it later
 
People are saying that they would find them useful, and you can't really rule what other people find useful or not....
And I don't think having to have everything in a hierarchy is a good practice either.
 
10:25 PM
@Danack every feature is useful
 
As not all entities in the real world fit in a clean hierarchy
 
@Danack sure
 
@LeviMorrison just an exercise here, let's suppose that void already existed before and dropping it would not be an option. How could you design union types without "null"?
 
Classical OOP is flawed
 
@thw @Ghedipunk : My MySQL version is 4.1.22 and i hav tried to upgrade it to 5, its not happning. Forignkey issues and SQL Error (1062): Duplicate entry '1' for key 'id'
 
10:26 PM
@marcio Make one of the union members "nullable": ?Foo|array
 
hey where's @tereško. been a while since I've had a laugh at the taste of harsh northern humor.
 
In my opinion this is just stupid.
It's not really an option.
 
@LeviMorrison it wouldn't really make sense for sure
 
@LeviMorrison how about making nullable a property of the entire return type enforcing ":?"
function() :? whatever|bool {}
 
ew
 
10:28 PM
@Sashi dev.mysql.com/doc/refman/5.0/en/upgrading.html might help... Not sure if it will, but it's where I'd start.
 
ok
 
.....so I don't get what you're suggesting people do, other than write boilerplate code to ensure the type safety.
 
They already do
 
And people would like to stop doing that, right?
 
for one of the use cases anyway
@Danack for the overloading use case, you'll have to do type checks regardless of whether there's union type hints
 
10:30 PM
In php 7, with exceptions, is it possible to catch E_NOTICE or only the "higher" error types?
 
@Andrea I don't like when you say "ew" without further clarification. Is it because ":?" looks weird, is it because "whatever|bool|null" would be better?
 
I thought E_NOTICE and exceptions were two different things
 
Btw, Hi Andrea, I was browsing PHP RFCs to get reaquainted and wanted to thank you for your future-looking RFCs
 
@marcio it doesn't really fit with how nullables are supposed to work, I guess. It doesn't match parameters. It looks weird. It's different from Hack and PHPDoc. The current union type approach is better
 
Abe
@brcolow only fatals and recoverable fatals are exceptions. warnings and notices are still warning an notices
 
10:31 PM
okay - that makes sense and answers my question - thanks much.
 
not all fatal are exception? like parsing
 
Do define('WP_MEMORY_LIMIT', '128M'); will helps
 
@brcolow I'm glad you like them. Few of them get places
 
@Andrea depends on what your code is doing:
processOrder(Purchase|Reservation $order, OrderHandler $orderHandler) {
    $orderHandler->addProcessor('Purchase', $someCallable1);
    $orderHandler->addProcessor('Reservation', $someCallable2);
    $orderHandler->__invoke($order);
}
 
@FélixGagnon-Grenier I think some recoverable errors are still there too
 
10:32 PM
Progress is a /trudge/, not a trot
4
and I just came up with that, feel free to add it to wikiquote under my name to make me famous
 
Yeah you need some sanity checking somewhere, but having a union type removes a whole load of writing of characters.
 
@Danack different use case, that's an ad-hoc superclass
 
@Sashi It's considered bad form to change the memory limit in a module... If someone had configured their system for 2G of memory, and you set it to 128M, you've just cut their available memory to 1/16th of what they were expecting.
 
@brcolow sounds about right...
 
:)
 
10:34 PM
@Andrea K - And is that something that you think is 'bad practice' or do you have another construct that you would prefer people to use?
 
Abe
@Andrea correct, and some fatal-fatals too
 
ok
 
@Danack it's something where union types are a workaround for a missing superclass or interface IMO
 
9 mins ago, by Danack
As not all entities in the real world fit in a clean hierarchy
@Andrea if the entities can't be put into a single superclass or interface, what are you suggesting that people should do?
 
sure, though interfaces aren't quite hierarchies
 
10:35 PM
Does a set of all sets contain itself? (Example of an unclean hierarchy)
 
@Danack that's an interesting case but probably also a rare one. When does it crop up?
 
For the code above, there's no common methods for each of the types. They each have their own dedicated handler.
@Andrea i) serialization/deserialiation ii) Event Sourcing
 
I feel rather lucky and exciting that php 7 is coming out so soon to when I started needing to use php for my large, multi-programming language project. I can't wait to convert my tiny php codebase to use types :D
 
@brcolow I'd argue that progress is a trudge with frequent sprints... but still a trudge at the end of the year.
 
Basically anywhere where i) you don't have code that is strongly coupled together (i.e. not directly calling each other) ii) You have a list of different 'entities' that you support with separate callables/functions for each of the entities.
 
10:38 PM
@Danack (i) is something I'd thought might be problematic
 
And want to have the code fail as early in the program as possible, rather than later.
 
@Danack if they have different methods, why are you using the same method to call them?
 
@Andrea Not completely true. With both arrays and ArrayAccess you can have read access with no observable differences.
Also, if you are using them as algebraic types you can use dynamic dispatch.
(which is just a generalization of the point above it)
 
@LeviMorrison that's not the overloading use case, the two have a common interface. It's an ad-hoc superclass
 
@Andrea I'm not using the same method to call them. Do you mean why am I passing them into the same function?
 
10:41 PM
@Andrea Common interface but not necessarily interface.
 
@Danack that's what I meant yes
@LeviMorrison yes, that's a flaw in PHP. Unions are a workaround
 
The files are storing in wp_postmeta table something like this (3935, 3319, '_wp_attached_file', ' USER-files/20/ORDER-Details.pdf'); So when i uploading the file it able to uploaded to the WP uploader but after updating to the user its showing "User Id is invalid" - at that time the Page is/wp-admin/user-edit.php its stocked here
 
@SammyK did you specify the operand types?
 
If only you could implement an interface on a class you didn't write
Haskell has something which is somewhat analogous to this
 
@Andrea Because that function is sending an event to another part of the system, and is capable of processing all of the types that are registered with the orderHandler. And it is better to have the list of types that the function can handle inside the function, where the handlers are attached, instead of having to do this:
//Listen for incoming data...
$order = deserialize($serializedOrder);
if ($order instanceof Purchase) {
    processOrder($order);
}
else if ($order instanceof Reservation) {
    processOrder($order);
}
else {
    //Lets hope no-one forgets to add any entity to this list.
    throw new BadTypeException()
}
And everywhere else is the application where a function is called that can handle multiple types.
 
10:46 PM
@NikiC I didn't. Just now saw the regex in the PHP file looking for those. :)
The thing is that my keyword has no operands.
 
@SammyK What is it?
 
@Danack this all seems very messy
 
It's the retry keyword in a catch block
 
PHPStorm is ignoring a lot of keyboard shortcuts, anyone had this problem?
 
@SammyK In that case use ANY, ANY
 
10:48 PM
Ah, thanks! :)
 
@Andrea yeah....business code is always messy. It's because you can't create clean heirarchies and a lot of the code looks like it could be data, if only we were using Lisp....
 
Alright, I have other things to go and do. See you all later.
 
laters.
 
Abe
@Andrea i see it completely differently. for me hierarchies are utterly dumb and unions are a better solution :D
 
Abe
10:49 PM
spending time designing monumental hierarchies is the dumbest thing you can do with oop
@Danack laters! check twitter when you have time
 
yeah yeah....I'm thinking.
 
Abe
ehehe :D
 
After digging further, not sure if I should be adding ZEND_AST_RETRY to the big switch in zend_compile.c and run a zend_compile_retry() to fire a ZEND_RETRY opcode or just add ZEND_VM_HANDLER(182, ZEND_RETRY, ANY, ANY) to zend_vm_def.h. Or both? Lol
 
@SammyK both
 
I was afraid of that. Hehe. Thanks for all the help!
 
10:54 PM
you need to add your token in zend_language_scanner.l, add the AST node in zend_ast.h, create it in zend_language_parser.c, compile the AST node in zend_compile.c and define the runtime handler in zend_vm_def.h
oh and implement printing in zend_ast.c
and run the sh file in ext/tokenizer
 
@NikiC Thanks! I had all that done except the zend_compile.c part. Going to try some more stuff and try to compile with all my fingers and toes crossed :)
 
Abe
stupid question. is there a way to get both the matched rows and affected rows for an UPDATE? using mysql but asking generally about sql and pdo
 
A proper traits system seems to be what you want if you want common functionality without a vertical hierarchy. @Danack @Abe @Andrea
Unfortunately PHP botched that >.<
 
Which is better, an interface for a message queue that just defines addMessage() and getMessage(), or just having an array and using array_push() and array_shift()?
 
Abe
interface all the things
 
11:05 PM
@Ghedipunk If it's an internal detail probably the latter. If it's something you are exposing or reusing then probably a class/interface.
 
Thanks. Yeah, I'm planning to expose a lot for re-implementation... not sure if I'd want the message queues to be exposed, though, because they're right in the core...
Alright, so, working on getting my websocket server up to post 1990's code quality... Single Responsibility Principle means the message just keeps track of who sent it, who receives it, and the message itself... like the envelope of a letter. And, like a letter, it can't mail itself, it needs a postal system, so no $message->send() methods... Am I off my rocker for thinking along these lines?
(I've been thinking about this code for too long, I no longer trust my sanity)
 
@Andrea 1) I disagree, it fits; 2) neither nullable types or union types will match parameters if you meant "fn(Arg $arg = null)"; 3) Agreed, it does look weird; 4) Agreed, but not a showstopper IMMO; 5) 100% agreed;
 
11:21 PM
how do i change the name of server from localhost to say "abc" in apache xampp
 
I need a gif for when you go back to a side-project that you last touched 4 months ago and:
> > SSSSSSS....E..FFEE.EEEEEEFEE...EEEEEFEE..
 
@JibinMathew Are you trying to make it so that when you point your browser to something like http://abc it will load up the site on your localhost web server?
 
Abe
@Danack don't you have it already? on the left, the 4-months-in-the-past you:
what a great gif
 
@Ghedipunk Yes
 
@Abe It's great, but it has a name already: searchservervirtualization.techtarget.com/definition/…
 
11:26 PM
Edit your hosts file (Google will tell you where to find it in your operating system).
 
Abe
haha
thinking...
 
@NikiC Does this look like the right track? :) github.com/php/php-src/compare/master...SammyK:retry-keyword
 
@Ghedipunk ok is possible that i run a apache server on my computer and a different computer on the same network can make a post request to the php script run on my computer? How would i do that? without using IP of the computer on which server runs
 
#Aerys supports HTTP/2 now and it's enabled if you have a #PHP version compiled with #OpenSSL 1.0.2. Test it here: https://kelunik.com:1337/
 
@SammyK pretty much.
 
11:30 PM
@bwoebi Sweet! Now I just need to make it work. :)
 
hello
 
Yes, it is possible to get two servers to talk to each other on the local network using custom domain names by editing their respective hosts files (or, if you're running several servers, you might want to look into running your own private DNS server). I don't know what you mean by making a post request to the php script on your own computer, except that maybe you mean that your own computer is also one of the web servers on the network, in which case it works just like any other server.
 
\o/
 
As for sending those web requests, if you're not familiar with it yet, I suggest using cURL: secure.php.net/manual/en/book.curl.php
And with that, I'm starting my commute... and I have a new keyboard waiting at home, so I probably won't be on for the rest of the night.
 
11:39 PM
@Ghedipunk The problem is that there would be network in which there would be only one server to which all the other client systems has to make a request , what i want is that client must be able to identify the server system by somemeans in order to make a request
 
Hi,

I have a User File plugins although I knew its working fine and there is no flaws in my code.

In this plugins Administrator can upload files for users using /wp-admin/user-edit.php

And User can download these files but in this plugins A admin can upload maximum 139 files not more. Its giving "User Not Found" warning.

I have tried for few users. Could you please check is this WordPress Error/exception ?

http://pastebin.com/3ue7LgLS (I am using WP 4.1.2 and MySQL 4)
Its storing in db under post meta like this
(3935, 3319, '_wp_attached_file', ' USER-files/20/ORDER-Details.pdf');
 
Is there any documentation on what props are available on CG(context)?
Wait - zend_oparray_context_begin
Lol
Doh!
 
@NiharikaParida You need to learn how to debug your stuff. No-one else is going to be able to figure out a problem like that from just looking at it.
 
@Danack there is no error only a message that Invalid User ID for File 140

Do I need to update
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
 
11:50 PM
> No-one else is going to be able to figure out a problem like that from just looking at it.
 

« first day (1845 days earlier)      last day (3109 days later) »