Re: [PHP-DEV] Can we call Apache 2 API function from a PHP 5 extension module?

2010-01-16 Thread mm w
yep nevermind I don't you post this question on php-internal and don't
understand this ugly suggestion, Brian when I read your cv it seems to
be something serious ... when I see the line with your type recasting
I am not sure you understood something during these 15  years.

Best

On Sat, Jan 16, 2010 at 10:05 PM, Brian J. France br...@brianfrance.com wrote:
 Try this instead:

 request_rec *r = (request_rec *)(((SG(server_context) == NULL) ? NULL : 
 ((php_struct*)SG(server_context))-r));

 Apache 2.x server_context is not a request_rec, it is a struct with a request 
 rec in it.

 Brian


 On Jan 16, 2010, at 7:25 PM, rwe rt wrote:

 Hi all,I compiled php-5.3.1 with apache 2.2.14 as DSO and wanted to test how 
 to call Apache API from a PHP module:Run ./ext_skel --extname=helloModified 
 ext/hello.c and the function PHP_FUNCTION(confirm_hello_compiled) so that it 
 contains

 #include SAPI.h
 #include httpd.h
 #include http_config.h
 #include http_protocol.h
 #include ap_config.h
 request_rec *hello_r;PHP_FUNCTION(confirm_hello_compiled) { hello_r = 
 (request_rec *)SG(server_context); ap_rprintf(hello_r, Hello world\n);    
 return SUCCESS;
 }Under php root, run ./buildconf and ./configure 
 --with-apxs=/home/www/bin/apxs --enable-helloIt worked fine. But when I 
 furhter ran:

 makeI got an error like:ext/hello/.libs/hello.o: In function 
 zif_confirm_hello_compiled': /home/www/php-5.3.1/ext/hello/hello.c:167: 
 undefined reference toap_rprintf'near the end of compiling.As far as I know, 
 PHP 5 can only be compiled as DSO and don't have access to compiled objects 
 in Apache 2 directly. How to modify config.m4 or other files so that I can 
 make compiling successful? Any help would be greatly appreciated!Rwe


      __
 Be smarter than spam. See how smart SpamGuard is at giving junk email the 
 boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to 
 New Mail today or register for free at http://mail.yahoo.ca


 --
 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] __toString(), __toArray()

2010-01-12 Thread mm w
don't worry it's only for people who are working with MVC and
RootObject structure, there is too much magics already and __cast is
not needed at all,
as we cannot monkey patch to add an observer on itself, a nice
solution should have a catchable object so __catch any calls

