[PHP-DEV] Re: Let's discuss enums!
On 09/17/2015 07:06 PM, Rowan Collins wrote: 3) there should be no accessible "value" for a member; the value of Weekdays::SUNDAY is simply Weekdays::SUNDAY, not 0 or 7 or 'SUNDAY' (I'm thinking that internally, each member would be represented as an object pointer, so there's no real benefit to forcing people to number everything like some languages do) Well, how are you supposed to serialize an enum value without some sort of numerical representation or value? Maybe you could serialize it by converting the enum to a string representation of its name but that wouldn't be efficient and also if a developer refactored its code base and renamed an enum, when unserializing the data it wouldn't be properly assigned. Also other languages don't force you to assign value for an enum constants, if I recall correctly languages like C/C++ automatically assing an interger value to enumerations in they order they were typed so: enum BadDays {MONDAY, SUNDAY, THURSDAY=5, SATURDAY} would be MONDAY = 0, SUNDAY = 1, THURSDAY=5, SATURDAY=6 So assigning a value is optional. I see the enum's rfc mentions boxing primitive types but that seems to not solve what I'm saying here at all. Enums should be a nice way of grouping constant values without hitting on the performance (for everything else use a class). The rfc is proposing a nice syntax but it doesn't fully covers serialization/unserialization of enumerations. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Coercive Scalar Type Hints RFC
On 02/22/2015 06:28 PM, François Laupretre wrote: Hi Stas, It seems the actual problem is that we have too many compiler / code analysis experts in the community ;) (don't get me wrong, I am not saying that for you, I just admire your patience explaining the same again and again to people who never read one line from PHP core source). Well I never have worked on a JIT/AOT and I have to admit I haven't done any contributions to the PHP engine (and it seems I do not have any rights to write some couple of messages expressing concerns/views because of that). On the other side I took the wxwidgets extension in an effort to revive it (because I believe PHP can have other use cases). Improved its code generator (and other stuff that involved a relation with the PHP source code) which now generates more than 905941 lines of code that constitute the extension (github.com/wxphp/wxphp/tree/master/src). So I have indeed read source from PHP core. In any case, sorry if I have annoyed some, that never was my intention, we as humans can't posses all the knowledge of the world, so thats why we always learn from somebody else, whats the purpose of a community without participation :) Cheers! -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] RFC: Replacing errors with Exceptions
I published a (work in progress) RFC today about replacing certain errors with exceptions. I know that there already was something similiar on the php6dev blog, but this is not completly the same, so awating your comments: http://wiki.php.net/rfc/errors_as_exceptions -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] CVS Account Request: ilovephp
I'm testing the cvs account request system to make sure it works, because someone insists it's not. Ignore me. --philip -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] test
sry... mail newsreader sucks -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] __static_call patch
Hello, Etienne Kneuss provided me a patch to handle static called class methods properly - it works fine. Now i need antother patch for: __static_call_patch __static_set __static_get where can i find it? Sebastian Deutsch -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP broken pipe in fork
The child process doesn't use any database connection, just to run some shell scripts, but it closes the connection anyway. I initialy used PEAR DB and then _pconnect functions but the result is the same. Was the bug solved two years ago ? How was it solved ? Thank you Rui Francisco Shaun Thomas wrote: [EMAIL PROTECTED] wrote: I'm using a query in loop and go through all records to do some operations in the middle of the script i fork(); to do other things When i return to the parent process i try to make one update and i get the following error [nativecode=Unable to complete network request to host "127.0.0.1". Error writing data to the connection. Broken pipe] That would be a fairly well known issue with PHP. You're running into the same thing we encountered about 2 years ago. What happens is that your child process is closing the mysql connection as part of its standard PHP cleanup procedures, leaving the parent with a broken connection. I'd recommend provisioning a method so that your child makes its own new connection, and does not use the parent's connection at all. Since all php scripts clean up before exiting, you need to make sure all resources in use by the child are not needed by the parent after the child exits. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] PHP broken pipe in fork
Hi, i'm using firebird 1.5.1 on a linux machine with a php script I'm using a query in loop and go through all records to do some operations in the middle of the script i fork(); to do other things When i return to the parent process i try to make one update and i get the following error [nativecode=Unable to complete network request to host "127.0.0.1". Error writing data to the connection. Broken pipe] And continue the loop of the records of the query. It apears that the fork and the wait from pcntl closes the sockets to the database. Is this a regular beaviour ? How can it be solved ? I'm using Pear DB for database access. Thank you in advance Rui Francisco -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php