[PHP-DEV] XOR congruentation breaks PHP

2009-03-02 Thread Kenan R Sulayman
Hey Folks!

I've been writing some code for a small project and saw PHP crashing every
time.

The Code:

?php
/*
 * XOR buffer v1
 */
class XoRb {
/* Set buffer ( - write genPad to file ) in bit */
public $buffer = 4096;

public function encrypt($InputString, $KeyPhrase){
$KeyPhraseLength = strlen($KeyPhrase);
for ($i = 0, $strlen = strlen($InputString); $i 
$strlen; $i++)
$InputString[$i] = chr( (
ord($InputString[$i]) ^ ord( $KeyPhrase[ ( $i % $KeyPhraseLength ) ] ) ) );
return $InputString;
}
public function genPad ( $input ) {
for ( $i = 1, $o = null, $strlen = strlen($input);
$i = $strlen; ++$i )
$o .= chr( mt_rand( 10, 300 ) );
return $o;
}
public function writePad ( $file, $byte, $buffer = false ) {
$fo = fopen( $file, a+);
if ( !$buffer ) $buffer = $this - buffer;
if ( $byte  $buffer ) $buffer = $byte;
for ( $i = 1, $o = null; $i = $byte; ++$i ) {
$o .= chr( mt_rand( 10, 300 ) );
if ( strlen( $o ) = $buffer + 20 )
print Writing buffer  . chr ( $i %
$buffer ) . \n and fwrite( $fo, $o ) and $o = null;
}
}
}
$xor = new XoRb;

$xor - buffer = 1024;
$xor - writePad ( 'int.dat', 8192 * 1000 );

/* //Interface
while ( true ) {
print Input: ;
$input = trim(fgets(fopen(php://stdin, a+)));
print \tPad:  . ($str = $xr-genPad($input));
print \n\tOutput:  . $xr-encrypt($input, $str) .
\n\n;
}
*/
?

PHP now breaks at:
  chr ( $i % $buffer ) ,
in:
if ( strlen( $o ) = $buffer + 20 ) print Writing buffer  . chr ( $i %
$buffer ) . \n and fwrite( $fo, $o ) and $o = null;
while $I = 5k ± 2k.


Tested within CLI on Windows, I don't think, it'll break on Linux, nor
Apple.

--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


Re: [PHP-DEV] XOR congruentation breaks PHP

2009-03-02 Thread Kenan R Sulayman
Hello Christopher!

It crashes now at $i = 40k ± 5k, while ( 5k ~ 0.5 second ).
Rather ugly, isn't it ?

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/3/2 Christopher Jones christopher.jo...@oracle.com



 Kenan R Sulayman wrote:

 Hey Folks!

 I've been writing some code for a small project and saw PHP crashing every
 time.


 Please test the latest snapshot from http://snaps.php.net/.  If the
 problem
 still exists, log a bug at http://bugs.php.net/ with version and platform
 details.

 --
 Email: christopher.jo...@oracle.com  Tel: +1 650 506 8630
 Twitter:  http://twitter.com/ghrdFree PHP Book:
 http://tinyurl.com/UGPOM



Re: [PHP-DEV] Re: Throwing E_DEPRECATED on startup

2009-02-06 Thread Kenan R Sulayman
All right!I think, there win't be any rejections.
Let's deploy it ;-D

2009/2/6 Kalle Sommer Nielsen ka...@php.net

 2009/2/6 Kalle Sommer Nielsen ka...@php.net:
  G'day
 
  [snip]
 
  --
  Kalle Sommer Nielsen
 

 Resending the patch, as Felipe said it wasn't there for some odd
 reason because of the file extension and for the sake of sanity:

 http://paste2.org/p/142865 - PHP_5_3
 http://paste2.org/p/142866 - HEAD



 --
 Kalle Sommer Nielsen

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



Re: [PHP-DEV] Windows 7 test passed

2009-02-05 Thread Kenan R Sulayman
 Danke Mario, für den Hinweis ! 

Hi all,
Just for notice:
Windoozer7 has been compiled against the rules of VC9.
That means:
-VC9 is. going to run natively,
-VC6 Apps are embedded ( emulated ),
-therefore some kernel Apps have to be rewritten.

