[PHP-DOC] Re: [PHP-DEV] strange autoload behavior

2008-07-19 Thread Marcus Boerger
Hello Jochem,

Thursday, July 17, 2008, 7:38:01 PM, you wrote:

 Marcus Boerger schreef:
 Hello Jochem,
 

 ...

 I just posted another mail to internals in which I attempt to detail the
 __autoload behaviour 'issues' ... it includes something that wants to be a
 test suite when it grows up ... it might help someone to investage/determine
 what __autoload() does/should do:
 
 http://iamjochem.com/autoload_behaviour_tests.zip
 
 Great! More tests :-)
 
 It is quite a lot of stuff and I'd like to see this turned into .phpt's.

 it looks more than it is, the runtests.sh script makes viewing the results
 of the variations in settings/code easier.

 if you unzip the file and execute ./runtests.sh with no args it goves you
 all the options ... at this stage I wrote primarily to figure out what
 actually happens under any number of conditions.

 I'd love to take a shot at converting them to .phpt I see 3 problems

 1. I don't know .phpt (I can solve this)

http://qa.php.net/write-test.php
http://somabo.de/talks/200703_montreal_need_for_testing.pdf or .pps

 2. I have no idea what to expect and therefore test for
 (this needs to be determined/clarified!)

Write the tests as good as you can and if you are unsure about the result
mail.

 3. In the case that I need to test for an uncaught Exception I wonder
 how to determine a pass (ie uncaugh exception thrown as expected) given
 that the exact output is dependent on the full path of the relevant script

Zend/tests/exception_008.phpt is a test for an uncaught exception that is
made dynamic enough to work everywhere. In general we use EXPECTF as soon
as error messages or exceptions are expected. Then we replace:
- path's including the last path separator with '%s'
- line numbers with '%d'
- object identifiers '#num' with '#%d'

