[PHP-DEV] Fix for duplicate magic methods calls (bug #63462)

2013-01-14 Thread Stas Malyshev
Hi!

I made a fix for bug #63462 - https://github.com/php/php-src/pull/258 -
which changes a bit how we do guards by unmangling the names before
applying guards. This is a slight change of behavior and also means that
all private vars with the same name would use the same guard (all
protected and public vars with the same name are the same var anyway, so
they should be doing it in any case).
Since it's a behavior change in core, I'd appreciate a second pair of
eyes to see if nothing is broken by it. All tests pass but better safe
then sorry. If no problems found in it, I'll commit it soon.

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

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



Re: [PHP-DEV] FW: Functionality request/proposal

2013-01-14 Thread Stas Malyshev
Hi!

 function multi() {
   return 10, 20;
 };

This can be done with:

function multi() {
return [10, 20];
}

list($x, $y) = multi();

However, sum() won't work this way:

 echo sum(multi()); // echoes 30

But can work this way:

call_user_func_array(sum, multi());


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

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



[PHP-DEV] [RFC][vote] 5.3 EOL

2013-01-14 Thread Pierre Joye
hi,

I opened the voting phase for the 5.3 EOL RFC.

I also changed the polls to reduce confusion between the announce and
the actual EOL, to avoid equal results between many options.

Thanks for your upcoming votes and let focus and 5.5+ asap :)

Cheers,
--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] [RFC][vote] 5.3 EOL

2013-01-14 Thread Laruence
On Mon, Jan 14, 2013 at 5:11 PM, Pierre Joye pierre@gmail.com wrote:
 hi,

 I opened the voting phase for the 5.3 EOL RFC.
where is the voting page?  :)

thanks

 I also changed the polls to reduce confusion between the announce and
 the actual EOL, to avoid equal results between many options.

 Thanks for your upcoming votes and let focus and 5.5+ asap :)

 Cheers,
 --
 Pierre

 @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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




-- 
Laruence  Xinchen Hui
http://www.laruence.com/

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Adam Harvey
On 12 January 2013 08:17, Ben Ramsey ram...@php.net wrote:
 I've opened voting for the array_column() function RFC.

 You can vote at https://wiki.php.net/rfc/array_column#voting

To be clear, I've voted -1 solely due to the function alias: if this
were reproposed with either name (I don't have a strong preference)
and no alias, I would be happy to switch to a +1 vote.

Adam

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



[PHP-DEV] Re: [RFC][vote] 5.3 EOL

2013-01-14 Thread Pierre Joye
Arg, sorry :)

Here you go:

https://wiki.php.net/rfc/php53eol

On Mon, Jan 14, 2013 at 10:11 AM, Pierre Joye pierre@gmail.com wrote:
 hi,

 I opened the voting phase for the 5.3 EOL RFC.

 I also changed the polls to reduce confusion between the announce and
 the actual EOL, to avoid equal results between many options.

 Thanks for your upcoming votes and let focus and 5.5+ asap :)

 Cheers,
 --
 Pierre

 @pierrejoye | http://blog.thepimp.net | http://www.libgd.org



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] [RFC][vote] 5.3 EOL

2013-01-14 Thread Adam Harvey
On 14 January 2013 17:16, Laruence larue...@php.net wrote:
 On Mon, Jan 14, 2013 at 5:11 PM, Pierre Joye pierre@gmail.com wrote:
 hi,

 I opened the voting phase for the 5.3 EOL RFC.
 where is the voting page?  :)

https://wiki.php.net/rfc/php53eol

Adam

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



Re: [PHP-DEV] strtr vs. str_replace runtime

2013-01-14 Thread Gustavo Lopes

Em 2013-01-11 0:32, Christopher Jones escreveu:


How does this compare with your baseline results?



I ran some benchmarks.
Configure line:
CC=gcc-mp-4.8 CFLAGS=-O3 -march=native ./configure --disable-all 
--host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10

CPU: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz

The text being searched is this page copy pasted: 
http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_vm_execute.h

The functions are run 30 time in a loop.

All new algorithm (branch cataphract/strtr_wu94):

Replacements: 13 total, smallest 6 largest 19
strtr: 0.1534
str_replace: 0.8625

Replacements: 14 total, smallest 1 largest 19
strtr: 0.5305
str_replace: 1.0654

Replacements: 1 total, smallest 7 largest 7
strtr: 0.1142
str_replace: 0.0985

Replacements: 2 total, smallest 7 largest 2500
strtr: 0.1165
str_replace: 0.1656

===
Old algorithm improved (branch cataphract/strtr):

Replacements: 13 total, smallest 6 largest 19
strtr: 0.8922
str_replace: 0.8606

Replacements: 14 total, smallest 1 largest 19
strtr: 1.2031
str_replace: 1.0687

Replacements: 1 total, smallest 7 largest 7
strtr: 0.4130
str_replace: 0.0991

Replacements: 2 total, smallest 7 largest 2500
strtr: 0.5886
str_replace: 0.1719

===
Current (branch master)

Replacements: 13 total, smallest 6 largest 19
strtr: 20.0317
str_replace: 0.8707
results match!

Replacements: 14 total, smallest 1 largest 19
strtr: 26.6792
str_replace: 1.1017
results match!

Replacements: 1 total, smallest 7 largest 7
strtr: 1.2030
str_replace: 0.0850
results match!

Replacements: 2 total, smallest 7 largest 2500
^C (got tired of waiting after a few minutes)

--
Gustavo Lopes

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



Re: [PHP-DEV] [RFC][vote] 5.3 EOL

2013-01-14 Thread Peter Cowburn
On 14 January 2013 09:11, Pierre Joye pierre@gmail.com wrote:

 I opened the voting phase for the 5.3 EOL RFC.


Is there any reason why this RFC was not listed on the RFC listing
page? I have added it to the In voting phase list, assuming you
merely forgot to add it anywhere.

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