function __catch($data, $type) {
if (method == $type) {
 if (data[selector] = 'setValue'  observedValueForKeyPath) {
 $this-_setValue(($data['arg']);
 return;
 }
}
continue_natural_call();
}

we could imagine to have a root-object-built-in-class that is
naturally observable, or a root classObject at all, anyway it's only
something for people who are doing OO programming,
so don't worry

On Tue, Jan 12, 2010 at 2:40 PM, Chris Stockton
chrisstockto...@gmail.com wrote:
 Hello,

 On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote:
 cast is not needed in PHP

 i 'd rather be more interesting in

 class Obj {
     function __catch($data, $type) {
            //$type [ static_method, method, get_property, set_property]
            if (observed   $type == set_property  somevalueIsObserved) {
                  $observer-notify(somevalue::valueWillChanged);
                  $this-somevalue = $data['somevalue'];
                  $observer-notify(somevalue::valueDidChanged);
            } else {
                  continue__call();
            }
     }
 }

 What? ...

 Etienne Kneuss wrote:
 This is where operator over-loading would be useful however perhaps only
 explicit casts would make sense here.

 I beleive adding a __cast(string $type) would be a useful feature for
 me, very often I have a toArray method defined. I agree with you that
 due to unexpected edge cases with operator precedence and general type
 juggling that __cast should only be called on explicit (cast).

 I.E.:
 class Int { public function __cast($type) { return 'int' == $type ? 15 : 0; } 
 }
 $r = new Int;

 var_dump($r + 1); // 2
 var_dump((int) $r + 1); // 16
 var_dump((bool) $r + 1); // 1


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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
the multiplication of magic, the pointed point, need to read more carefully

On Tue, Jan 12, 2010 at 6:10 PM, Eddie Drapkin oorza...@gmail.com wrote:
 How does this have *anything* to do with the discussion at hand?

 On Tue, Jan 12, 2010 at 9:09 PM, mm w 0xcafef...@gmail.com wrote:
 don't worry it's only for people who are working with MVC and
 RootObject structure, there is too much magics already and __cast is
 not needed at all,
 as we cannot monkey patch to add an observer on itself, a nice
 solution should have a catchable object so __catch any calls

 function __catch($data, $type) {
    if (method == $type) {
         if (data[selector] = 'setValue'  observedValueForKeyPath) {
             $this-_setValue(($data['arg']);
             return;
         }
    }
    continue_natural_call();
 }

 we could imagine to have a root-object-built-in-class that is
 naturally observable, or a root classObject at all, anyway it's only
 something for people who are doing OO programming,
 so don't worry

 On Tue, Jan 12, 2010 at 2:40 PM, Chris Stockton
 chrisstockto...@gmail.com wrote:
 Hello,

 On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote:
 cast is not needed in PHP

 i 'd rather be more interesting in

 class Obj {
     function __catch($data, $type) {
            //$type [ static_method, method, get_property, set_property]
            if (observed   $type == set_property  somevalueIsObserved) {
                  $observer-notify(somevalue::valueWillChanged);
                  $this-somevalue = $data['somevalue'];
                  $observer-notify(somevalue::valueDidChanged);
            } else {
                  continue__call();
            }
     }
 }

 What? ...

 Etienne Kneuss wrote:
 This is where operator over-loading would be useful however perhaps only
 explicit casts would make sense here.

 I beleive adding a __cast(string $type) would be a useful feature for
 me, very often I have a toArray method defined. I agree with you that
 due to unexpected edge cases with operator precedence and general type
 juggling that __cast should only be called on explicit (cast).

 I.E.:
 class Int { public function __cast($type) { return 'int' == $type ? 15 : 0; 
 } }
 $r = new Int;

 var_dump($r + 1); // 2
 var_dump((int) $r + 1); // 16
 var_dump((bool) $r + 1); // 1


 --
 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] __toString(), __toArray()

2010-01-12 Thread mm w
I am not forcing anything, it's already there, that's definitely a
more useful magic, if people would add a new one, __cast is not
critical, catchable objects are __catch even if exists, so my point I
'd rather see useful requests than a unseful one e.g __cast

from my perspective __toString and __toArray , __callStatic should be
removed  __callStatic  is definitly a mistake.



On Tue, Jan 12, 2010 at 6:29 PM, Eddie Drapkin oorza...@gmail.com wrote:
 What you're proposing is just forcing __call, _callStatic, __get and
 __set into a single method, which does nothing to reduce the amount of
 magic, only obfuscate it.  And it certainly offers no alternative to
 __cast, at least not that I can see.

 On Tue, Jan 12, 2010 at 9:11 PM, mm w 0xcafef...@gmail.com wrote:
 the multiplication of magic, the pointed point, need to read more carefully

 On Tue, Jan 12, 2010 at 6:10 PM, Eddie Drapkin oorza...@gmail.com wrote:
 How does this have *anything* to do with the discussion at hand?

 On Tue, Jan 12, 2010 at 9:09 PM, mm w 0xcafef...@gmail.com wrote:
 don't worry it's only for people who are working with MVC and
 RootObject structure, there is too much magics already and __cast is
 not needed at all,
 as we cannot monkey patch to add an observer on itself, a nice
 solution should have a catchable object so __catch any calls

 function __catch($data, $type) {
    if (method == $type) {
         if (data[selector] = 'setValue'  observedValueForKeyPath) {
             $this-_setValue(($data['arg']);
             return;
         }
    }
    continue_natural_call();
 }

 we could imagine to have a root-object-built-in-class that is
 naturally observable, or a root classObject at all, anyway it's only
 something for people who are doing OO programming,
 so don't worry

 On Tue, Jan 12, 2010 at 2:40 PM, Chris Stockton
 chrisstockto...@gmail.com wrote:
 Hello,

 On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote:
 cast is not needed in PHP

 i 'd rather be more interesting in

 class Obj {
     function __catch($data, $type) {
            //$type [ static_method, method, get_property, set_property]
            if (observed   $type == set_property  
 somevalueIsObserved) {
                  $observer-notify(somevalue::valueWillChanged);
                  $this-somevalue = $data['somevalue'];
                  $observer-notify(somevalue::valueDidChanged);
            } else {
                  continue__call();
            }
     }
 }

 What? ...

 Etienne Kneuss wrote:
 This is where operator over-loading would be useful however perhaps only
 explicit casts would make sense here.

 I beleive adding a __cast(string $type) would be a useful feature for
 me, very often I have a toArray method defined. I agree with you that
 due to unexpected edge cases with operator precedence and general type
 juggling that __cast should only be called on explicit (cast).

 I.E.:
 class Int { public function __cast($type) { return 'int' == $type ? 15 : 
 0; } }
 $r = new Int;

 var_dump($r + 1); // 2
 var_dump((int) $r + 1); // 16
 var_dump((bool) $r + 1); // 1


 --
 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] __toString(), __toArray()

2010-01-12 Thread mm w
I don't move any magics,I am worried about your knowledge of php,
there's people to give you money ? weird, set get call are only call
when something doesn't exist catch or catch-able concept is to be able
to catch any existing calls no the dynamic ones.


On Tue, Jan 12, 2010 at 6:59 PM, Clint Priest cpri...@warpmail.net wrote:


 Eddie Drapkin wrote:

 What you're proposing is just forcing __call, _callStatic, __get and
 __set into a single method, which does nothing to reduce the amount of
 magic, only obfuscate it.  And it certainly offers no alternative to
 __cast, at least not that I can see.

 I agree, moving all magic to a single function doesn't help the situation at
 all, it simply complicates it.

 All this talk of too many magic functions is a little comical, its all
 trying to overcome operator overloading type functionality in other
 languages.

 __get()/__set() would be equivalent to getters/setters supported by the c#
 language

 __toString(), __toArray() would be equivalent to operator String() in c++ (
 if I remember correctly )

 I would definitely love to be able to, at the very least, cast an object to
 an array but I figured a more general purpose __cast() would be most
 beneficial to all.

 I think the ambiguity question for some functions accepting mixed as a
 parameter type could be solved in aforementioned ways.

 On Tue, Jan 12, 2010 at 9:11 PM, mm w 0xcafef...@gmail.com wrote:

 the multiplication of magic, the pointed point, need to read more
 carefully

 On Tue, Jan 12, 2010 at 6:10 PM, Eddie Drapkin oorza...@gmail.com
 wrote:

 How does this have *anything* to do with the discussion at hand?

 On Tue, Jan 12, 2010 at 9:09 PM, mm w 0xcafef...@gmail.com wrote:

 don't worry it's only for people who are working with MVC and
 RootObject structure, there is too much magics already and __cast is
 not needed at all,
 as we cannot monkey patch to add an observer on itself, a nice
 solution should have a catchable object so __catch any calls

 function __catch($data, $type) {
   if (method == $type) {
        if (data[selector] = 'setValue'  observedValueForKeyPath) {
            $this-_setValue(($data['arg']);
            return;
        }
   }
   continue_natural_call();
 }

 we could imagine to have a root-object-built-in-class that is
 naturally observable, or a root classObject at all, anyway it's only
 something for people who are doing OO programming,
 so don't worry

 On Tue, Jan 12, 2010 at 2:40 PM, Chris Stockton
 chrisstockto...@gmail.com wrote:

 Hello,

 On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote:

 cast is not needed in PHP

 i 'd rather be more interesting in

 class Obj {
    function __catch($data, $type) {
           //$type [ static_method, method, get_property,
 set_property]
           if (observed   $type == set_property 
 somevalueIsObserved) {
                 $observer-notify(somevalue::valueWillChanged);
                 $this-somevalue = $data['somevalue'];
                 $observer-notify(somevalue::valueDidChanged);
           } else {
                 continue__call();
           }
    }
 }

 What? ...

 Etienne Kneuss wrote:
 This is where operator over-loading would be useful however perhaps
 only
 explicit casts would make sense here.

 I beleive adding a __cast(string $type) would be a useful feature for
 me, very often I have a toArray method defined. I agree with you that
 due to unexpected edge cases with operator precedence and general type
 juggling that __cast should only be called on explicit (cast).

 I.E.:
 class Int { public function __cast($type) { return 'int' == $type ? 15
 : 0; } }
 $r = new Int;

 var_dump($r + 1); // 2
 var_dump((int) $r + 1); // 16
 var_dump((bool) $r + 1); // 1

 --
 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 Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
:-D, without  any magic,  I am sorry if I hurt you I though you were
tougher than a cookie, don't worry about my friends I have plenty on
face-cooked, but for God Sake I am still eating alone at noon 8-)


