[PHP-DEV] Re: extending ignore_errors inside http_fopen_wrappers.c
... I don't know why I never scrolled down to the changelog section of the documentation where it mentions that this was introduced in 5.3.0 onwards (ahem); still, since the introduction of this parameter was only inside this wrapper it could still be backported to 5.2.10 right? ;-) On 5/17/09, Tjerk Anne Meesters datib...@php.net wrote: Since I'll be out most of today, I'll just post the patch first; it'd be great if it could also be applied to the 5_2 branch of course, but that's not my call ;-) As for compatibility, by default the patch would not change anything to the current 5.2 behaviour, so I'm not sure how this poses a problem. In addition, the documentation already states the ignore_errors settings without mentioning the version it was introduced in; a simple introduced in 5.2.10 would work, no? Reference documentation: http://sg.php.net/manual/en/context.http.php Best, Tjerk On Sun, May 17, 2009 at 8:42 AM, Tjerk Anne Meesters datib...@php.net wrote: But ignore_errors is not used in 5.2 right? ;-) I also have a patch for that actually if you're interested =D On 5/17/09, Arnaud Le Blanc lbarn...@php.net wrote: Yes, the fix requires ignore_errors, which is new in 5.3. The bug can't be fixed in 5.2 without breaking compatibility. Regards, Arnaud On Sun, 2009-05-17 at 02:02 +0300, Jani Taskinen wrote: Last 7 commits or so, none went to PHP_5_2. Intentionally? We usually fix bugs in the branch they're reported for also.. --Jani Arnaud Le Blanc kirjoitti: I commited your change as it fixes a bug, thanks for the patch :) I also followed your idea of a server to test http streams (ftp extension does this, too) and wrote a test for this bug. Other http tests are welcome if you want to write some. Regards, Arnaud On Sat, 2009-05-16 at 16:42 +0800, Tjerk Anne Meesters wrote: On a related note, I've been working on a phpt to verify the behaviour during which I've noticed a lack of test cases for networked functions in general. The solution I have in mind depends on pcntl_fork(), which practically takes out Windows test targets. It essentially forks out a child to perform the test while the parent starts a socket_server. I suppose it would be nice if the test framework could somehow be extended to pose as a webserver to verify typical http behaviour inside stream wrappers =D This can't be the first time that this has been a point of discussion; my apologies if this has been outright rejected before ;-) On 5/16/09, Arnaud Le Blanc lbarn...@php.net wrote: On Fri, 2009-05-15 at 11:49 -0400, Ilia Alshanetsky wrote: the patch looks good. Same here. Lukas, Johannes, can this be commited to 5.3 ? Regards, Arnaud Ilia Alshanetsky On 15-May-09, at 11:36 AM, Tjerk Anne Meesters wrote: Hi Arnaud, Thanks for the tip, please find patch attached. Best, Tjerk On Fri, May 15, 2009 at 10:58 PM, Arnaud Le Blanc lbarn...@php.net wrote: Hi, On Fri, 2009-05-15 at 22:16 +0800, Tjerk Anne Meesters wrote: Hi, I've been extending the pecl/oauth code to work with php stream wrappers in cases whereby curl is not enabled, but I've hit a snag. The documentation states that enabling the ignore_errors flag will fetch the content even on failure status codes. At the same time, setting max_redirects to = 1 indicates that no redirects will be followed. It does not state that setting max_redirects = 1 would actually trigger an error, though in the code it returns (php_stream *)NULL making it impossible to even get the headers out of the wrapperdata hash unless STREAM_ONLY_GET_HEADERS is used. So, either setting max_redirects = 1 should not throw NULL back into the caller code or ignore_error behaviour should be extended to prevent that from happening. My attached patch favours to fix the latter, since the ignore_errors is a relatively new flag. Hope it will be accepted for the 5.3 release. max_redirects's purpose is to avoid infinite loops, etc. Stream functions are expected to return an error in case the limit is exceeded. If they do not, scripts will get an empty body without noticing the error (changing this may break existing scripts). ignore_errors is a new flag, it forces scripts to check HTTP status code (so that scripts will notice non-200 ones) and changing it to ignore redirects when max_redirects is exceeded seems to be a good solution. (not sure whether attachments will be allowed ... give me a ping if it doesn't make it through) The list accepts only text/plain attachments (try renaming your patch to .txt). Regards, Arnaud -- -- Tjerk http_fopen_wrapper.c.patch.txt-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- -- Tjerk -- -- Tjerk -- --
[PHP-DEV] Re: Suggestion on static field inheritance
Nobody is interested in this topic? Another confusing feature is static function, which is allowed in interface, but not allowed in abstract class, any explanation or reason for this? Thanks :-) 2009/5/16 Jingcheng Zhang dio...@gmail.com Hello all, Maybe I have not found its detailed description on PHP's official manual, but PHP does allow static field inheritance. However there is a little difference between dynamic field inheritance and static field inheritance, as the following codes shows: ?php class static_a { public static function change($name) { self::$name = $name; } public static $name = 'a'; } class static_c extends static_a {} class static_d extends static_a {} echo static_a::$name; // a static_c::change('c'); echo static_a::$name; // c static_d::change('d'); echo static_a::$name; // d class dynamic_a { public function change($name) { $this-name = $name; } public $name = 'a'; } class dynamic_c extends dynamic_a {} class dynamic_d extends dynamic_a {} $a = new dynamic_a(); $c = new dynamic_c(); $d = new dynamic_d(); echo $a-name; // a $c-change('c'); echo $a-name; // a $d-change('d'); echo $a-name; // a ? The result of static inheritance test can be meaningful on some way(especially on class-based programming perspective), but when considering the static class as object in prototype-based programming(which I doubt is some people's favourite who comes from prototype-based OOP community), this result can be confusing. On JavaScript, this example can be: script type=text/javascript function extends(parent) { var T = function () {}; T.prototype = parent; return new T(); } var static_a = { name: 'a', change: function (name) { this.name = name; } }; var static_c = extends(static_a); var static_d = extends(static_a); alert(static_a.name); // a static_c.change('c'); alert(static_a.name); // a static_d.change('d'); alert(static_a.name); // a /script This looks more meaningful. So my suggestion is, could PHP's static inheritance rule follow the dynamic inheritance rule ( $this on dynamic, or prototype delegation on JavaScript) ? Thanks :-) -- Best regards, Jingcheng Zhang P.R.China -- Best regards, Jingcheng Zhang Room 304, Dormitory 26 of Yuquan Campus, Zhejiang University P.R.China
Re: [PHP-DEV] Re: extending ignore_errors inside http_fopen_wrappers.c
Arnaud Le Blanc kirjoitti: Yes, the fix requires ignore_errors, which is new in 5.3. The bug can't be fixed in 5.2 without breaking compatibility. Ok. Perhaps it would be good idea to always mention these things in the commit messages.. :) Anyway, this was supposed to fix bug #38802 which was reported for 5.2.9. Apparently backporting this simple thing to PHP_5_2 could be considerd a bug fix. Ilia? --Jani Regards, Arnaud On Sun, 2009-05-17 at 02:02 +0300, Jani Taskinen wrote: Last 7 commits or so, none went to PHP_5_2. Intentionally? We usually fix bugs in the branch they're reported for also.. --Jani Arnaud Le Blanc kirjoitti: I commited your change as it fixes a bug, thanks for the patch :) I also followed your idea of a server to test http streams (ftp extension does this, too) and wrote a test for this bug. Other http tests are welcome if you want to write some. Regards, Arnaud On Sat, 2009-05-16 at 16:42 +0800, Tjerk Anne Meesters wrote: On a related note, I've been working on a phpt to verify the behaviour during which I've noticed a lack of test cases for networked functions in general. The solution I have in mind depends on pcntl_fork(), which practically takes out Windows test targets. It essentially forks out a child to perform the test while the parent starts a socket_server. I suppose it would be nice if the test framework could somehow be extended to pose as a webserver to verify typical http behaviour inside stream wrappers =D This can't be the first time that this has been a point of discussion; my apologies if this has been outright rejected before ;-) On 5/16/09, Arnaud Le Blanc lbarn...@php.net wrote: On Fri, 2009-05-15 at 11:49 -0400, Ilia Alshanetsky wrote: the patch looks good. Same here. Lukas, Johannes, can this be commited to 5.3 ? Regards, Arnaud Ilia Alshanetsky On 15-May-09, at 11:36 AM, Tjerk Anne Meesters wrote: Hi Arnaud, Thanks for the tip, please find patch attached. Best, Tjerk On Fri, May 15, 2009 at 10:58 PM, Arnaud Le Blanc lbarn...@php.net wrote: Hi, On Fri, 2009-05-15 at 22:16 +0800, Tjerk Anne Meesters wrote: Hi, I've been extending the pecl/oauth code to work with php stream wrappers in cases whereby curl is not enabled, but I've hit a snag. The documentation states that enabling the ignore_errors flag will fetch the content even on failure status codes. At the same time, setting max_redirects to = 1 indicates that no redirects will be followed. It does not state that setting max_redirects = 1 would actually trigger an error, though in the code it returns (php_stream *)NULL making it impossible to even get the headers out of the wrapperdata hash unless STREAM_ONLY_GET_HEADERS is used. So, either setting max_redirects = 1 should not throw NULL back into the caller code or ignore_error behaviour should be extended to prevent that from happening. My attached patch favours to fix the latter, since the ignore_errors is a relatively new flag. Hope it will be accepted for the 5.3 release. max_redirects's purpose is to avoid infinite loops, etc. Stream functions are expected to return an error in case the limit is exceeded. If they do not, scripts will get an empty body without noticing the error (changing this may break existing scripts). ignore_errors is a new flag, it forces scripts to check HTTP status code (so that scripts will notice non-200 ones) and changing it to ignore redirects when max_redirects is exceeded seems to be a good solution. (not sure whether attachments will be allowed ... give me a ping if it doesn't make it through) The list accepts only text/plain attachments (try renaming your patch to .txt). Regards, Arnaud -- -- Tjerk http_fopen_wrapper.c.patch.txt-- 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] First test submission and comment correction
Simon Westcott wrote: Thanks for accepting and the feedback. Following on from the successful NorthWestUG testfest, I'm continuing to focus on SPL and currently have 24 tests awaiting review in the testfest SVN repo (with the CREDITS section :) ). Once this repo is shutdown (in June?) I'd like to find out more about test review process with the view to applying for a CVS account. That's really excellent. Do you think you'll start to look at PHP bugs too? Chris Also, thanks to Pierre for answering some zend_parse_parameters questions the other night. -- Email: christopher.jo...@oracle.com Twitter: http://twitter.com/ghrd -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php