Re: [PHP-DEV] FW: Functionality request/proposal

2013-01-14 Thread Ángel González
On 14/01/13 05:10, Paulo Henrique Torrens wrote:
 Hi,

 I'm currently interested in two features I'd like to see in PHP; how do I 
 proceed to request/propose them? I'd be glad to help implementing them as 
 well, if necessary.
You should propose it here and then create a rfc about it in the php
wiki, which is finally voted.


 One of them is really simple, but would be helpful to people with different 
 coding styles

 class Test {
   public function blabla() {
 // ...
   } //  the interpreter fails if there
 //   is a semicolon here, although
 //   some c++ programmers may be used
 //   to add it
 };
I don't think this is a good addition.


 And the other one would be multiple return values

 function multi() {
   return 10, 20;
 };
 function sum($a, $b) {
   return $a + $b;
 };

 echo sum(multi()); // echoes 30

 $x, $y = multi();

 echo $y; // echoes 20

Are you aware that you could use arrays here?

function multi() {
  return array(10, 20);
}

list($x, $y) = multi();

echo $y; // echoes 20


For passing to a new function it is a bit uglier but still easy:
echo call_user_func_array('sum', multi()); // echoes 30


Functions could be changed to receive the members of an array as the
different arguments, but that would conflict with passing an array as
the first argument. It would be also harder to read the code, too.


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



Re: [PHP-DEV] FW: Functionality request/proposal

2013-01-14 Thread Johannes Schlüter
On Mon, 2013-01-14 at 04:10 +, Paulo Henrique Torrens wrote:
 Hi,
 
 I'm currently interested in two features I'd like to see in PHP; how do I 
 proceed to request/propose them? I'd be glad to help implementing them as 
 well, if necessary.
 
 
 One of them is really simple, but would be helpful to people with different 
 coding styles
 
 class Test {
   public function blabla() {
 // ...
   } //  the interpreter fails if there
 //   is a semicolon here, although
 //   some c++ programmers may be used
 //   to add it

That one is wrong in C++, too. Unless you're confusing function
declarition with function definitions.

class CPPClass {
void some_declaration();
void some_definition_of_an_inline_function() {
   return;
} // No ; here
}

 };

Well, people should be aware of the language they are using ...

 And the other one would be multiple return values
 
 function multi() {
   return 10, 20;

Use
 return [10, 20];
which exists and returns an array. This is clear and quite easy to read.


 };
 function sum($a, $b) {
   return $a + $b;
 };
 
 echo sum(multi()); // echoes 30

This becomes confusing when reading.

johannes


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



Re: [PHP-DEV] FW: Functionality request/proposal

2013-01-14 Thread Sebastian Krebs
2013/1/14 Johannes Schlüter johan...@schlueters.de

 On Mon, 2013-01-14 at 04:10 +, Paulo Henrique Torrens wrote:
  Hi,
 
  I'm currently interested in two features I'd like to see in PHP; how do
 I proceed to request/propose them? I'd be glad to help implementing them as
 well, if necessary.
 
 
  One of them is really simple, but would be helpful to people with
 different coding styles
 
  class Test {
public function blabla() {
  // ...
} //  the interpreter fails if there
  //   is a semicolon here, although
  //   some c++ programmers may be used
  //   to add it

 That one is wrong in C++, too. Unless you're confusing function
 declarition with function definitions.

 class CPPClass {
 void some_declaration();
 void some_definition_of_an_inline_function() {
return;
 } // No ; here
 }

  };

 Well, people should be aware of the language they are using ...

  And the other one would be multiple return values
 
  function multi() {
return 10, 20;

 Use
  return [10, 20];
 which exists and returns an array. This is clear and quite easy to read.


  };
  function sum($a, $b) {
return $a + $b;
  };
 
  echo sum(multi()); // echoes 30

 This becomes confusing when reading.



echo array_sum(multi()); // :)



 johannes


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




-- 
github.com/KingCrunch


