Re: [PHP-DEV] PHP and two phase commit transactions
Dear all, I'm the author of LIXA project (http://lixa.sourceforge.net/) and I would discuss a little about two phase commit transactions for PHP applications. Besides all technical discussions etc one legal comment, on the project page I read: Which type of license applies to LIXA project? The whole LIXA project is released under the terms of GNU Public License (GPL) version 2. http://sourceforge.net/apps/mediawiki/lixa/index.php?title=FAQ:_Frequently_Asked_Questions#License It then mentions bla bla bla about restrictions imposed by the GPL. One restriction is that the GPL is not compatible with the current PHP License. Therefore lixa can't be combined with PHP. See http://www.gnu.org/licenses/license-list.html#PHP-3.01 johannes I do know this restriction is in place, but the solution will be quite easy: I could split the project licensing policy: the lixad code (state server) might be GPL and lixac code (client libraries embedded transaction manager) might be LGPL. The IP of the project is mine, so there would be no issue on this side. If I did understand there's a really interest about LIXA PHP, I might move in this direction. Ch.F. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP and two phase commit transactions
1. Is there any interest in two phase commit inside PHP community? Without a real interest, every effort would be useless. I can't speak to a critical mass of interest, but as PHP and MySQL are closely coupled in the real world, until relatively recently (when Inno became the default) that meant that PHP and MyISAM were best buds. I don't know how you could do 2PC between two transaction-unaware back ends. I could see one transaction-aware and one transaction-unaware working by running synchronously w/the transactional one first (?). LIXA can be coupled only with resource managers that supports some form of XA protocol. When the resource manager is truly XA compliant (Oracle DBMS, IBM DB2, IBM WebSphere MQ) LIXA code is just a wrapper of the XA switch file provided by the resource manager. When the resource manager is partially XA compliant (PostgreSQL, MySQL with InnoDB) LIXA code adds some logic to emulate a standard XA switch file. MySQL itself is affected by this serious bug http://bugs.mysql.com/bug.php?id=12161 that violates XA specification. Despite it, LIXA tries to do its best to support XA for MySQL. MySQl and MyISAM can not be used in conjuction with LIXA for distributed transaction processing. So my sense is that PHP, because of MyISAM's ubiquity, isn't the ideal language target for 2PC (compared to Java/.NET where the most enterprise back end is assumed, however inaccurately!). That doesn't mean there wouldn't be some interest, though. -- S. Ch. F. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] BreakIterator
Hi I've wrapped ICU's BreakIterator and RuleBasedBreakIterator. I stopped short of adding a procedural interface. I think there's a larger expectation of a having an OOP interface when working with iterators. What do you think? If there's no procedural interface, I'll change the instances of zend_parse_methods to zpp for performance. Now I'll copy the commit message here if someone want to comment on a specific point inline: BreakIterator and RuleBasedBreakiterator added This commit adds wrappers for the classes BreakIterator and RuleBasedbreakIterator. The C++ ICU classes are described here: http://icu-project.org/apiref/icu4c/classBreakIterator.html http://icu-project.org/apiref/icu4c/classRuleBasedBreakIterator.html Additionally, a tutorial is available at: http://userguide.icu-project.org/boundaryanalysis This implementation wraps UTF-8 text in a UText. The text is iterated without any copying or conversion to UTF-16. There is also no validation that the input is actually UTF-8; where there are malformed sequences, the UText will simply U+FFFD. The class BreakIterator cannot be instantiated directly (has a private constructor). It provides the interface exposed by the ICU abstract class with the same name. The PHP class is not abstract because we may use it to wrap native subclasses of BreakIterator that we don't know how to wrap. This class includes methods to move the iterator position to the beginning (first()), to the end (last()), forward (next()), backwards (previous()), to the boundary preceding a certain position (preceding()) and following a certain position (following()) and to obtain the current position (current()). next() can also be used to advance or recede an arbitrary number of positions. BreakIterator also exposes other native methods: getAvailableLocales(), getLocale() and factory methods to build several predefined types of BreakIterators: createWordInstance() for word boundaries, createCharacterInstance() for locale dependent notions of characters, createSentenceInstance() for sentences, createLineInstance() and createTitleInstance() -- for title casing breaks. These factories currently return RuleBasedbreakIterators where the names of the rule sets are found in the ICU data, observing the passed locale (although the locale is taken into considering there are very few exceptions to the root rules). The clone and compare_object PHP object handlers are also implemented, though the comparison does not yield meaningful results when used with , , = and =. Note that BreakIterator is an iterator only in the sense of the first 'Iterator' in 'IteratorIterator', i.e., it does not implement the Iterator interface. The reason is that there is no sensible implementation for Iterator::key(). Using it for an ordinal of the current boundary is not feasible because we are allowed to move to any boundary at any time. It we were to determine the current ordinal when last() is called we'd have to traverse the whole input text to find out how many breaks there were before. Therefore, BreakIterator implements only Traversable. It can be wrapped in an IteratorIterator, but the usual warnings apply. Finally, I added a convenience method to BreakIterator: getPartsIterator(). This provides an IntlIterator, backed by the BreakIterator PHP object (i.e. moving the pointer or changing the text in BreakIterator affects the iterator and also moving the iterator affects the backing BreakIterator), which allows traversing the text between each boundary. This iterator uses the original text to retrieve the text between two positions, not the code points returned by the wrapping UText. Therefore, if the text includes invalid code unit sequences, these invalid sequences will be in the output of this iterator, not U+FFFD code points. The class RuleBasedIterator exposes a constructor that allows building an iterator from arbitrary compiled or non-compiled rules. The form of these rules in described in the tutorial linked above. The rest of the methods allow retrieving the rules -- getRules() and getCompiledRules() --, a hash code of the rule set (hashCode()) and the rules statuses (getRuleStatus() and getRuleStatusVec()). Because the RuleBasedBreakIterator constructor may return parse errors, I reuse the UParseError to text function that was in the transliterator files. Therefore, I move that function to intl_error.c. common_enum.cpp was also changed, mainly to expose previously static functions. This avoided code duplication when implementing the BreakIterator iterator and the IntlIterator returned by BreakIterator::getPartsIterator(). -- Gustavo Lopes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] BreakIterator
Coming from a pleb, my only concern is the name if the class is in the global scope. A BreakIterator to me sounds like something related to breaking out of a looping structure, and not something used for iterating over various language structure boundaries. If it's in a ICU namespace, then it's not a problem, as it's clearly related to Unicode. Cheers, David On 31/05/12 21:21, Gustavo Lopes wrote: Hi I've wrapped ICU's BreakIterator and RuleBasedBreakIterator. I stopped short of adding a procedural interface. I think there's a larger expectation of a having an OOP interface when working with iterators. What do you think? If there's no procedural interface, I'll change the instances of zend_parse_methods to zpp for performance. Now I'll copy the commit message here if someone want to comment on a specific point inline: BreakIterator and RuleBasedBreakiterator added This commit adds wrappers for the classes BreakIterator and RuleBasedbreakIterator. The C++ ICU classes are described here: http://icu-project.org/apiref/icu4c/classBreakIterator.html http://icu-project.org/apiref/icu4c/classRuleBasedBreakIterator.html Additionally, a tutorial is available at: http://userguide.icu-project.org/boundaryanalysis This implementation wraps UTF-8 text in a UText. The text is iterated without any copying or conversion to UTF-16. There is also no validation that the input is actually UTF-8; where there are malformed sequences, the UText will simply U+FFFD. The class BreakIterator cannot be instantiated directly (has a private constructor). It provides the interface exposed by the ICU abstract class with the same name. The PHP class is not abstract because we may use it to wrap native subclasses of BreakIterator that we don't know how to wrap. This class includes methods to move the iterator position to the beginning (first()), to the end (last()), forward (next()), backwards (previous()), to the boundary preceding a certain position (preceding()) and following a certain position (following()) and to obtain the current position (current()). next() can also be used to advance or recede an arbitrary number of positions. BreakIterator also exposes other native methods: getAvailableLocales(), getLocale() and factory methods to build several predefined types of BreakIterators: createWordInstance() for word boundaries, createCharacterInstance() for locale dependent notions of characters, createSentenceInstance() for sentences, createLineInstance() and createTitleInstance() -- for title casing breaks. These factories currently return RuleBasedbreakIterators where the names of the rule sets are found in the ICU data, observing the passed locale (although the locale is taken into considering there are very few exceptions to the root rules). The clone and compare_object PHP object handlers are also implemented, though the comparison does not yield meaningful results when used with , , = and =. Note that BreakIterator is an iterator only in the sense of the first 'Iterator' in 'IteratorIterator', i.e., it does not implement the Iterator interface. The reason is that there is no sensible implementation for Iterator::key(). Using it for an ordinal of the current boundary is not feasible because we are allowed to move to any boundary at any time. It we were to determine the current ordinal when last() is called we'd have to traverse the whole input text to find out how many breaks there were before. Therefore, BreakIterator implements only Traversable. It can be wrapped in an IteratorIterator, but the usual warnings apply. Finally, I added a convenience method to BreakIterator: getPartsIterator(). This provides an IntlIterator, backed by the BreakIterator PHP object (i.e. moving the pointer or changing the text in BreakIterator affects the iterator and also moving the iterator affects the backing BreakIterator), which allows traversing the text between each boundary. This iterator uses the original text to retrieve the text between two positions, not the code points returned by the wrapping UText. Therefore, if the text includes invalid code unit sequences, these invalid sequences will be in the output of this iterator, not U+FFFD code points. The class RuleBasedIterator exposes a constructor that allows building an iterator from arbitrary compiled or non-compiled rules. The form of these rules in described in the tutorial linked above. The rest of the methods allow retrieving the rules -- getRules() and getCompiledRules() --, a hash code of the rule set (hashCode()) and the rules statuses (getRuleStatus() and getRuleStatusVec()). Because the RuleBasedBreakIterator constructor may return parse errors, I reuse the UParseError to text function that was in the transliterator files. Therefore, I move that function to intl_error.c. common_enum.cpp was also changed, mainly to expose previously static functions. This avoided code duplication
[PHP-DEV] PHP 5.4.4RC2 Released
Hi! We would like to announce the second RC of the 5.4.4 version. This is mainly a bugfix release. The release includes a fix for a weakness crypts() DES implementation (CVE-2012-2143). Please test it and notify us of any problems you may encounter. The full list of the fixes is as always in the NEWS file. You can download the packages from: http://downloads.php.net/stas The Windows team provides windows binaries for the release. As always you find them at: http://windows.php.net/qa/ We plan the next RC for 5.4.4 in two weeks. Regards, Stas David -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP and two phase commit transactions
MySQl and MyISAM can not be used in conjuction with LIXA for distributed transaction processing. Should be very clear about this in your documentation, as MySQL as RM will be unsupported in practice in the majority of *MP installations. You didn't mention MSSQL, I assume because you develop only on Ubuntu and/or because of other issues, nor SQLite. These cut out wide slices of general PHP users. (As a side note, I am very frustrated when extensions act like PHP on Windows doesn't exist so it isn't even worth a not supported note.) Again, none of these rule out interest, even gotta-get-it-now interest, in a LIXA extension for PHP, but it mitigates the portion of users who have the technical environment to act on that interest. -- S. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Bad eval() leading to response code 500
It feels like there is a bug in php somewhere. I'm trying to debug this myself before filing a report and am in over my head. The short version of my question may be How do I set a watch on SG(sapi_headers).http_response_code in the gdb? I think I need to debug it myself because I haven't been able to reproduce it in a simple case. The following simple case works: ?php // In the real application there is a lot of code before this. $x = eval('$y=0+;'); if ($x === false) { $x = 'Unknown'; } // In the real application there is a lot of code between the // above and the below. print x is $x\n; ? That always gives success. In my big ugly application, I get a response code 500 if the eval is given poorly formed code. The exact same request is processed happily if the eval of poorly formed code is commented out or replaced with an eval of good code. The poorly formed code can be as simple as the above example ('$y=0+;'). I've rebuilt apache 1.3.37 so that I can use gdb. (I'm using php 5.4.3) After about 10 hours I've only gotten as far as learning that r-status becomes 500 while the headers are being prepared at the time of the print. That happens in mod_php5.c on line 231: r-status = SG(sapi_headers).http_response_code; I guess my next step is to find out when SG(sapi_headers).http_response_code became 500. Given that the problem appears/goes away based on whether the eval is given bad code, I'm guessing the response_code is being affected by the eval(), but I'd like to be more concrete about it and maybe even be able to come up with a fix (or at least a good enough description that someone who really understands internals can come up with a fix without much trouble). Perhaps I've completely misunderstood something about php and should be directing this to a different list. My confidence is high that a bad eval() shouldn't ruin the page, so I'm here looking for debugging advice. If I'm in the wrong place, I apologize. Thanks for any pointers! - Todd -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Bad eval() leading to response code 500
[I'm afraid of getting flamed for how bad the code was in the example in my first email. I've replaced the example in this email. The rest is the same. The example still isn't great, but it's better than before.] It feels like there is a bug in php somewhere. I'm trying to debug this myself before filing a report and am in over my head. The short version of my question may be How do I set a watch on SG(sapi_headers).http_response_code in the gdb? I think I need to debug it myself because I haven't been able to reproduce it in a simple case. The following simple case works: ?php function f($processed_string) { // eval returns false on failure (e.g. division by 0) $eval_result = @eval('$retval=('.$processed_string.');'); if ($eval_result === false) { return 'Unknown'; } return $retval; } print f('0+5').\n; // Good print f('0(6)').\n; // Bad, but shouldn't lead to code 500 print f('0+').\n; // Bad, but shouldn't lead to code 500 ? That example doesn't return code 500. But my big ugly application does. I get a response code 500 if the eval is given poorly formed code. The exact same request is processed happily if the eval of poorly formed code is commented out or replaced with an eval of good code. The poorly formed code can be as simple as in the above example. I've rebuilt apache 1.3.37 so that I can use gdb. (I'm using php 5.4.3) After about 10 hours I've only gotten as far as learning that r-status becomes 500 while the headers are being prepared at the time of the print. That happens in mod_php5.c on line 231: r-status = SG(sapi_headers).http_response_code; I guess my next step is to find out when SG(sapi_headers).http_response_code became 500. Given that the problem appears/goes away based on whether the eval is given bad code, I'm guessing the response_code is being affected by the eval(), but I'd like to be more concrete about it and maybe even be able to come up with a fix (or at least a good enough description that someone who really understands internals can come up with a fix without much trouble). Perhaps I've completely misunderstood something about php and should be directing this to a different list. My confidence is high that a bad eval() shouldn't ruin the page, so I'm here looking for debugging advice. If I'm in the wrong place, I apologize. Thanks for any pointers! - Todd -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php