On Tue, Jan 12, 2010 at 9:50 PM, Chris Stockton
chrisstockto...@gmail.com wrote:
 I don't move any magics, I'm worried your knowledge of social skills? Theirs
 people be your friends? Weird

 On Jan 12, 2010 9:10 PM, mm w 0xcafef...@gmail.com wrote:

 I don't move any magics,I am worried about your knowledge of php,
 there's people to give you money ? weird, set get call are only call
 when something doesn't exist catch or catch-able concept is to be able
 to catch any existing calls no the dynamic ones.

 On Tue, Jan 12, 2010 at 6:59 PM, Clint Priest cpri...@warpmail.net wrote:
   Eddie Drapkin wr...

 --

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

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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread mm w
cast is not needed in PHP

i 'd rather be more interesting in

class Obj {
 function __catch($data, $type) {
//$type [ static_method, method, get_property, set_property]
if (observed   $type == set_property  somevalueIsObserved) {
  $observer-notify(somevalue::valueWillChanged);
  $this-somevalue = $data['somevalue'];
  $observer-notify(somevalue::valueDidChanged);
} else {
  continue__call();
}
 }
}

On Mon, Jan 11, 2010 at 7:17 PM, Clint Priest cpri...@warpmail.net wrote:

 Etienne Kneuss wrote:

 Hello,

 On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net
 wrote:

 I know there's been requests to add a __toArray() and most of the
 arguments
 against it is that there are too many magic functions already.  I just
 thought I'd propose an alternative that would satisfy all of them.

 Why not a __cast($Type) magic function?

 I'd advance two reasons against this idea:

 1) It's more self-explanatory to explicitly call the appropriate
 converting method, enough with implicit madness!

 2) For some operations, you'd have to know the types in advance before
 knowing what operations needs to be performed:

 $obj1 + 2;

 Now what __cast should be called? Int? Float?

 Wouldn't it make sense to be an integer since its being added to an integer?


 Also, what about $obj1 + $obj2: Int? Float? Array?

 This is where operator over-loading would be useful however perhaps only
 explicit casts would make sense here.


 Another example: str_replace($obj1, bar, foo); what to call?
 __toString or __toArray? str_replace accepts both.

 This is an interesting situation, could be resolved by attempting a
 __cast('array') followed by a __cast('string') if the first call was
 rejected (false, exception or something).


 IMHO it would only make sense to invoke methods on explicit casts
 only, otherwise it will just be a mess with PHP's current type
 juggling. But, as we seen with __toString, limiting the field of
 application was annoying (and it was later extended to nearly all
 string usages).

 I would agree with this as well, only called during explicit casts.


 So, what will it be? Inconsistent and Confusing or Limited and Annoying?


 One other alternative, probably not as easy would be to pass multiple types
 to cast, much the way the Accepts: HTTP header does, providing a list of
 possible cast types, in the preferred order.

 One could even implement an interface such as:

 interface Castable {
   function GetCastableTypes();
 }

 or some such.

 --
 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 Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] php for android