[PHP-DEV] Re: Fix for duplicate magic methods calls (bug #63462)

2013-01-14 Thread Dmitry Stogov
Hi Stas,

Sorry for delay, I'll able to take a look only tomorrow or after tomorrow.

Thanks. Dmitry.

On Monday, January 14, 2013, Stas Malyshev wrote:

 Hi!

 I made a fix for bug #63462 - https://github.com/php/php-src/pull/258 -
 which changes a bit how we do guards by unmangling the names before
 applying guards. This is a slight change of behavior and also means that
 all private vars with the same name would use the same guard (all
 protected and public vars with the same name are the same var anyway, so
 they should be doing it in any case).
 Since it's a behavior change in core, I'd appreciate a second pair of
 eyes to see if nothing is broken by it. All tests pass but better safe
 then sorry. If no problems found in it, I'll commit it soon.

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



[PHP-DEV] Re: [VOTE] array_column() function

2013-01-14 Thread Ben Ramsey

On 1/11/13 6:17 PM, Ben Ramsey wrote:

I've opened voting for the array_column() function RFC.

You can vote at https://wiki.php.net/rfc/array_column#voting


I have updated the pull request by removing the array_pluck() alias. I 
favor the array_column() alias, as it is more in keeping with other 
function names like array_keys() and array_values(), which do not have 
verbs in them.


If the RFC is accepted, I will submit a new pull request against the 5.5 
branch and close the current pull request against the 5.3 branch. If I 
should do that now, please let me know, and I'll go ahead and take care 
of it.


Thanks,
Ben

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



Re: [PHP-DEV] Re: [VOTE] array_column() function

2013-01-14 Thread Scott MacVicar
On 14 Jan 2013, at 11:37, Ben Ramsey ram...@php.net wrote:

 On 1/11/13 6:17 PM, Ben Ramsey wrote:
 I've opened voting for the array_column() function RFC.
 
 You can vote at https://wiki.php.net/rfc/array_column#voting
 
 I have updated the pull request by removing the array_pluck() alias. I favor 
 the array_column() alias, as it is more in keeping with other function names 
 like array_keys() and array_values(), which do not have verbs in them.
 
 If the RFC is accepted, I will submit a new pull request against the 5.5 
 branch and close the current pull request against the 5.3 branch. If I should 
 do that now, please let me know, and I'll go ahead and take care of it.

I've talked about the Facebook version of this when the key bit got added, but 
we have 2 other methods to go with it.

mpull() which does methods
https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L110

ppull() which does properties
https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L184

Not sure if these should be added separately? The property version is good for 
PDO when using FETCH_CLASS.

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



Re: [PHP-DEV] Re: [VOTE] array_column() function

2013-01-14 Thread Ben Ramsey

On 1/14/13 11:54 AM, Scott MacVicar wrote:

On 14 Jan 2013, at 11:37, Ben Ramsey ram...@php.net wrote:


On 1/11/13 6:17 PM, Ben Ramsey wrote:

I've opened voting for the array_column() function RFC.

You can vote at https://wiki.php.net/rfc/array_column#voting


I have updated the pull request by removing the array_pluck() alias. I favor 
the array_column() alias, as it is more in keeping with other function names 
like array_keys() and array_values(), which do not have verbs in them.

If the RFC is accepted, I will submit a new pull request against the 5.5 branch 
and close the current pull request against the 5.3 branch. If I should do that 
now, please let me know, and I'll go ahead and take care of it.


I've talked about the Facebook version of this when the key bit got added, but 
we have 2 other methods to go with it.

mpull() which does methods
https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L110

ppull() which does properties
https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L184

Not sure if these should be added separately? The property version is good for 
PDO when using FETCH_CLASS.

- S



I did review these, and I like them, but I think they should be added 
separately, especially since they deal more with objects than arrays.


-Ben

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



Re: [PHP-DEV] Re: [VOTE] array_column() function

2013-01-14 Thread Scott MacVicar
On 14 Jan 2013, at 12:57, Ben Ramsey ram...@php.net wrote:

 On 1/14/13 11:54 AM, Scott MacVicar wrote:
 On 14 Jan 2013, at 11:37, Ben Ramsey ram...@php.net wrote:
 
 On 1/11/13 6:17 PM, Ben Ramsey wrote:
 I've opened voting for the array_column() function RFC.
 
 You can vote at https://wiki.php.net/rfc/array_column#voting
 
 I have updated the pull request by removing the array_pluck() alias. I 
 favor the array_column() alias, as it is more in keeping with other 
 function names like array_keys() and array_values(), which do not have 
 verbs in them.
 
 If the RFC is accepted, I will submit a new pull request against the 5.5 
 branch and close the current pull request against the 5.3 branch. If I 
 should do that now, please let me know, and I'll go ahead and take care of 
 it.
 
 I've talked about the Facebook version of this when the key bit got added, 
 but we have 2 other methods to go with it.
 
 mpull() which does methods
 https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L110
 
 ppull() which does properties
 https://github.com/facebook/libphutil/blob/master/src/utils/utils.php#L184
 
 Not sure if these should be added separately? The property version is good 
 for PDO when using FETCH_CLASS.
 
 - S
 
 
 I did review these, and I like them, but I think they should be added 
 separately, especially since they deal more with objects than arrays.

As long as the work with objects that implement ArrayAccess then it should be 
fine?

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



Re: [PHP-DEV] Re: [VOTE] array_column() function

2013-01-14 Thread Anthony Ferrara
Scott,

 I did review these, and I like them, but I think they should be added
 separately, especially since they deal more with objects than arrays.

 As long as the work with objects that implement ArrayAccess then it should
 be fine?


For consistency sake, I would recommend that it does not work with objects
(even that implement ArrayAccess). Right now, the array extension (the 76+
array functions) don't accept ArrayAccess classes, so this should be no
different IMHO...

Anthony


Re: [PHP-DEV] [Reflection] Improve logic of ReflectionMethod-invokeArgs() for static methods

2013-01-14 Thread Alexander Lissachenko
My use-case is weaving aspects into the methods. Yeah! )

So, I take the original class, rename it and then create a decorator
class instead of original class with overridden dynamic and static
methods. Method in the decorator should make some specific logic and
then just invokes the original static method with Reflection, but the
scope should be also correct.

For example, previous class First will be renamed during load-time to
the First_AopProxied:

class First_AopProxied
{
public static function foo()
{
echo get_called_class();
}
}

and decorator will be created

class First extends First_AopProxied
{
public static function foo()
{
// some logic here, that should call parent method and
preserve the scope (class First)
// can not use parent::foo() here, because around advice
should be able to call this method somewhere in the closure...
}
}

2013/1/14 Sebastian Krebs krebs@gmail.com:



 2013/1/14 Alexander Lissachenko lisachenko...@gmail.com

 Hi! It's my first letter here )

 I want to suggest a small improvement for ReflectionMethod-invoke()
 and ReflectionMethod-invokeArgs() methods to support LSB for
 overridden static methods. Currently, for invoking static methods
 first argument should be null, information about class (scope) is
 taken from the reflection class. However, there is one issue that can
 not be solved at the current time.

 Suppose, we have two classes:

 class First
 {
 public static function foo()
 {
 echo get_called_class();
 }
 }

 class Second extends First
 {
 public static function foo()
 {
 echo Do not call me, please;
 }
 }

 Now I want to invoke the First::foo() method with Reflection from the
 Second class scope for using LSB. Currently this is impossible:
 $class = new ReflectionClass('First');
 $class-getMethod('foo')-invokeArgs(null, array()); // Outputs
 'First' as no scope information is passed


 $class = new ReflectionClass('Second');
 $class-getMethod('foo')-invokeArgs(null, array()); // Outputs 'Do
 not call me, please' as method is redefined

 So, there is no way now to invoke the static First::foo() method from
 the child scope because it was redefined. However, this can be easily
 implemented by adding the scope for static methods invocation (like
 Closure::bindTo()):

 $class = new ReflectionClass('First');
 $class-getMethod('foo')-invokeArgs('Second', array()); // Outputs
 'Second'

 This improvement can be very useful for building proxies for static
 methods, that use LSB. Can it be implemented for PHP 5.3-5.5? Thanks!


 Maybe it's just me, but could you explain which use-case want to solve? The
 example isn't very useful, because you can achieve this quite easy without
 reflection. Also why do you override the method, when you don't want it to
 get called? Shouldn't they two separate methods then?

 ?php
 class First
 {
 public static function foo()
 {
 echo get_called_class();
 }
 }

 class Second extends First
 {
 public static function foo()
 {
 echo Do not call me, please;
 }
 public static function bar() {
 parent::foo();
 }
 }
 Second::bar();

 http://codepad.viper-7.com/fwG5GB



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




 --
 github.com/KingCrunch

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