marcus

 any advice as to how to proceed, especially with regard to point 2.

 rgds,
 Jochem

 
 marcus
 
 That is they
 are simply ignored. 
 
 and so I thought :-) which is why some of my test's output wtf! :-)
 
 as always, thanks for your feedback,
 regards,
 Jochem
 
 And once all __autoload work is done and the class
 still doesn't exist an E_ERROR is issued. The work around for cases where
 the class must not exist (e.g. when no E_ERROR is needed would be
 collecting the exceptions. That is the base Exception class would get an
 additional property and getter:
   private $previous_exception;
   function public getPreviousException();
 That way we could let the exceptions bubble up (though some smaller engine
 changes are necessary).
 
 currently you can throw an exception out of __autoload() unless __autload()
 is triggered by the 'new' syntax or by a static method call (e.g. 
 MyClass::myMethod()),
 with other 'triggers' (e.g. call_user_func()) the exception comes through 
 ...
 in cases that it doesn't you can get an exception out of __autoload() via 
 the
 eval() trick [see below] ... I don't suppose there is anyway of asking the 
 engine
 which way __autoload() was triggered from inside the __autoload() code?
 
 marcus

 Thursday, July 10, 2008, 7:14:33 PM, you wrote:

 Derick Rethans schreef:
 On Thu, 10 Jul 2008, Gergely Hodicska wrote:

 exceptions thrown during autoload are ignored.
 And one more thing, this is in the manual:
 Note: Exceptions thrown in __autoload function cannot be caught in the 
 catch
 block and results in a fatal error.

 I think your explanation makes much more clear what happens, maybe it 
 would
 worth to upgrade the manual. While the quoted text suggests that that 
 if throw
 an exception I just can't catch it and will bubble up to top level and 
 this
 cause the fatal error.
 You can actually catch it *in* the autoload method, it just wouldn't 
 bubble out of it.
 the manual could do with that tidbit, maybe also the hack for 'getting the
 exception out' of __autoload() ...
 function __autoload($class)
 {
 try {
 throw new Exception('foo');
 } catch (Exception $e) {
 self::handleDebug($e);
 
 if (!class_exists($class, false))
 eval(sprintf('
  class %1$s
  {
  public function __construct(){
 throw new AL_Exception(Class %1$s not found: %2$s); }
  public function __call($m, $a)   {
 throw new AL_Exception(Class %1$s not found: %2$s); }
  public  static function __callStatic($m, $a) {
 throw new AL_Exception(Class %1$s not found: %2$s); }
  }', $class, $e-__toString()));
 }
 }
 which works best when __autoload() isn't triggered by class_exists(Foo, 
 true)

 regards,
 Derick





 Best regards,
  Marcus


 
 
 
 
 Best regards,
  Marcus
 
 





Best regards,
 Marcus



[PHP-DOC] cvs: php-src /ext/spl spl.php spl_iterators.c spl_iterators.h /ext/spl/examples recursivetreeiterator.inc /ext/spl/internal recursivetreeiterator.inc /ext/spl/tests recursive_tree_iterato

2008-07-19 Thread Marcus Boerger
helly   Sat Jul 19 15:43:35 2008 UTC

  Added files: 
/php-src/ext/spl/internal   recursivetreeiterator.inc 
/php-src/ext/spl/tests  recursive_tree_iterator_001.phpt 
recursive_tree_iterator_002.phpt 
recursive_tree_iterator_003.phpt 
recursive_tree_iterator_004.phpt 
recursive_tree_iterator_005.phpt 
recursive_tree_iterator_006.phpt 
recursive_tree_iterator_007.phpt 
recursive_tree_iterator_008.phpt 

  Removed files:   
/php-src/ext/spl/examples   recursivetreeiterator.inc 

  Modified files:  
/php-src/ext/splspl.php spl_iterators.c spl_iterators.h 
  Log:
  - Move RecursiveTreeIterator from PHP to C code (Arnaud, Marcus)
  [DOC] Added RecursiveTreeIterator
Documentation in ext/spl/internal/recursivetreeiterator.inc
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.84r2=1.85diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.84 php-src/ext/spl/spl.php:1.85
--- php-src/ext/spl/spl.php:1.84Wed Feb 13 12:01:16 2008
+++ php-src/ext/spl/spl.php Sat Jul 19 15:43:35 2008
@@ -35,6 +35,7 @@
  * - interface RecursiveIterator extends Iterator
  * - interface OuterIterator extends Iterator
  * - class RecursiveIteratorIterator implements OuterIterator
+ * - class RecursiveTreeIterator extends RecursiveIteratorIterator
  * - abstract class FilterIterator implements OuterIterator
  * - class ParentIterator extends FilterIterator implements RecursiveIterator
  * - interface SeekableIterator extends Iterator
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.170r2=1.171diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.170 
php-src/ext/spl/spl_iterators.c:1.171
--- php-src/ext/spl/spl_iterators.c:1.170   Wed Mar 19 14:00:46 2008
+++ php-src/ext/spl/spl_iterators.c Sat Jul 19 15:43:35 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_iterators.c,v 1.170 2008/03/19 14:00:46 felipe Exp $ */
+/* $Id: spl_iterators.c,v 1.171 2008/07/19 15:43:35 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include config.h
@@ -35,6 +35,7 @@
 #include spl_directory.h
 #include spl_array.h
 #include spl_exceptions.h
+#include ext/standard/php_smart_str.h
 
 #ifdef accept
 #undef accept
@@ -58,6 +59,7 @@
 PHPAPI zend_class_entry *spl_ce_RegexIterator;
 PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator;
 PHPAPI zend_class_entry *spl_ce_Countable;
+PHPAPI zend_class_entry *spl_ce_RecursiveTreeIterator;
 
 const zend_function_entry spl_funcs_RecursiveIterator[] = {
SPL_ABSTRACT_ME(RecursiveIterator, hasChildren,  NULL)
@@ -74,6 +76,11 @@
 #define RIT_CATCH_GET_CHILD CIT_CATCH_GET_CHILD
 
 typedef enum {
+   RTIT_BYPASS_CURRENT = 4,
+   RTIT_BYPASS_KEY = 8
+} RecursiveTreeIteratorFlags;
+
+typedef enum {
RS_NEXT  = 0,
RS_TEST  = 1,
RS_SELF  = 2,
@@ -104,6 +111,7 @@
zend_function*endChildren;
zend_function*nextElement;
zend_class_entry *ce;
+   smart_strprefix[6];
 } spl_recursive_it_object;
 
 typedef struct _spl_recursive_it_iterator {
@@ -408,27 +416,65 @@
spl_recursive_it_rewind
 };
 
-/* {{{ proto void 
RecursiveIteratorIterator::__construct(RecursiveIterator|IteratorAggregate it 
[, int mode = RIT_LEAVES_ONLY [, int flags = 0]]) throws 
InvalidArgumentException U
-   Creates a RecursiveIteratorIterator from a RecursiveIterator. */
-SPL_METHOD(RecursiveIteratorIterator, __construct)
+static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, 
zend_class_entry *ce_base, zend_class_entry *ce_inner, recursive_it_it_type 
rit_type TSRMLS_DC)
 {
zval  *object = getThis();
spl_recursive_it_object   *intern;
zval  *iterator;
zend_class_entry  *ce_iterator;
-   long   mode = RIT_LEAVES_ONLY, flags = 0;
+   long   mode, flags;
intinc_refcount = 1;
 
php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException 
TSRMLS_CC);
 
-   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, o|ll, iterator, mode, flags) == SUCCESS) {
-   if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate 
TSRMLS_CC)) {
-   zval *aggregate = iterator;
-   zend_call_method_with_0_params(aggregate, 
Z_OBJCE_P(aggregate), Z_OBJCE_P(aggregate)-iterator_funcs.zf_new_iterator, 
getiterator, iterator);
-   inc_refcount = 0;
+   switch(rit_type) {
+   case 

[PHP-DOC] Re: [PHP] Re: PHP documentation parsing?

2008-07-19 Thread Daniel Brown
On Fri, Jul 18, 2008 at 9:22 AM, Christian A. Reiter
[EMAIL PROTECTED] wrote:
 Hi,
 Sorry for spamming, but i got a error reply from sending this to
 [EMAIL PROTECTED]

Don't worry, you're not spamming, you were following up.  The
gods have forgiven you, so you're good to go!  ;-P

[EMAIL PROTECTED] is a common typo.  The real address is
[EMAIL PROTECTED]  Note the lack of hyphen.

I think it's safe to say that *most* of us have done it.  I know,
at least, that I have and so has Tul, just yesterday.  ;-P

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.


[PHP-DOC] Runkit Function Status

2008-07-19 Thread Daniel Brown
(Shooting to docs and PECL-dev.)

While doing an overhaul of the user notes, I noticed that many of
the runkit functions are still marked as experimental in the
documentation.  Version 0.7 introduced said functions in 2005, and
they were still available in the last release of 0.9 in mid-2006.

Can someone give a status update on these functions?  Is it safe
to remove the experimental warning from the docs?  Two-plus years
seems to indicate at least a false sense of stability.  ;-P

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.


Re: [PHP-DOC] Runkit Function Status

2008-07-19 Thread Etienne Kneuss
Hello,

On Sun, Jul 20, 2008 at 3:29 AM, Daniel Brown [EMAIL PROTECTED] wrote:
(Shooting to docs and PECL-dev.)

While doing an overhaul of the user notes, I noticed that many of
 the runkit functions are still marked as experimental in the
 documentation.  Version 0.7 introduced said functions in 2005, and
 they were still available in the last release of 0.9 in mid-2006.

Can someone give a status update on these functions?  Is it safe
 to remove the experimental warning from the docs?  Two-plus years
 seems to indicate at least a false sense of stability.  ;-P


I've experienced some crashes with runkit, caused by strange code that
should have never worked. Apparently, its test coverage is not that
high. Additionally it has 39 opened bugs, some of which are quite old.
So no, unless it gets some more love first, I wouldn't remove the
experimental flag.

Regards

-- 
Etienne Kneuss
http://www.colder.ch

Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal


Re: [PHP-DOC] Runkit Function Status

2008-07-19 Thread Daniel Brown
On Sat, Jul 19, 2008 at 10:26 PM, Etienne Kneuss [EMAIL PROTECTED] wrote:

 I've experienced some crashes with runkit, caused by strange code that
 should have never worked. Apparently, its test coverage is not that
 high. Additionally it has 39 opened bugs, some of which are quite old.
 So no, unless it gets some more love first, I wouldn't remove the
 experimental flag.

Sounds good.  Thanks!

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.