Thanks!
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/2/5 Richard Quadling rquadl...@googlemail.com

 Thanks. This basically confirms that my VM was screwed.

 2009/2/5 Mario Brandt m...@nasa30.com:
  Hi,
  a bit down I wrote that the VS6 build runs. I took the snapshot from
  2009-Feb-04 22:00:00
  Tested the module and CLI. Both run fine, but the SQLite extension not.
 
  Mario
 
  -Ursprüngliche Nachricht-
  Von: Richard Quadling [mailto:rquadl...@googlemail.com]
  Gesendet: Do 05.02.2009 01:10
  An: Mario Brandt
  Cc: internals@lists.php.net
  Betreff: Re: [PHP-DEV] Windows 7 test passed
 
  2009/2/4 Mario Brandt m...@nasa30.com:
 
 
  The VS9 cli (snapshot from 2009-Feb-04 23:00:00 thread safe)runs. I only
 tested some small OOP scripts.
  There is no need to install the M$ 2008 C++ Runtime ;-) but I guess you
 already knew that.
 
  regards
  Mario
 
  Does the VC6 builds work?
 
 
 
  -Ursprüngliche Nachricht-
  Von: Richard Quadling [mailto:rquadl...@googlemail.com]
  Gesendet: Do 05.02.2009 00:31 AM
  An: Mario Brandt
  Betreff: Re: [PHP-DEV] Windows 7 test passed
 
  Can you try the CLIs?
 
  2009/2/4 Mario Brandt m...@nasa30.com:
  From the snapshop page:
  the VS6 thread safe from 2009-Feb-04 22:00:00 runs.
 
  in the VS9 thread safe package there was no php5apache2_2.dll
  also in the QA download page was no module.
 
  Mario
 
 
 
 
 
  --
  -
  Richard Quadling
  Zend Certified Engineer :
 http://zend.com/zce.php?c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!
 
 



 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!

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




Re: [PHP-DEV] casting doubles to ints

2009-02-04 Thread Kenan R Sulayman
Hi Lain!

As much as I did understand, this might be a pretty good idea.
Anyhow, you want to make this variable to be constant?

I think, this might break some calculations.-

And another question:
Does anyone knows, why PHP is showing 2147483647 as PHP_INT_MAX ? *truly,
I'm running x64*

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/2/4 Iain Lewis ile...@uk.ibm.com

 Hello all,

 I wanted to suggest back porting the behaviour of the DVAL_TO_LVAL macro
 from zend_operators.h from 5.3 to 5.2, and wondered whether people thought
 this was a good idea or not?

 The reason I want to do this is that while writing some tests, I noticed
 that the behaviour of casting a float to an int is a bit counter-intuitive
 on 64bit platforms for PHP 5.2. It looks as though this has been fixed in
 5.3, and it would seem like a good idea to put this change back to 5.2 as
 well. From a personal point of view, it would mean I could write one test
 that would work on both 5.2 and 5.3, but it also seems like a sensible
 change, as the current behaviour is non-obvious. The change would cause some
 current tests to break, but I am happy to do the work to fix those up.

 This is how a few expressions get evaluated at the moment. Changing the
 macro would make the 5.2 behaviour match 5.3

 Expression  5.3 (RHEL5-64)   5.2 (RHEL5-64)

 (int) (PHP_INT_MAX) 9223372036854775807  9223372036854775807
 (int) (PHP_INT_MAX + 1) 9223372036854775807 -9223372036854775808
 (int) (PHP_INT_MAX + 1000)  9223372036854775807 -9223372036854775808
 (int) (PHP_INT_MAX + 1) 9223372036854775807 -9223372036854765568

 Does this seem like a good change?

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




Re: [PHP-DEV] substr passing null...

2009-01-28 Thread Kenan R Sulayman
Why don't make the function return FALSE if parameter equals NULL ?