Re: [PHP-DEV] [Reflection] Improve logic of ReflectionMethod-invokeArgs() for static methods

2013-01-14 Thread Anthony Ferrara
Alexander,

So, I take the original class, rename it and then create a decorator
 class instead of original class with overridden dynamic and static
 methods. Method in the decorator should make some specific logic and
 then just invokes the original static method with Reflection, but the
 scope should be also correct.


I have to ask: *why*? Why are you using static methods like that? It seems
to me that you're trying to use LSB to introduce a form of polymorphism
where it's not really designed for it... Why not just use instances in this
case (which are supported for your use-case)...?

Anthony


Re: [PHP-DEV] [Reflection] Improve logic of ReflectionMethod-invokeArgs() for static methods

2013-01-14 Thread Sebastian Krebs
2013/1/14 Alexander Lissachenko lisachenko...@gmail.com

 My use-case is weaving aspects into the methods. Yeah! )

 So, I take the original class, rename it and then create a decorator
 class instead of original class with overridden dynamic and static
 methods. Method in the decorator should make some specific logic and
 then just invokes the original static method with Reflection, but the
 scope should be also correct.

 For example, previous class First will be renamed during load-time to
 the First_AopProxied:

 class First_AopProxied
 {
 public static function foo()
 {
 echo get_called_class();
 }
 }

 and decorator will be created

 class First extends First_AopProxied
 {
 public static function foo()
 {
 // some logic here, that should call parent method and
 preserve the scope (class First)
 // can not use parent::foo() here, because around advice
 should be able to call this method somewhere in the closure...
 }
 }


I must say this example is not really better than the last one (it feels
like it is exactly the same with 2 lines more comments). Also I don't know,
what you mean by call this method somewhere in the closure; which
closure?!?
I guess you are in fact looking for regular instance methods.



 2013/1/14 Sebastian Krebs krebs@gmail.com:
 
 
 
  2013/1/14 Alexander Lissachenko lisachenko...@gmail.com
 
  Hi! It's my first letter here )
 
  I want to suggest a small improvement for ReflectionMethod-invoke()
  and ReflectionMethod-invokeArgs() methods to support LSB for
  overridden static methods. Currently, for invoking static methods
  first argument should be null, information about class (scope) is
  taken from the reflection class. However, there is one issue that can
  not be solved at the current time.
 
  Suppose, we have two classes:
 
  class First
  {
  public static function foo()
  {
  echo get_called_class();
  }
  }
 
  class Second extends First
  {
  public static function foo()
  {
  echo Do not call me, please;
  }
  }
 
  Now I want to invoke the First::foo() method with Reflection from the
  Second class scope for using LSB. Currently this is impossible:
  $class = new ReflectionClass('First');
  $class-getMethod('foo')-invokeArgs(null, array()); // Outputs
  'First' as no scope information is passed
 
 
  $class = new ReflectionClass('Second');
  $class-getMethod('foo')-invokeArgs(null, array()); // Outputs 'Do
  not call me, please' as method is redefined
 
  So, there is no way now to invoke the static First::foo() method from
  the child scope because it was redefined. However, this can be easily
  implemented by adding the scope for static methods invocation (like
  Closure::bindTo()):
 
  $class = new ReflectionClass('First');
  $class-getMethod('foo')-invokeArgs('Second', array()); // Outputs
  'Second'
 
  This improvement can be very useful for building proxies for static
  methods, that use LSB. Can it be implemented for PHP 5.3-5.5? Thanks!
 
 
  Maybe it's just me, but could you explain which use-case want to solve?
 The
  example isn't very useful, because you can achieve this quite easy
 without
  reflection. Also why do you override the method, when you don't want it
 to
  get called? Shouldn't they two separate methods then?
 
  ?php
  class First
  {
  public static function foo()
  {
  echo get_called_class();
  }
  }
 
  class Second extends First
  {
  public static function foo()
  {
  echo Do not call me, please;
  }
  public static function bar() {
  parent::foo();
  }
  }
  Second::bar();
 
  http://codepad.viper-7.com/fwG5GB
 
 
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  --
  github.com/KingCrunch




-- 
github.com/KingCrunch


Re: [PHP-DEV] [Reflection] Improve logic of ReflectionMethod-invokeArgs() for static methods

2013-01-14 Thread Alexander Lissachenko
I do not use static methods, frameworks and applications use them )).

I just want to extend logic of class methods in the application with
custom behavior (Logging, Caching) and preserve original scope. It's
already done for PHP 5.4 with closures and my library works well with
any PHP framework. For 5.3 it works only for dynamic methods and
static methods without LSB.

2013/1/14 Anthony Ferrara ircmax...@gmail.com:
 Alexander,

 So, I take the original class, rename it and then create a decorator
 class instead of original class with overridden dynamic and static
 methods. Method in the decorator should make some specific logic and
 then just invokes the original static method with Reflection, but the
 scope should be also correct.


 I have to ask: *why*? Why are you using static methods like that? It seems
 to me that you're trying to use LSB to introduce a form of polymorphism
 where it's not really designed for it... Why not just use instances in this
 case (which are supported for your use-case)...?

 Anthony

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



