Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-22 Thread Rasmus Lerdorf
On 12/21/2012 09:28 AM, Dmitry Stogov wrote: Hi, This is more or less final proposed patch for 5.4 http://pastebin.com/ceiWWD4N It fixes implementation mistakes and makes the whole implementation much simpler. I hope I didn't introduce new bugs :) Of course I checked it with PHP test

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-21 Thread Dmitry Stogov
Hi, This is more or less final proposed patch for 5.4 http://pastebin.com/ceiWWD4N It fixes implementation mistakes and makes the whole implementation much simpler. I hope I didn't introduce new bugs :) Of course I checked it with PHP test suite, but it would be great to test it with real life

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-20 Thread Pierre Joye
hi Dmitry! On Thu, Dec 20, 2012 at 7:54 AM, Dmitry Stogov dmi...@zend.com wrote: Thanks a lot to work on that :) I'm not sure about APC, I saw the problem in ZendOptimizerPlus with php-5.4.10. O+ crashes (or corrupts memory and crashes on following requests) on each trait usage. The

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-20 Thread Pierre Joye
btw, same to test your changes/branch, as we have seen some crashes happening more easily on windows (same bug(s) on linux but with harder to get them crash). On Thu, Dec 20, 2012 at 9:02 AM, Pierre Joye pierre@gmail.com wrote: hi Dmitry! On Thu, Dec 20, 2012 at 7:54 AM, Dmitry Stogov

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-20 Thread Dmitry Stogov
Hi Pierre, The following test may crash on the second request with opcode cache. ?php trait THello { public function hello() { echo 'Hello'; } } class TraitsTest { use THello; } $test = new TraitsTest(); $test-hello(); ? Valgrind shows the problem even if PHP doesn't crash. ==2623==

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-20 Thread Rasmus Lerdorf
On 12/20/2012 06:36 AM, Dmitry Stogov wrote: Hi Pierre, The following test may crash on the second request with opcode cache. ?php trait THello { public function hello() { echo 'Hello'; } } class TraitsTest { use THello; } $test = new TraitsTest(); $test-hello(); ?

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-20 Thread Dmitry Stogov
hi Rasmus, I don't know all the APC internals, but it seems it just doesn't free memory carefully. It sets zend_class_entry-refcount to something above 1000 and as result all the nested structures are not freed as expected by destroy_zend_class(). I'm not sure which side effects this may have,

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-19 Thread Rasmus Lerdorf
On 12/19/2012 01:39 AM, Dmitry Stogov wrote: Hi, opcode caches support is one of the problem we have with current implementation. 5.4.10 seems just can't work with any cache at all. Of course, I'll care about it, and may give suggestions for necessary APC changes. Do you have an example

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-19 Thread Dmitry Stogov
Hi Rasmus, I'm not sure about APC, I saw the problem in ZendOptimizerPlus with php-5.4.10. O+ crashes (or corrupts memory and crashes on following requests) on each trait usage. The problem that PHP tries to deallocate names of methods defined in traits, but O+ keeps them in SHM. I believe APC

[PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Dmitry Stogov
Hi, I'm going to take a deep look into trait implementation and provide a better solution for 5.5. The current implementation is really wired and makes a lot of troubles for maintenance and each new fix, makes new troubles :( I'm really sorry, I didn't pay enough attention to treats before 5.4

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Stefan Marr
Hi Dmitry: On 18 Dec 2012, at 12:37, Dmitry Stogov wrote: I'm going to take a deep look into trait implementation and provide a better solution for 5.5. The current implementation is really wired and makes a lot of troubles for maintenance and each new fix, makes new troubles :( Sorry,

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Leigh
Hi Dmitry On 18 December 2012 11:37, Dmitry Stogov dmi...@zend.com wrote: The new solution may significantly change implementation and even behavior in some cases (e.g https://bugs.php.net/bug.php?id=62069). If you have any idea, do you know what the implications of your changes are on APC?

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Stas Malyshev
Hi! I'm going to take a deep look into trait implementation and provide a better solution for 5.5. The current implementation is really wired and makes a lot of troubles for maintenance and each new fix, makes new troubles :( I'm really sorry, I didn't pay enough attention to treats before

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Dmitry Stogov
Hi, opcode caches support is one of the problem we have with current implementation. 5.4.10 seems just can't work with any cache at all. Of course, I'll care about it, and may give suggestions for necessary APC changes. Thanks. Dmitry. On Tue, Dec 18, 2012 at 5:03 PM, Leigh lei...@gmail.com

Re: [PHP-DEV] Complete traits redesign for 5.5

2012-12-18 Thread Dmitry Stogov
Hi Stas, On Wed, Dec 19, 2012 at 1:25 AM, Stas Malyshev smalys...@sugarcrm.comwrote: Hi! I'm going to take a deep look into trait implementation and provide a better solution for 5.5. The current implementation is really wired and makes a lot of troubles for maintenance and each new