2010-01-10 Thread mm w
so why not patching the configure.in ?

// give the possibility to add other embedded targets and be able to
manage next versions
--with-embedded-target=droid-
--with-embedded-ldflags= // toolchain ldflags
--with-embedded-cflags= // toolchain cflags
--with-embedded-cppflags= // toolchain cppflags
--with-embedded-tuningflags= // toolchain tuningflags

ecetera

why ?
redefining CC and LDFLAGS CFLAGS (11 years of experience in toolchains
creation, cross compiling... ecetera ) won't work with all
cc/ld/libtool versions and it's often a mess when cross compiling
wrong symbol catched, from a Mac no problem Apple patched gcc/ld and
their libtool to handle that AND IT TOOK A WHILE (4 years) before
beeing stable and non buggy, I am not sure about all platform (read
quite sure)

Best

On Sun, Jan 10, 2010 at 7:50 AM, Moshe Doron m...@php.net wrote:
 Antony Dovgal wrote:

 On 01/10/2010 12:45 AM, Moshe Doron wrote:

 Quit easy porting, here the instructions:

 http://www.icomsw.com/~moshe/php-android.php

 -CC = gcc
 +CC = /home/git/arm-2009q3/bin/arm-none-linux-gnueabi-gcc
 -CPP = gcc -E
 +CPP = /home/git/arm-2009q3/bin/arm-none-linux-gnueabi-gcc -E

 Such kind of changes is not necessary, you can do it with `CC=path to
 gcc LD=path to ld ./configure ...`

 If you remove that, there are only two parts that seem to be really
 ARM-specific:
 1) -export-dynamic - -all-static
 2) a patch for zend_float.h
 Both of them are not clear to me, would you care to explain why are they
 needed?


 Hello,

 The static compile is due to the fact that in android there is replacment to
 the standard libc called bionic. Since and i haven't yet managed to tell
 the CodeSourcery to link against bionic i linked all staticlly.
 bionic is something i need to face for allowing the php to interact with the
 local apache and for allowing the php to be embeded into the android ndk
 framework. I guess there some extra patching will need for it.

 Moshe

 --
 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] array position isfirst / islast / valid ?

2010-01-02 Thread mm w
?php

interface FastEnumeration extends IteratorAggregate
{

};

interface FastEnumerator extends Iterator
{

};

define('EnumerationConcurrent', 0);
define('EnumerationReverse', 1);

class Enumerator implements FastEnumerator
{
private $arr;
private $reversed;

function __construct(array $arr, $reversed = 0) {
$this-reversed  = $reversed;
$this-arr = $arr;
if ($this-reversed) {
end($this-arr);
}
}

public function first() {
if ($this-reversed) {
$cnt = count($this-arr);
$idx = $cnt  1 ? $cnt - 1 : 0;
} else {
$idx = 0;
}
return $this-arr[$idx];
}

public function last() {
if ($this-reversed) {
$idx = 0;
} else {
$cnt = count($this-arr);
$idx = $cnt  1 ? $cnt - 1 : 0;
}
return $this-arr[$idx];
}

public function isfirst() {
if ($this-reversed) {
$cnt = count($this-arr);
$idx = $cnt  1 ? $cnt - 1 : 0;
} else {
$idx = 0;
}
return key($this-arr) == $idx;
}

public function islast() {
if ($this-reversed) {
$idx = 0;
} else {
$cnt = count($this-arr);
$idx = $cnt  1 ? $cnt - 1 : 0;
}
return key($this-arr) == $idx;
}

public function rewind() {
if ($this-reversed) {
end($this-arr);
} else {
reset($this-arr);
}
}

public function current() {
return current($this-arr);
}

public function key() {
return key($this-arr);
}

public function end() {
if ($this-reversed) {
reset($this-arr);
} else {
end($this-arr);
}
}


public function next() {
if ($this-reversed) {
return prev($this-arr);
} else {
return next($this-arr);
}
}

public function prev() {
if ($this-reversed) {
return next($this-arr);
} else {
return prev($this-arr);
}
}

public function valid() {
$current = $this-current();
return  !empty($current)  $current != null;
}
};

class MArray implements FastEnumeration
{
private $arr;

public function getIterator() {
return new Enumerator($this-arr);
}

public function reverseEnumerator() {
return new Enumerator($this-arr, EnumerationReverse);
}

public function concurrentEnumerator() {
return new Enumerator($this-arr, EnumerationConcurrent);
}

// ...
};

/* EOF */ ?