Re: [PHP-DEV] [Reflection] Improve logic of ReflectionMethod-invokeArgs() for static methods

2013-01-14 Thread Alexander Lissachenko
Probably, it will be better to give a link to the one of examples of
AOP integration for laravel framework (requires 5.4.10 to work):
https://github.com/lisachenko/laravel-aspect (just clone, install
dependencies and look at result)

I need to perform weaving of aspects into the original methods, so
here is an example of generated source code:

?php namespace Illuminate\Foundation;

class AliasLoader__AopProxied {

// .. source code here

/**
 * Get or create the singleton alias loader instance.
 *
 * @param  array  $aliases
 * @return Illuminate\Foundation\AliasLoader
 */
public static function getInstance(array $aliases = array())
{
if (is_null(static::$instance)) static::$instance = new 
static($aliases);

$aliases = array_merge(static::$instance-getAliases(), 
$aliases);

static::$instance-setAliases($aliases);

return static::$instance;
}

/**
 * Load a class alias if it is registered.
 *
 * @param  string  $alias
 * @return void
 */
public function load($alias)
{
if (isset($this-aliases[$alias]))
{
return class_alias($this-aliases[$alias], $alias);
}
}

// more source code here
}

class AliasLoader extends AliasLoader__AopProxied
{
/**
 *Property was created automatically, do not change it manually
 */
private static $__joinPoints = array();

// some source code here

/**
 * Get or create the singleton alias loader instance.
 *
 * @param  array  $aliases
 * @return Illuminate\Foundation\AliasLoader
 */
public static function getInstance(array $aliases = array())
{
return 
self::$__joinPoints['static:getInstance']-__invoke(get_called_class(),
array($aliases));
}

/**
 * Load a class alias if it is registered.
 *
 * @param  string  $alias
 * @return void
 */
public function load($alias)
{
return self::$__joinPoints['method:load']-__invoke($this,
array($alias));
}

// some source code here
}

You can notice, that original class name is pointing to the decorator
class after weaving. Source code still use $class = new AliasLoader(),
but the class now contains additional logic that was introduced by
aspects.

2013/1/14 Sebastian Krebs krebs@gmail.com:



 2013/1/14 Alexander Lissachenko lisachenko...@gmail.com

 My use-case is weaving aspects into the methods. Yeah! )

 So, I take the original class, rename it and then create a decorator
 class instead of original class with overridden dynamic and static
 methods. Method in the decorator should make some specific logic and
 then just invokes the original static method with Reflection, but the
 scope should be also correct.

 For example, previous class First will be renamed during load-time to
 the First_AopProxied:

 class First_AopProxied
 {
 public static function foo()
 {
 echo get_called_class();
 }
 }

 and decorator will be created

 class First extends First_AopProxied
 {
 public static function foo()
 {
 // some logic here, that should call parent method and
 preserve the scope (class First)
 // can not use parent::foo() here, because around advice
 should be able to call this method somewhere in the closure...
 }
 }


 I must say this example is not really better than the last one (it feels
 like it is exactly the same with 2 lines more comments). Also I don't know,
 what you mean by call this method somewhere in the closure; which
 closure?!?
 I guess you are in fact looking for regular instance methods.



 2013/1/14 Sebastian Krebs krebs@gmail.com:
 
 
 
  2013/1/14 Alexander Lissachenko lisachenko...@gmail.com
 
  Hi! It's my first letter here )
 
  I want to suggest a small improvement for ReflectionMethod-invoke()
  and ReflectionMethod-invokeArgs() methods to support LSB for
  overridden static methods. Currently, for invoking static methods
  first argument should be null, information about class (scope) is
  taken from the reflection class. However, there is one issue that can
  not be solved at the current time.
 
  Suppose, we have two classes:
 
  class First
  {
  public static function foo()
  {
  echo get_called_class();
  }
  }
 
  class Second extends First
  {
  public static function foo()
  {
  echo Do not call me, please;
  }
  }
 
  Now I want to invoke the First::foo() method with Reflection from the
  Second class scope for using LSB. Currently this is impossible:
  $class = new ReflectionClass('First');
  $class-getMethod('foo')-invokeArgs(null, array()); // Outputs
  'First' as no scope information is passed
 
 
  $class = new ReflectionClass('Second');
  $class-getMethod('foo')-invokeArgs(null, array()); // 

Re: [PHP-DEV] Bug #23815: Added extra ImageCopyMergeAlpha function

2013-01-14 Thread Lars Strojny
Any news?

Am 04.01.2013 um 13:45 schrieb Pierre Joye pierre@gmail.com:

 No need to create another function for that. I will do it once I am back at
 work next week.
 On Jan 3, 2013 12:33 PM, Lars Strojny l...@strojny.net wrote:
 
 No objection from my POV. Going to merge it in around a week, if no one
 objects.
 
 Am 02.01.2013 um 10:35 schrieb matt clegg cleggm...@gmail.com:
 
 I have added ImageCopyMergeAlpha as an extra function to resolve bug
 23815.
 
 I have created a pull request on github
 https://github.com/php/php-src/pull/211
 
 Can this be merged into 5.5? And, what do I need to do?
 
 --
 
 
 Matt Clegg
 
 --http://mattclegg.com/
 
 
 --
 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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Herman Radtke
On Sat, Jan 12, 2013 at 12:04 AM, Levi Morrison morrison.l...@gmail.com wrote:
 The real problem here (in my opinion) is that `array_filter` does not
 pass the key information to the callback. If you could do that, you
 could select columns that way.

I opened a PR with this feature, but it was rejected.

-- 
Herman Radtke
@hermanradtke | http://hermanradtke.com

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Lars Strojny
Nope, it wasn’t rejected, there was simply no response for a really long time: 
https://github.com/php/php-src/pull/202