--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/1/28 Paul Biggar paul.big...@gmail.com

 On Wed, Jan 28, 2009 at 6:39 PM, Dan d...@dancryer.com wrote:
 
  You're assumption is wrong then, NULL isn't treated as not passing a
  value. The reason it worked with substr was by pure chance.
 
 
  Out of interest, is there a reason that that is the case? Surely passing
  null would be best treated as the same as passing nothing?

 NULL is a value. There is no way to tell that when you pass NULL, you
 actually intended to pass nothing and use the default value.

 Paul


 --
 Paul Biggar
 paul.big...@gmail.com

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




Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
Thanks,

I did propose the function because the construction in user-land is quite
expensive;
Actually tests showed: the user-land algorithm of mapping these objects
(regarding a count of thousand; up to a half million objects / iterations)
took 0,2 - 70 seconds to execute!

Therefore: I would be very, very gracefully, if someone may implement this
thing into the PHP engine.

Thanks!
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/1/21 Guilherme Blanco guilhermebla...@gmail.com

 setAcessible() is the way to go!

 Doctrine 2.0 took advantage of it to be able to move to a completely
 VO mapping of models. =)

 Cheers,

 On Wed, Jan 21, 2009 at 5:43 AM, Sebastian Bergmann
 s...@sebastian-bergmann.de wrote:
  Etienne Kneuss schrieb:
  Why can't you use Reflection in this case? It looks like you can quite
  easily implement that in userland from Reflection.
 
   Especially using setAcessible() which was added in PHP 5.3.
 
  --
  Sebastian Bergmann
 http://sebastian-bergmann.de/
  GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
 
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Guilherme Blanco - Web Developer
 CBC - Certified Bindows Consultant
 Cell Phone: +55 (16) 9215-8480
 MSN: guilhermebla...@hotmail.com
 URL: http://blog.bisna.com
 São Paulo - SP/Brazil

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




Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
First: I'd understand, I've to build the caching system on my own;
Second: I'd vote for speeding up Reflection.

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry

2009/1/21 Nathan Rixham nrix...@gmail.com

 Christian Schneider wrote:

 Lukas Kahwe Smith wrote:

 On 21.01.2009, at 12:00, Karsten Dambekalns wrote:

  On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote:

 I did propose the function because the construction in user-land is
 quite
 expensive;

 Reflection is expensive, indeed. The way we solved it for FLOW3 is to
 create a ReflectionService that caches such information as long as the
 source doesn't change.

 yeah its a general problem .. but so far the decision has been that we
 should move away from adding more and more functions/methods for highly
 specialized cases (as in not continue in the get_class() etc. approach).
 now speeding up reflections is a very real issue .. suggestions in this
 regard are quite welcome. maybe offering a cache service as part of core
 is one approach ..


 Yes, please. Keep clutter out of the engine especially for stuff which
 should not be used often. If you are relying on Reflection to be fast
 for you everyday code then you're IMHO doing something weird and it is
 ok that you have to write your own caching for it (-:C


 seems to me that many of the new requests coming in, including my own
 stupid ones are because people want to build fast decent orm's in php - a
 definitive list of what one needs to make an orm in php, the userland
 approaches possible, what could be implemented in php and what couldn't
 might be good. address the whole thing in a oner.

 quite sure the requests and need is only going to grow.. imho it's being
 encouraged by the increasing numbers using PDO - it kind of suggests
 building an orm :p

 also, very unlike me, but a service to cache reflection classes is quick
 and simple to implement in userland - (although if there is a free speed up
 to reflection going I'll 'ave some)


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




[PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Kenan R Sulayman
Hi,
I'd like to propose a new function: spl_class_vars / params / contents.

Notice: I haven't figured out a name yet  Please help me find one.. :-)

The function returns an array of the contents of the given class-object.
The class-object parameter may be text or rather directly the object ( new
foo() ).

Example, while the function-name 'spl_class_contents' is being used :
?php
class foo {
public $data = array();
public $lastbit = null;
public $passive = null;
public static $bar = null;
public $foo = true;

public function registerCall ( $key, $call, $passive =
false ) {
return $this -foo;
}

private static function bregisterCall ( $key, $call,
$passive = false ) {
return $this -foo;
}
}
print_r ( spl_class_contents( 'foo' ) );
print_r ( spl_class_contents( new foo() ) );
?

Expected
Ex. 1:
?php
print_r ( spl_class_contents( 'foo' ) );
?
should return the following array: ( print_r 'd, cause the returning value
should be usable for other functions )

Array
(
[data] = Array
(
[0] = public
[1] = array
)
[lastbit] = Array
(
[0] = public
[1] = null
)
[passive] = Array
(
[0] = static
[1] = null
)
[foo] = Array
(
[0] = public
[1] = true
)
[registerCall] = Array
(
[0] = public
[function] = Array
(
[0] = key
[1] = call
[passive] = false
)
)
)

Ex.2.
Example 2 should return the same as the above example.

Cheers,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


[PHP-DEV] Compatibility of PHP 5.3 and PHP 6.0 against Windows 7

2009-01-14 Thread Kenan R Sulayman
Hey Folks!
Since I am a tester of Windows 7, I took the time to run several thousand
test to prove the compatibility.
Apart from amazingly less required changes at the side of the user, it ran
fluently.

I'm looking forward to continue the testing at this platform.

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry
http://kkooporation.de/


[PHP-DEV] PHP compiling

2008-12-31 Thread Kenan R Sulayman
Hey Folks!
I've got a error in compiling PHP ( 5.3+ ) (or executing the compiled PHP
bin).
It occurs with including php_xdebug.dll (alt. known as xDebug Server ).

When executing the compiled binary of PHP.

Any suggestions?

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry
http://MyJurnal.tk/


[PHP-DEV] PHP Unavailable

2008-12-28 Thread Kenan R Sulayman
Hey Folks!

I've been working with Zend Studio.
Since I've uninstalled the suite, PHP is exiting with:
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)