On Sat, Jan 2, 2010 at 8:47 AM, Oskar Eisemuth patch...@gmail.com wrote:
 Hello

 Would it be possible to add functions to know the relative internal array
 position?

 I found [PHP-DEV] RFC array functions from 2006, but nothing really
 changed.

 The need to use next, prev in combination is ridiculous compared to a clean
 array_hasmore or array_pos_islast, as the internals already know this.
 To get an array_valid_position or array_pos_isvalid wouldn't be bad either.

 So would it possible to introduce:

 array_pos_isfirst(  $array)
 array_pos_islast(  $array)
 array_pos_isvalid(  $array)


 Best regards
 Oskar Eisemuth



 --
 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] PHP6's future

2009-12-31 Thread mm w
Those things were already deprecated, it's good thing that php 5.3
finally broke bad code, php 5 (since the first alpha) is there since a
while, drupal is drupal if folks don't want to fix it,  what's the big
deal there? just pach it yourself it's open source isn't it? so
nothing stop you to fork, what's the matter with the language
implementation internal-list seriously drupal I don't care, drupal is
not php and won't decide for keeping legacy support or not, so
complain to drupal team not here

On Thu, Dec 31, 2009 at 1:04 AM, Stanislav Malyshev s...@zend.com wrote:
 Hi!

 The PHP 5.3 compatibility issue for the Drupal CMS
 (http://drupal.org/node/360605), for example, had over 200 comments, and
 it took about 9 months before a patch was committed to the current
 version of Drupal in September (see comment 158). That's not the only
 example, but it's a prominent one that comes to my mind.

 it looks like their issues were primarily caused by:
 1. Relying on exact text of error messages
 2. Using runtime by-ref passing (which one definitely shouldn't do)

 --
 Stanislav Malyshev, Zend Software Architect
 s...@zend.com   http://www.zend.com/
 (408)253-8829   MSN: s...@zend.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] [PATCH] Fix for 32 bits limit on file size (see bug 48886)

2009-12-22 Thread mm w
Thx,

yep a long convertion, not a big deal, we don't work with 4.3GB files
:-D, well minded people try to avoid that

On Tue, Dec 22, 2009 at 7:10 AM, X Ryl boite.pour.s...@gmail.com wrote:
 Hi,

  I'm not a C developer, so I can't really help with the attached patch.
 However, I've tried it with PHP 5.3.0 version I have and it does what it
 claims, that is, it gives correct behaviour for the following functions:
 filesize, fstat, stat when used on file  4GB on a 32 bits machine.
 Currently, php 5.x doesn't give the correct output for this code (on my
 32bits server):
 echo filesize(path/to/4.3GBfile);  // expecting 4617089843, got 322122547

 With the patch applied, the good result is returned.
 From the patch author, it improves the tests results.
 From what I've understood, the patch switch to php's double type when the
 size overflow the 32bits limit of int.
 It doesn't seem to break any existing behaviour (I'm using this on my
 multiple project since july, and no bad experience so far).

 The explaination by the patch author: http://bugs.php.net/bug.php?id=48886






 --
 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] How does the interpreter work

2009-12-21 Thread mm w
Hello,

this document is clearly outdated and for me so far confuse just gave
a try for 5 mins, and I am worry about the printf tech, lucky you are
not to be in multi-thread env..., at least fprintf on the stderr to
read un-buffered results, those guys have a job? maybe greenhouse
keepers certainly not developers.


Christian, the best way to enter in the zend engine, it's to create a
zend extension project, then go thru all the step of the code to
manipulate the hashtable, learn where object are living in the tree,
then when you know how to play with the public interface, that's
really easy to go deeper, the zend bytecode engine is so far less
complex that what you could find in any JVM (I know a couple of things
in area) even python bytecode and how the interpreter is able to
handle various version,

in two weeks you should have done your tour by using the zend
interface and reading the code, php zend core is tiny in term of code,
the only things that could appear weird and clumsy is the semantic
code used, this is the only thing that could appear like a mind
barrier.

Best,

On Mon, Dec 21, 2009 at 6:27 AM, Rob Nicholson rob_nichol...@uk.ibm.com wrote:

 Christian Grobmeier grobme...@gmail.com wrote on 21/12/2009 13:56:08:


 I would like to learn more about how the interpreter works, but I was
 unable to find good documents on the web. Basically I am thinking on
 something about allocation of variables, how does object creation work
 and such stuff. Maybe something on the overall architecture of PHP
 would be of interest too.

 In java world there is the JVM specification, I hoped there is
 something for PHP too.

 Hi Christian,

 The PHP architecture is a little different from the JVM in that it does not
 explicitly document/specify the interface between the compiler and the
 bytecode/opcode interpreter the way that Java does. It still exists though.

 I suggest you look at the links under here:

 http://www.php.net/manual/en/internals2.php
 In particular:
  http://www.php.net/manual/en/internals2.opcodes.php

 Another good reference is Sara Goleman's book Extending and Embedding PHP

 Andy Wharmby produced a set of charts which you can find on Zoe's Blog
 here : http://zoomsplatter.blogspot.com/2008/08/php-opcodes.html .
 These may help you to make a fast start  understanding the overall design.

 Rob.


 --
 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] How does the interpreter work

2009-12-21 Thread mm w
Pas mieux, and I am sure johannes did not find the need to express
himself and/or these mind  limitations on his blog :)

harf I am so bad I know.

-mmw

2009/12/21 Johannes Schlüter johan...@php.net:
 Hi,

 On Mon, 2009-12-21 at 14:56 +0100, Christian Grobmeier wrote:
 I would like to learn more about how the interpreter works, but I was
 unable to find good documents on the web. Basically I am thinking on
 something about allocation of variables, how does object creation work
 and such stuff. Maybe something on the overall architecture of PHP
 would be of interest too.

 In java world there is the JVM specification, I hoped there is
 something for PHP too.

 Well there's one quite complete document about it available - the source
 code ;-) PHP isn't developed following standards but simply by
 implementing and extending it. PHP is defined by the implementation ...

 But: What exactly do you want to learn? Do you want to learn how to use
 it better or academic reasons or something else? - Depending on all
 that the focus of the learning might be quite different.

 As a starting point for this I recently created a small toy project: A
 minimal basic inspired language on top of the ZendVM, just 200 lines of
 C code which might give a few pointers to do further research. It's
 quite hackish ugly code but enough to compile and execute a script like
 this:

 10 GOTO 40
 20 PRINT B
 30 END
 40 PRINT A
 50 GOTO 20

 This all will be compiled to Zend Opcodes which can be executed, cached
 with APC, dumped by vld, ...

 I hope I find the time to write the documentation around it, other than
 that this code is absolutely useless :-)

 http://github.com/johannes/pasic

 johannes



 --
 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] suggestion about ternary operator

2009-11-21 Thread mm w
More interesting behaviors to dig are there:

variable = value1 ?? value2;

variable = value0 ?  value4 : value1 ?? value2;

or a la javascript

variable = value1 || value2;

Best,

On Sat, Nov 21, 2009 at 10:21 AM, Rasmus Lerdorf ras...@lerdorf.com wrote:
 Alban wrote:
 Le Sat, 21 Nov 2009 09:48:10 +0100, Lukas Kahwe Smith a écrit :

 On 21.11.2009, at 06:12, Alban wrote:

 This is not a big problem but if a solution exists, this would be so
 cool ! Especialy when we have to check existance of twenty or more key
 in array. Code would be be lighter and clear. Since i use PHP, I always
 have in my 'common function file' a function like that :

 function getIssetVar($var, $default) { return ((isset($var)) ? $var :
 $default); }

 So is it possible to make a little improvement on this operator or
 introduce a new operator or a core function which do that ? What's your
 feeling about it ?

 this feature request has already been discussed and declined:
 http://wiki.php.net/rfc/ifsetor

 please review this rfc before continuing this thread.

 regards,
 Lukas Kahwe Smith
 m...@pooteeweet.org

 Thanks for the link to the RFC :)

 Excuse me, but I'll be little hard in this post. This for insult the
 community but I want the community really think about the decision it
 made and the reason why.

 I also read why it have been refused here :
 http://www.php.net/~derick/meeting-notes.html#ifsetor-as-replacement-for-
 foo-isset-foo-foo-something-else

 Is it serious ?

 «
 The name for this new operator is heavily disputed and we could not agree
 on a decent name for it.
 »

 Tomorrow I will not send food to the association for children who are
 hungry because I can not choose between offering Thai or basmati rice.

 Stop sarcasm, seriously, this is not an honorable response from people
 making decisions. Take your responsibility and make a vote or impose a
 name, just do it.

 «
   Instead of implementing ifsetor() we remove the
   requirement for the middle parameter to the ?: operator.
 »

 That's not people wants and that's not do their need.
 So that not a correct answer of the php developper demand.

 «
   In combination with the new input_filter extension
   you then reach the original goal of setting a default
   value to a non-set input variable with:

   $blahblah = input_filter_get(GET, 'foo', FL_INT) ?: 42;
 »

 I don't see how do that with the actual filter extension. Even if it is
 possible, this is not a pretty short and easier solution than :

 $var = (isset($var)) ? $var : 'default';

 The ternary isn't meant to solve the isset thing you are talking about.
  It is simply a shortcut to normal ternary operations.  The most common
 case where you don't know if a variable is set is on the initial input
 via $_GET or $_POST and we definitely don't want people doing:

  $var = $_GET['foo'] ?: 42;

 It would be an XSS disaster.  Hence the suggestion to use input_filter
 there, or a similar user-supplied filtering function in which case the
 ternary, as it is currently implemented, is perfectly suitable.

 -Rasmus


 --
 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] Intervals representation with brackets

2009-11-20 Thread mm w
http://code.google.com/p/foundation-kit/source/browse/trunk/FKRange.php
http://code.google.com/p/foundation-kit/source/browse/trunk/FKIndexSet.php

On Fri, Nov 20, 2009 at 1:56 PM, Samuel ROZE samuel.r...@gmail.com wrote:
 Hello,

 I'm working on two classes, Interval and IntervalList which describe
 an interval and a list of intervals. These intervals are defined using
 the Interval class:

 ?php
 $interval = new Interval((int) $from, (int) $to);
 ?

 These intervals can be stored in a list of intervals, using IntervalList:

 ?php
 $list = new IntervalList();
 $list-add($interval_1);
 $list-add($interval_2);
 ?

 IntervalList's functions are:
 - inverse(); which returns an IntervalList object
 - intersection(); which returns an IntervalList object of intervals
 which are contained by every interval of this list.

 To be easier, what do you think about:
 ?php
 // An interval with [  ]
 $interval = [ (int) $from, (int) $to ];
 ?

 ?php
 // A list of intervals
 $list = [ $from_1, $to_1] + [$from_2, $to_2] + ... [$from_n, $to_n];
 $list_2 = [$from_1, $to_1] + ... + $interval_n;
 ?

 Regards,
 Samuel ROZE.

 --
 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] Intervals representation with brackets

2009-11-20 Thread mm w
Hello,

Even if you are introducing a new syntax, your approach is wrong to
get intersection and interval, I was not talkative
but the samples I gave you expose several cases

// This isn't bad, but it's not really what i want, and... what I wrote! ;-)

so I guess you don't even understand what your are doing ? playing
with range, you may read the documentation about those objects into
the Apple Foundation those are following the same model, dealing with
list of ranges.

anyway what you exposed was really unclear, try to be more didactic,
we don't have crystal balls, and somehow Ijust trolled you like you
did, so please we are people we need a context.

Best,

On Fri, Nov 20, 2009 at 2:22 PM, Samuel ROZE samuel.r...@gmail.com wrote:
 Hi,

 This isn't bad, but it's not really what i want, and... what I wrote! ;-)

 Samuel.

 2009/11/20 mm w 0xcafef...@gmail.com:
 http://code.google.com/p/foundation-kit/source/browse/trunk/FKRange.php
 http://code.google.com/p/foundation-kit/source/browse/trunk/FKIndexSet.php

 On Fri, Nov 20, 2009 at 1:56 PM, Samuel ROZE samuel.r...@gmail.com wrote:
 Hello,

 I'm working on two classes, Interval and IntervalList which describe
 an interval and a list of intervals. These intervals are defined using
 the Interval class:

 ?php
 $interval = new Interval((int) $from, (int) $to);
 ?

 These intervals can be stored in a list of intervals, using IntervalList:

 ?php
 $list = new IntervalList();
 $list-add($interval_1);
 $list-add($interval_2);
 ?

 IntervalList's functions are:
 - inverse(); which returns an IntervalList object
 - intersection(); which returns an IntervalList object of intervals
 which are contained by every interval of this list.

 To be easier, what do you think about:
 ?php
 // An interval with [  ]
 $interval = [ (int) $from, (int) $to ];
 ?

 ?php
 // A list of intervals
 $list = [ $from_1, $to_1] + [$from_2, $to_2] + ... [$from_n, $to_n];
 $list_2 = [$from_1, $to_1] + ... + $interval_n;
 ?

 Regards,
 Samuel ROZE.

 --
 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 Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread mm w
what you call factory objects are more proxy objects, please make
the difference, semantics are sometimes important.
anyway , what I can read this document is a bit a mess, it needs to be
split by topic, your approach is really confuse.


Best,

On Wed, Nov 18, 2009 at 8:06 AM, Robert Lemke rob...@typo3.org wrote:
 Hi folks,

 after discussing the idea with various PHP developers I now felt safe enough 
 that it's not a completely stupid idea to post an RFC for it. The idea is to 
 add support the registration of custom factories which are responsible for 
 instantiating certain classes.

 Here is the first draft of my RFC:
 http://wiki.php.net/rfc/customfactories

 I suggest that we first discuss the implications and usefulness of this 
 feature. In a second step I'd need to find some skilled internals wizard who 
 can implement it, because not being a C developer myself, all I can offer is 
 making suggestions and fine coffee.

 Looking forward to hearing your comments!
 Robert

 --
 Robert Lemke
 Fluent Code Artisan

 Lead Developer TYPO3 5.0 and FLOW3
 TYPO3 Association co-founder

 http://typo3.org
 http://flow3.typo3.org
 http://association.typo3.org


 --
 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] Request for Karma

2009-11-15 Thread mm w
then an embedded karma is granted karma

On Sun, Nov 15, 2009 at 1:14 PM, Pierre Joye pierre@gmail.com wrote:
 Hi!

 I second this request as well :)

 On Sun, Nov 15, 2009 at 9:51 PM, Pierrick Charron pierr...@webstart.fr 
 wrote:
 Hi,

 Felipe suggested me to request Karma for php-src to do bug fixing. My
 SVN username is pierrick.

 For those of you don't know me I'm Pierrick a French PHP Developer who
 live in Montreal.
 You can reach me if needed (or not) on IRC #pecl.dev on EFNet, my
 nickname is adoy.

 Thanks
 Pierrick

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





 --
 Pierre

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

 --
 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] Regarding constructions like func()[0]

2009-11-07 Thread mm w
Hi Melfar, from my point of view I am totally to make this a legal
call like in python or ruby java,
as I liked compact code I liked to avoid temp vars especially on a
read-only call, but it might require some effort there and the final
patch might be not so simple, anyway this is a community call, what I
can say about this kind of missing feature sometimes, I can hear in
my office : PHP is a retarded language, PHP sucks or worst, my
point there, that is sometimes good to listen to people who are not
passionate by the language but just using it to do their job and be
paid.

Cheers!

On Sat, Nov 7, 2009 at 3:42 AM, melfar mel...@gmail.com wrote:
 Hello!

 I have filed a bug (suggestion) at http://bugs.php.net/bug.php?id=50003
 What do you think about enabling such a constructions in future versions of
 php?

 Br,
 -melfar



 --
 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] Feedback requested on using #defines to improve the performance of the TSRMG macro

2009-11-05 Thread mm w
so should be a UUID rather than a user defined int you cannot avoid
collision with your system, it's a dangerous way to go.

Best,

On Thu, Nov 5, 2009 at 11:20 AM, Arvind Srinivasan yoa...@gmail.com wrote:
 Does the GLOBALS_ID_BASE idea work?  In
 ts_allocate_reserved_id(GLOBALS_ID_BASE+1...) each extension would
 anyway need to reserve an increment to avoid clashes.  Also, why is

 I didn't really try using this. When I added it, I thought it might be
 useful for modules that live outside the PHP source tree. They could
 then define their constants using
 #define FOO_ID (GLOBALS_ID_BASE + 3)
 rather than hardcoding 33. As you point out, they would still need to
 reserve an increment.

 GLOBALS_ID_BASE 30 when the largest reserved value is 18?  Maybe I'm
 missing something.

 I reserved IDs for the subsystems I thought were core. I was sure
 there'd be others that I'd missed and so I left space for more.


 Would there be significant memory space or locality issues if one ID
 per extension in the PHP source bundle was reserved upfront, even if
 those extensions were never enabled?


 I'll run some tests and see what impact this has.

 Arvi

 --
 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] PHP socket automatically shuts down after ? hours of idling?

2009-11-01 Thread mm w
Hi what is your platform ?2.  Provide  a working, migth be a recent
problem regarding x socket, can you observe and dump your tcp
connexion?

On Sunday, November 1, 2009, Chris Jiang jiang...@gmail.com wrote:
 Hi Hannes,

 It just shuts down the socket server without any error, warning or notice. 
 I'm sorry that I can't provide a case for reproduction, because I don't even 
 know where the problem is, and where I should shorten the script to. However, 
 there is a strange behavior that might help to target the trouble:

 1) The socket server runs fine when it starts, as long as there are ppl 
 keeping connected to the server.

 2) After about 3 hours of idling (I couldn't count the exact time), when 
 someone connect to the socket, it still works, for the FIRST connection.

 3) Then, the server shuts down.

 I tried to log what happend during the operation, but didn't find anything 
 useful. :(

 Any hint on this?

 Thanks!

 Chris Jiang



 2009/10/28 Chris Jiang jiang...@gmail.com:

 Hi all, here is another question that made me confused. I'm not sure if
 it's a bug or what, but I can't find an answer from the search engines.

 I've made a chat server using php socket features, and it works pretty
 well as I've expected. However, there is a weird thing happening: The
 server shuts down automatically after about 3 hours of idling (no
 connections).


 Without any notices/warnings/errors? Do you have a shortish reproduce case?

 -Hannes


 --
 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] Where is the EG macro defined?

2009-10-28 Thread mm w
grep is your friend, something like that grep -R define EG(
/usr/include/php/Zend, it's a quite common issue you crossed

Best

On Wed, Oct 28, 2009 at 3:03 PM, Graham Kelly sgkel...@gmail.com wrote:
 Hi,

 You might find http://lxr.php.net to be a useful tool to help with finding
 definitions in the PHP code base.

 - Graham Kelly

 On Wed, Oct 28, 2009 at 5:57 PM, Mark Skilbeck markskilb...@gmail.comwrote:

 I'd like to check out how the EG macro (I assume it's a macro) works.
 However, I cannot find it :(

 --
 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] bug when using foreach with references?

2009-10-21 Thread mm w
Richard, enumerator exhausted, repeat your sub-sequence again you will get it
e.g pointer and pointed

Best Regards

On Wed, Oct 21, 2009 at 7:01 PM, Richard K Miller
richardkmil...@gmail.com wrote:
 Hi Jill,

 ?php
 $items = array('apple', 'banana', 'carrot');
 print_r($items);
 foreach ($items as $item) { }

 $item is now a reference to the last element of $items.

 print_r($items);
 foreach ($items as $item) { }

 And here, the foreach loop writes to $item for each element: thus
 assiging that value to the last element of $items.

 The last element of $items is 'carrot'. Why does it print apple, banana,
 banana?

 It sounds like you're saying that $item should be left with the value
 'carrot', which makes sense, but why would the original array be modified?
 (These are empty foreach loops.)

 print_r($items);
 ?

 // Output:
 Array
 (
    [0] = apple
    [1] = banana
    [2] = carrot
 )
 Array
 (
    [0] = apple
    [1] = banana
    [2] = carrot
 )
 Array
 (
    [0] = apple
    [1] = banana
    [2] = banana
 )

 Two bananas in the last set?! Not what I expected.

 You can fix your bug by using 'unset($item);' after the second
 foreach-loop.




 --
 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