Am 14.01.2013 um 22:06 schrieb Herman Radtke hermanrad...@gmail.com:

 On Sat, Jan 12, 2013 at 12:04 AM, Levi Morrison morrison.l...@gmail.com 
 wrote:
 The real problem here (in my opinion) is that `array_filter` does not
 pass the key information to the callback. If you could do that, you
 could select columns that way.
 
 I opened a PR with this feature, but it was rejected.
 
 -- 
 Herman Radtke
 @hermanradtke | http://hermanradtke.com
 
 -- 
 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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Pierre Joye
hi!

Btw, really willing to have this function but I agree with other here,
the alias must go. It makes no sense to introduce a function and an
alias to it at the same time.

Maybe restart the vote and let choose function name.

Options:
1. array_column
2. array_pluck
3. none of them

Thanks for your work!

On Sat, Jan 12, 2013 at 1:17 AM, Ben Ramsey ram...@php.net wrote:
 I've opened voting for the array_column() function RFC.

 You can vote at https://wiki.php.net/rfc/array_column#voting

 Regards,
 Ben

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




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] strtr vs. str_replace runtime

2013-01-14 Thread Gustavo Lopes
On Wed, 09 Jan 2013 23:45:03 +0100, Gustavo Lopes glo...@nebm.ist.utl.pt  
wrote:


On Thu, 03 Jan 2013 11:40:31 +0100, Gustavo Lopes  
glo...@nebm.ist.utl.pt wrote:


The algorithm behaves very poorly in this case because at each position  
of the text, all the substrings starting there and with size between m  
and n (where m is the size of the smallest pattern and n is the  
largest) are checked, even if there are only two patterns with size m  
and n. We could fix this easily by building a set of the pattern sizes  
found and try only with those. The hashing of the substrings could also  
be improved; we don't have to recalculate everything when we advance in  
the text.




Both optimizations (the hash rolling and limiting the substrings hashed  
on each iteration) worked quite well.


But I got much better results with another algorithm [1], so I'm going  
to merge the branch with it [2] instead.


OK, so now the plan is to merge this onto 5.4:

https://github.com/cataphract/php-src/compare/php:PHP-5.4...cataphract:strtr_wu94_54

And this to 5.5:

https://github.com/cataphract/php-src/compare/php:PHP-5.5...cataphract:strtr_wu94_55

The difference is that the 5.4 version does not introduce zend_qsort_r()  
and instead has dedicated simple heap sort.


Any thoughts on this?

--
Gustavo Lopes

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Ben Ramsey

On 1/14/13 3:49 PM, Pierre Joye wrote:

hi!

Btw, really willing to have this function but I agree with other here,
the alias must go. It makes no sense to introduce a function and an
alias to it at the same time.

Maybe restart the vote and let choose function name.

Options:
1. array_column
2. array_pluck
3. none of them

Thanks for your work!


I've already removed the array_pluck() alias. Unfortunately, after 
removing the alias, it appears that some have changed their votes from 
yes to no, because they preferred the other function name.


That said, I'm not going to call for a vote on the function name at this 
time. The predominant sentiment on the list was for it to have one 
function name or the other, but not both, so I've updated the pull 
request accordingly.


-Ben


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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Pierre Joye
On Mon, Jan 14, 2013 at 11:01 PM, Ben Ramsey ram...@php.net wrote:

 I've already removed the array_pluck() alias. Unfortunately, after removing
 the alias, it appears that some have changed their votes from yes to no,
 because they preferred the other function name.

 That said, I'm not going to call for a vote on the function name at this
 time. The predominant sentiment on the list was for it to have one function
 name or the other, but not both, so I've updated the pull request
 accordingly.

Up to you, but I'd to suggest again to re do the vote and add the
naming option, easy, clear, open.

Cheers,
--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Lars Strojny
Hi Ben,

Am 14.01.2013 um 23:16 schrieb Pierre Joye pierre@gmail.com:
[...]
 Up to you, but I'd to suggest again to re do the vote and add the
 naming option, easy, clear, open.

I was one of the people changing from yes to no because of the name. I like the 
functionality but I prefer no new array function over one with yet another 
strange name.

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Gustavo Lopes
On Mon, 14 Jan 2013 23:16:52 +0100, Pierre Joye pierre@gmail.com  
wrote:



On Mon, Jan 14, 2013 at 11:01 PM, Ben Ramsey ram...@php.net wrote:

I've already removed the array_pluck() alias. Unfortunately, after  
removing the alias, it appears that some have changed their votes from  
yes to no, because they preferred the other function name.


That said, I'm not going to call for a vote on the function name at this
time. The predominant sentiment on the list was for it to have one  
function name or the other, but not both, so I've updated the pull  
request

accordingly.


Up to you, but I'd to suggest again to re do the vote and add the
naming option, easy, clear, open.



I don't think either easier or clear. Then all sort of questions come up  
if none of the three options has an absolute majority. And if you open two  
separate and concurrent votes you're taking from people the power to  
condition the vote on a specific choice of name.


Personally, I don't care about the name as long as only one is chosen (no  
alias).


--
Gustavo Lopes

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Lars Strojny
It’s quite simple: 

 - Do you want to include the functionality: yes/no
 - If you want to include it, which name should it have: 
array_column/array_pluck

Am 14.01.2013 um 23:23 schrieb Gustavo Lopes glo...@nebm.ist.utl.pt:

 On Mon, 14 Jan 2013 23:16:52 +0100, Pierre Joye pierre@gmail.com wrote:
 
 On Mon, Jan 14, 2013 at 11:01 PM, Ben Ramsey ram...@php.net wrote:
 
 I've already removed the array_pluck() alias. Unfortunately, after removing 
 the alias, it appears that some have changed their votes from yes to 
 no, because they preferred the other function name.
 
 That said, I'm not going to call for a vote on the function name at this
 time. The predominant sentiment on the list was for it to have one function 
 name or the other, but not both, so I've updated the pull request
 accordingly.
 
 Up to you, but I'd to suggest again to re do the vote and add the
 naming option, easy, clear, open.
 
 
 I don't think either easier or clear. Then all sort of questions come up if 
 none of the three options has an absolute majority. And if you open two 
 separate and concurrent votes you're taking from people the power to 
 condition the vote on a specific choice of name.
 
 Personally, I don't care about the name as long as only one is chosen (no 
 alias).
 
 -- 
 Gustavo Lopes
 
 -- 
 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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Gustavo Lopes

On Mon, 14 Jan 2013 23:43:31 +0100, Lars Strojny l...@strojny.net wrote:


 - Do you want to include the functionality: yes/no
 - If you want to include it, which name should it have:  
array_column/array_pluck


? You said earlier:


I was one of the people changing from yes to no because
of the name. I like the functionality but I prefer no
new array function over one with yet another strange name.


You realize you cannot express this choice under the setup you proposed  
right? That is why processes that include a general vote followed by  
amendments or other detail decisions (like you propose) usually include a  
final global vote at the end.


--
Gustavo Lopes

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Matt Pelmear

On 01/14/2013 02:19 PM, Lars Strojny wrote:

Hi Ben,

Am 14.01.2013 um 23:16 schrieb Pierre Joye pierre@gmail.com:
[...]

Up to you, but I'd to suggest again to re do the vote and add the
naming option, easy, clear, open.

I was one of the people changing from yes to no because of the name. I like the 
functionality but I prefer no new array function over one with yet another 
strange name.

cu,
Lars


You'd rather the new method misuse the meaning of the word pluck over 
following an established convention within it's own environment that is 
meaningful?
If it is called array_pluck it should remove the data in question from 
the original array. (I'm not saying that is a desirable feature here, 
I'm just saying that makes more sense based on the meaning of the name 
you seem to prefer.)
If there's a problem with the array functions not being verbs (which, 
personally, I don't think is a huge issue as long as it is consistent), 
that should be addressed for the array functions as an entire set-- not 
for one particular one.



Re: the vote:
There is no point in redoing the vote at this point. If the vote does 
not pass as it is, that means either the community doesn't support the 
new feature or they don't support the proposed function name.
It's obvious, based on the current vote results, that the community does 
support the feature, so it is simply a matter of issuing a second vote 
if this one fails.



-Matt


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



Re: [PHP-DEV] strtr vs. str_replace runtime

2013-01-14 Thread Christopher Jones



On 01/14/2013 01:55 PM, Gustavo Lopes wrote:

On Wed, 09 Jan 2013 23:45:03 +0100, Gustavo Lopes glo...@nebm.ist.utl.pt 
wrote:


On Thu, 03 Jan 2013 11:40:31 +0100, Gustavo Lopes glo...@nebm.ist.utl.pt 
wrote:


The algorithm behaves very poorly in this case because at each position of the 
text, all the substrings starting there and with size between m and n (where m 
is the size of the smallest pattern and n is the largest) are checked, even if 
there are only
two patterns with size m and n. We could fix this easily by building a set of 
the pattern sizes found and try only with those. The hashing of the substrings 
could also be improved; we don't have to recalculate everything when we advance 
in the text.



Both optimizations (the hash rolling and limiting the substrings hashed on each 
iteration) worked quite well.

But I got much better results with another algorithm [1], so I'm going to merge 
the branch with it [2] instead.


OK, so now the plan is to merge this onto 5.4:

https://github.com/cataphract/php-src/compare/php:PHP-5.4...cataphract:strtr_wu94_54

And this to 5.5:

https://github.com/cataphract/php-src/compare/php:PHP-5.5...cataphract:strtr_wu94_55

The difference is that the 5.4 version does not introduce zend_qsort_r() and 
instead has dedicated simple heap sort.

Any thoughts on this?



Despite temptation, I'm still erring on the side of merging to 5.5+
only.  My argument is based on the potential for regressions (behavior
and performance), added code maintenance issues, merge effort etc.
The ability to differentiate the benefits of PHP 5.5 over 5.4, and
promote migration to 5.5 will also be improved.

Chris

--
christopher.jo...@oracle.com  http://twitter.com/ghrd
Newly updated, free PHP  Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

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



[PHP-DEV] PHP 5.4.10 can not build Zend/PHP parsers with bison 2.6.5

2013-01-14 Thread Dennis Clarke

Dear PHP/Zend folks : 

This is a bug I think. I recently saw that PHP had been updated to 5.4.10 
and I 
decided to update my php bits in /usr/local. I was quite surprised to see in 
the 
configure output this warning about bison :

checking for bison... bison -y
checking for bison version... invalid
configure: WARNING: bison versions supported for regeneration of the Zend/PHP 
parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 
2.6 2.6.1 2.6.2 (found: 2.6.5).

This seems odd to me as bison 2.6.5 builds and tests perfectly on my 
Solaris 10 
server and so therefore I wonder what these PHP folks are on about?  Is this a 
Warning
or a real configure fault?  If the latter then I need to backout bison in order 
to build
PHP and then re-install a perfectly functional bison ? 

Dennis Clarke 

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



RE: [PHP-DEV] FW: Functionality request/proposal

2013-01-14 Thread Paulo Henrique Torrens
Ok, let me try again.




Yeah, I know the C++ standard don't allow that semi-colon there... but both GCC 
and CLang won't complain if you add it there, and GCC accepts it even in Java. 
I've seem lots of code where people put it there, and I always get a little 
frustrated when using PHP because I'm used on adding it (without even 
noticing), and my code keeps failing because of that.

Wouldn't hurt to make the parser simply ignore it. =P






Know, about the multiple returns...
Ruby and Lua let you return multiple values... why won't PHP allow you?
Usually it's best to return an array, I totally agree, but I was working on a 
Lisp-like parser for PHP yesterday and it would really help me for two 
expressions to be returned from a single function, since I'm using tail 
recursion and on a few cases I needed to add two values to an array.

You guys will tell me to use something like flatten(), probably 
RecursiveArrayIterator or stuff, but... for future implementations, that 
multiple return would help. =P





Better?




Date: Mon, 14 Jan 2013 14:48:08 +0100
Subject: Re: [PHP-DEV] FW: Functionality request/proposal
From: krebs@gmail.com
To: johan...@schlueters.de
CC: paulo_torr...@hotmail.com; internals@lists.php.net




2013/1/14 Johannes Schlüter johan...@schlueters.de

On Mon, 2013-01-14 at 04:10 +, Paulo Henrique Torrens wrote:

 Hi,



 I'm currently interested in two features I'd like to see in PHP; how do I 
 proceed to request/propose them? I'd be glad to help implementing them as 
 well, if necessary.





 One of them is really simple, but would be helpful to people with different 
 coding styles



 class Test {

   public function blabla() {

 // ...

   } //  the interpreter fails if there

 //   is a semicolon here, although

 //   some c++ programmers may be used

 //   to add it



That one is wrong in C++, too. Unless you're confusing function

declarition with function definitions.



class CPPClass {

void some_declaration();

void some_definition_of_an_inline_function() {

   return;

} // No ; here

}



 };



Well, people should be aware of the language they are using ...



 And the other one would be multiple return values



 function multi() {

   return 10, 20;



Use

 return [10, 20];

which exists and returns an array. This is clear and quite easy to read.





 };

 function sum($a, $b) {

   return $a + $b;

 };



 echo sum(multi()); // echoes 30



This becomes confusing when reading.


echo array_sum(multi()); // :)
 




johannes





--

PHP Internals - PHP Runtime Development Mailing List

To unsubscribe, visit: http://www.php.net/unsub.php





-- 
github.com/KingCrunch 

  

Re: [PHP-DEV] PHP 5.4.10 can not build Zend/PHP parsers with bison 2.6.5

2013-01-14 Thread Christopher Jones



On 01/14/2013 05:16 PM, Dennis Clarke wrote:


Dear PHP/Zend folks :

 This is a bug I think. I recently saw that PHP had been updated to 5.4.10 
and I
decided to update my php bits in /usr/local. I was quite surprised to see in the
configure output this warning about bison :

checking for bison... bison -y
checking for bison version... invalid
configure: WARNING: bison versions supported for regeneration of the Zend/PHP 
parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 
2.6 2.6.1 2.6.2 (found: 2.6.5).

 This seems odd to me as bison 2.6.5 builds and tests perfectly on my 
Solaris 10
server and so therefore I wonder what these PHP folks are on about?  Is this a 
Warning
or a real configure fault?  If the latter then I need to backout bison in order 
to build
PHP and then re-install a perfectly functional bison ?

Dennis Clarke



Unless you are hacking PHP you can ignore Bison. Check the Makefile
for where it is used.  The PHP distribution contains
Zend/zend_language_parser.[ch] and php-5.5/Zend/zend_ini_parser.[ch]
already built from their respective .y files so bison is not
generally invoked when building PHP.

Of course, if 2.6.5 is verified than it should be added to
bison_version_list in Zend/acinclude.m4.  Feel free to regenerate the
parsers with it, review the test suite results, and create a github
pull request.

Chirs

--
christopher.jo...@oracle.com  http://twitter.com/ghrd
Newly updated, free PHP  Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

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



Re: [PHP-DEV] strtr vs. str_replace runtime

2013-01-14 Thread Stas Malyshev
Hi!

 OK, so now the plan is to merge this onto 5.4:
 
 https://github.com/cataphract/php-src/compare/php:PHP-5.4...cataphract:strtr_wu94_54

This one looks mostly harmless, so if all strtr tests still pass I think
it's OK for 5.4.

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

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Herman Radtke
 If it is called array_pluck it should remove the data in question from the
 original array. (I'm not saying that is a desirable feature here, I'm just
 saying that makes more sense based on the meaning of the name you seem to
 prefer.)

Why do you think pluck is destructive? In most examples I have come
across it merely 'plucks' a certain key from a dictionary and does so
in a way that does not modify the original dictionary.

Sources:
Underscore.js - http://documentcloud.github.com/underscore/#pluck
Rails - http://apidock.com/rails/ActiveRecord/Calculations/pluck
Python example: http://stackoverflow.com/questions/9816545/pluck-in-python

-- 
Herman Radtke
@hermanradtke | http://hermanradtke.com

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



Re: [PHP-DEV] [VOTE] array_column() function

2013-01-14 Thread Matt Pelmear

On 01/14/2013 10:12 PM, Herman Radtke wrote:

If it is called array_pluck it should remove the data in question from the
original array. (I'm not saying that is a desirable feature here, I'm just
saying that makes more sense based on the meaning of the name you seem to
prefer.)

Why do you think pluck is destructive? In most examples I have come
across it merely 'plucks' a certain key from a dictionary and does so
in a way that does not modify the original dictionary.

Sources:
Underscore.js - http://documentcloud.github.com/underscore/#pluck
Rails - http://apidock.com/rails/ActiveRecord/Calculations/pluck
Python example: http://stackoverflow.com/questions/9816545/pluck-in-python



Sources:
1. google:define: pluck
Take hold of (something) and quickly *remove* it from it's place
2. http://www.merriam-webster.com/dictionary/pluck
to pull or *pick* off or *out*
3. http://www.thefreedictionary.com/pluck
To *remove* or detach ...

Emphasis added. The connotation of the word is that something is 
*removed* from it's original place.


Just because other languages/frameworks have made a poor naming choices 
doesn't mean PHP should too. In this case, there is already an 
alternatively proposed method name which is more obvious way to name the 
method that fits within the established PHP conventions.



I'm picky about naming things. :-)

-Matt



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