I can't even start PHP - Zip versions ..

XAMPP works perfectly ... excluding PHP, it doesn't parse PHP-code anymore,
it shows the source ... (unparsed :-S)

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry
http://MyJurnal.tk/


Re: [PHP-DEV] Implode() FR and Patch

2008-12-06 Thread Kenan R Sulayman
Dear Igor,
that's a really great feature!

A question: hasn't the new one got a better performance ?

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry
http://MyJurnal.tk/


Re: [PHP-DEV] Implode() FR and Patch

2008-12-06 Thread Kenan R Sulayman
Dear Igor,
in local tests, here on my server, the performance was,
every time I did it, at least 0.02 Second up to 0.1 Second faster than the
origin.

I'd appreciate, if this feature got included into the next build.

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry
http://MyJurnal.tk/


Re: [PHP-DEV] Implode() FR and Patch

2008-12-06 Thread Kenan R Sulayman
I'd appreciate it*


Re: [PHP-DEV] Anonymous Function

2008-11-22 Thread Kenan R Sulayman
Dear Kalle,
Thank you, too - for these nice references.

Your,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


[PHP-DEV] Anonymous Function

2008-11-21 Thread Kenan R Sulayman
Hey out there!
I've got a maybe simple question:
Where the point of not implementing anonymous functions in php alike
javascript?

Par example:
As normally used:
?
$c = create_function(~, ~);
?
Suggestion:
?
$c = function (~) { ~ }
?

 More Simple, have a better point of view and a bit easier. 

Your,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


Re: [PHP-DEV] Anonymous Function

2008-11-21 Thread Kenan R Sulayman
Well, then excuse moi!
I did not realize the power of php 5.3, yet.

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


Re: [PHP-DEV] [PATCH] bracketed namespace declarations

2008-11-07 Thread Kenan R Sulayman
Hey there!

Why don't you try an implementation as:

 namespace foo;

(contents xyz)

namespace foob;

(contents xyz of as second called namespace)


Wouldn't it be easier to make such an application tree instead of using the
normal bracket-like opening?

Your,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


Re: [PHP-DEV] An optimization idea

2008-11-06 Thread Kenan R Sulayman
Hi,
I'd completely agree with that patch - it's very useful for me since I only
build applications based on arrays;
I'll try to apply some other modifications - and maybe we got it ;-D

- benchmarking the app core-

Your,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry