[PHP-DEV] Re: [PHP-CVS] com php-src: Merge from GitHub: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h

2013-07-31 Thread Dmitry Stogov
Something like the following? (it wasn't tested)


#define ACCELERATOR_VERSION_BASE 7.0.3
#define ACCELERATOR_VERSION_SUFFIX -dev

#iif PHP_EXTRA_VERSION
# define ACCELERATOR_VERSION ACCELERATOR_VERSION_BASE
ACCELERATOR_VERSION_SUFFIX
#else
# define ACCELERATOR_VERSION ACCELERATOR_VERSION_BASE  ( PHP_VERSION )
#endif


On Wed, Jul 31, 2013 at 12:27 AM, Stas Malyshev smalys...@sugarcrm.comwrote:

 Hi!

  I agree, this -dev suffix is annoying in PHP releases.
  However, I don't see a simple way to avoid it.

 Can we reuse PHP_EXTRA_VERSION from php_version.h? This was dev code
 will keep -dev, but releases would have no suffix. RCs would be marked
 as RC but that shouldn't be a big problem I think.

 --
 Stanislav Malyshev, Software Architect
 SugarCRM: http://www.sugarcrm.com/
 (408)454-6900 ext. 227



Re: [PHP-DEV] [PATCH] Constification of some PHP API calls

2013-07-31 Thread Andrey Hristov

 Hi Sara,
On 07/31/2013 12:55 AM, Sara Golemon wrote:

At a glance, this looks awesome.  There are a few changes where you
introduced #ifdef WIN32 checks that I want to spend a little more time
looking at...


In the WIN32 code there was an additional variable, declared always, but 
switched from 0 to 1 only in under WIN32. It is a path, that is copied 
and the copy is assigned to the parameter. I have simplified the logic 
for all platforms by putting more WIN32 conditionals.




-Sara

P.S. - Could I convince you to put it on a github fork to make it easier
to read?  No big deal if not... I just like that web view. :)


I have already done that :
https://github.com/andreyhristov/php-src

I have filled a pull request too.

Best,
Andrey



On Mon, Jul 29, 2013 at 3:01 AM, Andrey Hristov p...@hristov.com
mailto:p...@hristov.com wrote:

  Hi,
after experiencing again warnings about conversion from const char *
to char * when calling some PHP API functions I decided to spend
some time and constify a few of these. The result is a patch that
constifies the Streams API, and few functions in Zend and TSRM (to
which I have no karma). Most of the changes are conversion of char
* to const char * parameters, where applicable. In a few places
string lengths are changed from int to size_t. Few functions return
now const char * instead of char * (the caller did not
modify/release these before).

The patch is against php-src because it changes API which can be
only done in a new version.

Opinions?

Best,
Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] zend_execute_ex problem

2013-07-31 Thread Julien SALLEYRON
Hi,

I'm working on the AOP_PHP extension (http://pecl.php.net/package/AOP dedicated
to bring the AOP paradigm to PHP (may it be evil or not)) and I'm
struggling to make it compatible with PHP 5.5

As you probably expect, as the AOP paradigm is something like a magical
hook, I have to overload the zend_execute function (and zend_execute_ex in
PHP 5.5).

Sometimes, I want to call the hooks before the execution of the actual
called method.

If an exception is raised in the hook, I won't always call the former
called method.

This was working like a charm in PHP 5.4.X (zend_execute) and before, but
in PHP 5.5(zend_execute_ex) I have troubles with memory management.

First, it seems that if I don't replace the EG(execute_data) by
EG(execute_data)-prev_execute_data, I end in a infinite loop.

If I EG(execute_data) = EG(execute_data)-prev_execute_data, there is no
loop anymore, but I have freeing error (apparently in
zend_clear_multiple_stack).

I've tried to zend_stack_push(0) in order to *not* free any arguments in
the stack (as I don't have any), but trying this, I still have another
freeing error in the handle of the exception because there is a loop (and
freeing) until we can get the zend_vm_stack_frame_base().

Am I doing wrong ? Any pointers ? Is there something simplier to just
ignore the real execution without having memory problem ?

Thanks for your time and help.


Re: [PHP-DEV] Re: Multi-level Caching Fork of OPcache -- update

2013-07-31 Thread Dmitry Stogov
I agree with both (A) and (B).

However (B) was done on purpose and has its advantages and disadvantages.
Anyway, I've opened https://github.com/zendtech/ZendOptimizerPlus/issues/118

C) file based opcode caching may be interesting as well

but all these requests are going to be a part of next major release (may be
in php-5.6)

Thanks. Dmitry.

Thanks. Dmitry.


On Tue, Jun 11, 2013 at 2:13 PM, Terry Ellison ellison.te...@gmail.comwrote:

 On 10/06/13 09:20, Dmitry Stogov wrote:

 Sorry for slow response.
 I'm very busy with other work and have no time for MLC OPcache review.
 I don't think we can include it into main tree before 5.5.0 release
 anyway.
 But in general I think we may include your work in the future releases.

 Also, thanks for useful reports about problems you've found in OPcache :)

 Thanks. Dmitry.

  Dmitry,

 One useful side-effect of writing the MLC support is that I've really had
 to take apart the core OPcache code to understand how it works.  It's
 probably the first in-depth review that this extension has had from someone
 _outside_ the Zend team, so its only to be expected that anyone doing this
 would find a few issues.

 What I do think needs to be said it that I think that you guys have done a
 fantastic job here in this development.  9 times out of 10 when I've
 initially thought why didn't they do it this way? when digging into the
 code, I've dug down in and discovered that you already had, or had
 approached it a better way.  IMO, the whole OPcache approach is tighter and
 more sound than that of APC.  Take one example of this: the 2-pass algo for
 compiled scripts which enables the storage for a compiled script be to
 allocated as a single storage unit.  This has two major performance
 benefits at runtime:

 1)  The memory allocator overheads of preparing scripts for execution (and
 deallocation at rundown) are reduced by more than an order of magnitude.
 2)  The memory needed to execute the script is in a contiguous memory
 areas, and this gives improved hardware (as in L1/L2/L3) caching which
 passes through to a runtime performance improvement.

 There are a couple of things that I would refactor if I had written
 OPcache.  (I'll raise a couple of issues on these to discuss what I mean in
 more depth.  and when the MLC work reaches a plateau if you think its
 worthwhile I can cut a couple of branches to show you a possible solution.)
 A)  The SMA startup bootstrap is just messy and needs refactoring.
 B)  The simple dead-and-rebirth method of refreshing caches isn't going to
 scale well on real systems.

 Terry
 (Note the new email addr that I am using for php.net work, as this one
 isn't being blocked by the php.net server)



Re: [PHP-DEV] zend_execute_ex problem

2013-07-31 Thread Yasuo Ohgaki
Hi Julien,

On Wed, Jul 31, 2013 at 6:24 PM, Julien SALLEYRON 
julien.salley...@gmail.com wrote:

 If I EG(execute_data) = EG(execute_data)-prev_execute_data, there is no
 loop anymore, but I have freeing error


Don't over write EG(execute_data), but use your own pointer when it is
needed.
I think this will fix your problem.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Re: [PHP-DEV] zend_execute_ex problem

2013-07-31 Thread Julien SALLEYRON
Hi Julien,

Hi and thank you for taking the time to help.

 Don't over write EG(execute_data), but use your own pointer when it is
needed. I think this will fix your problem.

The problem here is that I have came to the conclusion (wrong
conclusion ?) that I need to update the EG(current_execute_data) as
if the former called function had been processed, to actually skip
the function that was called in PHP.


Maybe some code will be more explicit...

?php

myFunction(); //the function is expected to be called (and will)


$hook = function () {throw new Exception()};

aop_add_before('myFunction()', $hook); //now we ask the extension to
call hook() before myFunction()

myFunction();//Now myFunction should never be called, as the hook is
raising an exception


Extension-wise, the code is located here
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L390), where I test
if the hook raised an exception or not.

If it did not, I'm calling the function
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L392
https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L391) and it ends
up updating EG(current_execute_data) with
EG(current_execute_data)-prev_execute_data.

Now, when the hook is raising an exception, I'd like to just skip the
function call. If I just return
(https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L397
https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L396) it ends up in
an infinite loop. reason why I tried  EG (current_execute_data) =
EG(current_execute_data)-prev_execute_data;

But this solution ends up in memory headakes...



2013/7/31 Yasuo Ohgaki yohg...@ohgaki.net

 Hi Julien,

 On Wed, Jul 31, 2013 at 6:24 PM, Julien SALLEYRON 
 julien.salley...@gmail.com wrote:

 If I EG(execute_data) = EG(execute_data)-prev_execute_data, there is no
 loop anymore, but I have freeing error


 Don't over write EG(execute_data), but use your own pointer when it is
 needed.
 I think this will fix your problem.

 Regards,

 --
 Yasuo Ohgaki
 yohg...@ohgaki.net



[PHP-DEV] Adding \Closure::isBindable()

2013-07-31 Thread Julien Pauli
Hi all.

From a recent discussion, we noticed that there is no easy user-level way
to know if a given closure is bindable or not.

Sure, the debatte about https://bugs.php.net/bug.php?id=64761 is still
open, I dont see why a static closure is not bindable, knowing that a
global scope defined closure is, and it can contain $this.
I'm feeling like there is a non sense in this design, but anyway.

To prevent such code :
https://github.com/atoum/atoum/blob/master/classes/test/adapter/invoker.php#L191
,
I added \closure::isbindable().

It's at https://github.com/jpauli/php-src/compare/static-closures , if you
have thoughts ?


Julien.Pauli


Re: [PHP-DEV] [PATCH] Constification of some PHP API calls

2013-07-31 Thread Sara Golemon
Ah, yeah, I can see that clearly now.  Looks universally cool to me.  Do
you just need someone with engine karma to push it?


On Wed, Jul 31, 2013 at 1:35 AM, Andrey Hristov p...@hristov.com wrote:

  Hi Sara,

 On 07/31/2013 12:55 AM, Sara Golemon wrote:

 At a glance, this looks awesome.  There are a few changes where you
 introduced #ifdef WIN32 checks that I want to spend a little more time
 looking at...


 In the WIN32 code there was an additional variable, declared always, but
 switched from 0 to 1 only in under WIN32. It is a path, that is copied and
 the copy is assigned to the parameter. I have simplified the logic for all
 platforms by putting more WIN32 conditionals.



  -Sara

 P.S. - Could I convince you to put it on a github fork to make it easier
 to read?  No big deal if not... I just like that web view. :)


 I have already done that :
 https://github.com/**andreyhristov/php-srchttps://github.com/andreyhristov/php-src

 I have filled a pull request too.

 Best,
 Andrey


 On Mon, Jul 29, 2013 at 3:01 AM, Andrey Hristov p...@hristov.com
 mailto:p...@hristov.com wrote:

   Hi,
 after experiencing again warnings about conversion from const char *
 to char * when calling some PHP API functions I decided to spend
 some time and constify a few of these. The result is a patch that
 constifies the Streams API, and few functions in Zend and TSRM (to
 which I have no karma). Most of the changes are conversion of char
 * to const char * parameters, where applicable. In a few places
 string lengths are changed from int to size_t. Few functions return
 now const char * instead of char * (the caller did not
 modify/release these before).

 The patch is against php-src because it changes API which can be
 only done in a new version.

 Opinions?

 Best,
 Andrey

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php






Re: [PHP-DEV] [PATCH] Constification of some PHP API calls

2013-07-31 Thread Andrey Hristov

On 07/31/2013 04:56 PM, Sara Golemon wrote:

Ah, yeah, I can see that clearly now.  Looks universally cool to me.  Do
you just need someone with engine karma to push it?


right. I have no Zend karma, or at least didn't have at CVS/SVN times.




On Wed, Jul 31, 2013 at 1:35 AM, Andrey Hristov p...@hristov.com wrote:


  Hi Sara,

On 07/31/2013 12:55 AM, Sara Golemon wrote:


At a glance, this looks awesome.  There are a few changes where you
introduced #ifdef WIN32 checks that I want to spend a little more time
looking at...



In the WIN32 code there was an additional variable, declared always, but
switched from 0 to 1 only in under WIN32. It is a path, that is copied and
the copy is assigned to the parameter. I have simplified the logic for all
platforms by putting more WIN32 conditionals.



  -Sara


P.S. - Could I convince you to put it on a github fork to make it easier
to read?  No big deal if not... I just like that web view. :)



I have already done that :
https://github.com/**andreyhristov/php-srchttps://github.com/andreyhristov/php-src

I have filled a pull request too.

Best,
Andrey



On Mon, Jul 29, 2013 at 3:01 AM, Andrey Hristov p...@hristov.com
mailto:p...@hristov.com wrote:

   Hi,
 after experiencing again warnings about conversion from const char *
 to char * when calling some PHP API functions I decided to spend
 some time and constify a few of these. The result is a patch that
 constifies the Streams API, and few functions in Zend and TSRM (to
 which I have no karma). Most of the changes are conversion of char
 * to const char * parameters, where applicable. In a few places
 string lengths are changed from int to size_t. Few functions return
 now const char * instead of char * (the caller did not
 modify/release these before).

 The patch is against php-src because it changes API which can be
 only done in a new version.

 Opinions?

 Best,
 Andrey

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php










--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] The day has come

2013-07-31 Thread Michael Wallner
Hi all!

Tomorrow, August 1st 2013, is the day, it is *my* day.

Some of you might already know [1] that I've been hired as a full-time
PHP core developer by SmugMug. I'll officially start tomorrow.

I hope that I can do a great job for all of us who need and love to
use PHP.  I hope that you will bear with me while I get used to all
that stuff again I missed all the years busy with other things.  I
hope that I can contribute to existing, prospective and yet unknown
projects within the PHP community in a meaningful and constructive
way.

Talk to me if something about me or PHP bugs you.  Talk to me if you
need help with your endeavour making PHP better. Talk to me even if
you can't stand my attitude.

Thank you and apologize my huge excitement!

[1] http://m6w6.blogspot.com/2013/06/hear-hear.html

-- 
Regards,
Mike

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] zend_execute_ex problem

2013-07-31 Thread Yasuo Ohgaki
Hi Julien,

On Wed, Jul 31, 2013 at 10:05 PM, Julien SALLEYRON 
 julien.salley...@gmail.com wrote:
 
  The problem here is that I have came to the conclusion (wrong conclusion
 ?) that I need to update the EG(current_execute_data) as if the former
 called function had been processed, to actually skip the function that was
 called in PHP.
 


I guess I understand what you would like to to. I might be wrong, though.


 
  Maybe some code will be more explicit...
 
  ?php
 
  myFunction(); //the function is expected to be called (and will)
 
 
  $hook = function () {throw new Exception()};
 
  aop_add_before('myFunction()', $hook); //now we ask the extension to
 call hook() before myFunction()
 
  myFunction();//Now myFunction should never be called, as the hook is
 raising an exception
 
 
  Extension-wise, the code is located here (
 https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L390), where I test if
 the hook raised an exception or not.
 
  If it did not, I'm calling the function (
 https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L392) and it ends up
 updating EG(current_execute_data) with
 EG(current_execute_data)-prev_execute_data.
 
  Now, when the hook is raising an exception, I'd like to just skip the
 function call. If I just return (
 https://github.com/AOP-PHP/AOP/blob/php5-5/aop.c#L397) it ends up in an
 infinite loop. reason why I tried  EG (current_execute_data) =
 EG(current_execute_data)-prev_execute_data;
 
  But this solution ends up in memory headakes..


Unless you clean up EG(current_execute_data) by yourself, I suppose you'll
have memory issues.

If you would like to skip function to be executed, all you have to do is
do not call zend_execute()/zend_execute_ex() when the function is called.

 $hook = function () {throw new Exception()};

Since your code raise exception, you don't have to skip myfunction(). Just
let PHP die with unhandled exception.

It would be easier if you keep functions in hash to determine hooked one
and call hook as needed/skip function as needed. I might not understand
what you really would like to do, but hope this comment helps.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net


Re: [PHP-DEV] The day has come

2013-07-31 Thread Levi Morrison
Congratulations! One of my life goals is to get paid to work on open source
software so I can definitely understand your excitement. I look forward to
all the good stuff you can help PHP do!