Req #60742 [Com]: FilesystemIterator::OTHER_MODE_MASK
Edit report at https://bugs.php.net/bug.php?id=60742&edit=1 ID: 60742 Comment by: jthijssen at noxlogic dot nl Reported by:jthijssen at noxlogic dot nl Summary:FilesystemIterator::OTHER_MODE_MASK Status: Assigned Type: Feature/Change Request Package:SPL related PHP Version:5.4.0RC5 Assigned To:colder Block user comment: N Private report: N New Comment: Pull request merged by dsp_ into the git 5.4 branch: https://github.com/php/php-src/pull/5 Previous Comments: [2012-01-13 12:44:46] jthijssen at noxlogic dot nl Description: The FileSystemIterator defines a few constants to mask its flags: CURRENT_MODE_MASK and KEY_MODE_MASK. However, there are other flags (SKIP_DOTS and UNIX_PATHS) which cannot be masked of by a constant. However, internally, there is a mask constant defined (SPL_FILE_DIR_OTHERS_MASK). It makes sense that this value is also known in PHP userland by the OTHER_MODE_MASK constant. The attached patch adds this constant and is compatible with trunk, php_5_4 and php_5_3 branches. Test script: --- getFlags() & FileSystemIterator::OTHER_MODE_MASK); print $masked_flags; Expected result: 4096 Actual result: -- PHP Notice: Use of undefined constant OTHER_MODE_MASK - assumed 'OTHER_MODE_MASK' -- Edit this bug report at https://bugs.php.net/bug.php?id=60742&edit=1
[PHP-BUG] Bug #60762 [NEW]: IteratorIterator doesn't iterate over DomNodeList
From: Operating system: PHP version: 5.4.0RC5 Package: SPL related Bug Type: Bug Bug description:IteratorIterator doesn't iterate over DomNodeList Description: When creating an IteratorIterator from a DomNodeList, it doesn't behave correctly. The current example behaves like the iterator-key is not reset properly when iterating although the value returned is indeed the first entry of the iterator. Test script: --- $XML = <<< XML 1 2 3 XML; $dom = new DomDocument(); $dom->loadXml($XML); $items = $dom->getElementsByTagName('item'); foreach ($items as $k => $item) { print "K: ".$k." Item: ".$item->nodeName. " Value: ".$item->nodeValue. PHP_EOL; } print "" . PHP_EOL; $it = new IteratorIterator($items); foreach ($it as $k => $item) { print "K: ".$k." Item: ".$item->nodeName. " Value: ".$item->nodeValue. PHP_EOL; } Expected result: K: 0 Item: item Value: 1 K: 1 Item: item Value: 2 K: 2 Item: item Value: 3 K: 0 Item: item Value: 1 K: 1 Item: item Value: 2 K: 2 Item: item Value: 3 Actual result: -- K: 0 Item: item Value: 1 K: 1 Item: item Value: 2 K: 2 Item: item Value: 3 K: 3 Item: item Value: 1 -- Edit bug report at https://bugs.php.net/bug.php?id=60762&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60762&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60762&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60762&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60762&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60762&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60762&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60762&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60762&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60762&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60762&r=support Expected behavior: https://bugs.php.net/fix.php?id=60762&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60762&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60762&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60762&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60762&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60762&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60762&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60762&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60762&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60762&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60762&r=mysqlcfg
[PHP-BUG] Req #60742 [NEW]: FilesystemIterator::OTHER_MODE_MASK
From: Operating system: PHP version: 5.4.0RC5 Package: SPL related Bug Type: Feature/Change Request Bug description:FilesystemIterator::OTHER_MODE_MASK Description: The FileSystemIterator defines a few constants to mask its flags: CURRENT_MODE_MASK and KEY_MODE_MASK. However, there are other flags (SKIP_DOTS and UNIX_PATHS) which cannot be masked of by a constant. However, internally, there is a mask constant defined (SPL_FILE_DIR_OTHERS_MASK). It makes sense that this value is also known in PHP userland by the OTHER_MODE_MASK constant. The attached patch adds this constant and is compatible with trunk, php_5_4 and php_5_3 branches. Test script: --- getFlags() & FileSystemIterator::OTHER_MODE_MASK); print $masked_flags; Expected result: 4096 Actual result: -- PHP Notice: Use of undefined constant OTHER_MODE_MASK - assumed 'OTHER_MODE_MASK' -- Edit bug report at https://bugs.php.net/bug.php?id=60742&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60742&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60742&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60742&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60742&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60742&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60742&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60742&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60742&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60742&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60742&r=support Expected behavior: https://bugs.php.net/fix.php?id=60742&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60742&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60742&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60742&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60742&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60742&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60742&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60742&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60742&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60742&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60742&r=mysqlcfg
Req #49007 [Com]: Add limit option to trim functions
Edit report at http://bugs.php.net/bug.php?id=49007&edit=1 ID: 49007 Comment by: jthijssen at noxlogic dot nl Reported by:jason at jasonsw dot com Summary:Add limit option to trim functions Status: Open Type: Feature/Change Request Package:Strings related Operating System: * PHP Version:* Block user comment: N Private report: N New Comment: I've added a patch (both 5.3 and trunk) for adding a "limit" to the [lr]?trim() functions. Using a limit of -1 will trim all (same as without adding the limit) A limit of 0 does nothing (no trimming) A positive limit will only trim the amount of chars as specified ON BOTH SIDES. This means using a limit of 2 in trim() will strip max 2 chars from the left and max 2 chars from the right: trim(" hello ", " ", 2) returns " hello "; ltrim(" hello ", " ", 2) returns " hello "; The only problem to keep it backwards compatible is that you must add the default charlist ( \n\r\t\v\0) in order to use the limit parameter. Previous Comments: [2009-07-21 17:06:58] jason at jasonsw dot com Description: It would be great if there was a way to limit the amount of characters that were trimmed from a string, in either ltrim, trim or rtrim, using a new limit parameter. Reproduce code: --- --- >From manual page: function.ltrim --- -- Edit this bug report at http://bugs.php.net/bug.php?id=49007&edit=1
Req #5975 [Com]: version of strip_tags() that specifies tags to strip (instead of tags to keep)
Edit report at http://bugs.php.net/bug.php?id=5975&edit=1 ID: 5975 Comment by: jthijssen at noxlogic dot nl Reported by:muhlig at us dot edu dot pl Summary:version of strip_tags() that specifies tags to strip (instead of tags to keep) Status: Open Type: Feature/Change Request Package:Strings related Operating System: * PHP Version:* Block user comment: N Private report: N New Comment: This bug is a duplicate of #23723. A patch for this feature is added to that bug. Previous Comments: [2000-08-04 20:51:01] muhlig at us dot edu dot pl Because I'd like to strip much less tags than I'd like to remain in the HTML file (and I suppose there are more people who would like such a feature) I'd suggest to accompany strip_tags with its counterpart: string strip_tags (string str [, string allowable_tags]) in the following way (more or less): string strip_some_tags (string str [, string not_allowable_tags]) or enhance strip_tags in order to allow only these tags which are not allowed to exist in the resulting string. -- Edit this bug report at http://bugs.php.net/bug.php?id=5975&edit=1
Bug #48711 [Com]: metaphone() and sch, ch, gh
Edit report at http://bugs.php.net/bug.php?id=48711&edit=1 ID: 48711 Comment by: jthijssen at noxlogic dot nl Reported by:brettz9 at yahoo dot com Summary:metaphone() and sch, ch, gh Status: Feedback Type: Bug Package:Strings related Operating System: Windows PHP Version:5.3 Assigned To:pajoye Block user comment: N Private report: N New Comment: Pierre, I've added a phpt testcase inside the patch (bug48711.phpt). Or do you mean a phpt for the extra metaphone parameter (probably a metaphone_variation.phpt)? Previous Comments: [2011-02-26 20:18:33] paj...@php.net hi, Thanks for the patch! Can you add a test case for it please? [2011-02-26 19:54:08] jthijssen at noxlogic dot nl I've added a patch with the 4 items as described by brettz9. The first one introduces a "traditional" boolean flag in metaphone as a third optional parameter. I'm not 100% sure why this parameter is here. Either we should always convert CHR/SCH to X or to K. It makes the function much more complicated this way for end-users. [2009-08-03 01:00:02] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [2009-07-26 19:36:59] j...@php.net Please provide patches against all current branches, I don't think this is just an issue with HEAD? [2009-06-29 04:06:33] brettz9 at yahoo dot com My apologies, I was off by one line number in item #4; it should instead say: inside the first 'if' of the 2nd 'G' case (insert right after line 342): The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=48711 -- Edit this bug report at http://bugs.php.net/bug.php?id=48711&edit=1
Bug #48711 [Com]: metaphone() and sch, ch, gh
Edit report at http://bugs.php.net/bug.php?id=48711&edit=1 ID: 48711 Comment by: jthijssen at noxlogic dot nl Reported by:brettz9 at yahoo dot com Summary:metaphone() and sch, ch, gh Status: No Feedback Type: Bug Package:Strings related Operating System: Windows PHP Version:6CVS-2009-06-29 (snap) Block user comment: N Private report: N New Comment: I've added a patch with the 4 items as described by brettz9. The first one introduces a "traditional" boolean flag in metaphone as a third optional parameter. I'm not 100% sure why this parameter is here. Either we should always convert CHR/SCH to X or to K. It makes the function much more complicated this way for end-users. Previous Comments: [2009-08-03 01:00:02] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [2009-07-26 19:36:59] j...@php.net Please provide patches against all current branches, I don't think this is just an issue with HEAD? [2009-06-29 04:06:33] brettz9 at yahoo dot com My apologies, I was off by one line number in item #4; it should instead say: inside the first 'if' of the 2nd 'G' case (insert right after line 342): [2009-06-29 04:00:29] brettz9 at yahoo dot com Description: Below are a few bugs remaining in metaphone()--they are both useful and follow the original implementation. I haven't tested them (a newbie to C), but they seem to follow the precise pattern. 1) SCH: There seems to be no way for the 'traditional' argument in metaphone() to be triggered (it is called on line 44 with '1' which disables those items depending on it). Shouldn't it be set to '0' in the call on line 44 (or have the requirement removed entirely)? For example, line 314 is not working now for treating items like "ch" in "school" as "K". If there's no way to trigger the behavior (and the behavior should be standard), it seems to me best to remove the requirement. 2) CH: should check for first position 'C': if the next char is 'H' and then a vowel, it should produce 'K' To fix, in the switch beginning at 205 for initial character (e.g., could put before 219): case 'C': if (Next_Letter == 'H' && isvowel(After_Next_Letter)) { // 'character' Phonize('K'); w_idx += 2; } break; 3) GH: should be pronounced as 'K' if at the beginning (and if then followed by a vowel), not as 'F'; The case for initial 'G' on line 219 could be changed to: case 'G': if (Next_Letter == 'H' && isvowel(After_Next_Letter)) { // 'ghent' Phonize('K'); w_idx += 2; break; } else 4) GH: should be silent in the likes of 'knight'/'wright', not 'F' under the 2nd 'G' case (insert right after line 341): if (After_Next_Letter != '\0' && !isvowel(After_Next_Letter) { // 'gh' followed by consonant, as in 'knight' /* silent */ } else Thanks! Reproduce code: --- '; echo metaphone('character'), ''; echo metaphone('ghent'), ''; echo metaphone('knight'), ''; ?> Expected result: SKL KRKTR KNT NT Actual result: -- SXL XRKTR FNT NFT -- Edit this bug report at http://bugs.php.net/bug.php?id=48711&edit=1
Req #23723 [Com]: Extend strip_tags()
Edit report at http://bugs.php.net/bug.php?id=23723&edit=1 ID: 23723 Comment by: jthijssen at noxlogic dot nl Reported by:eric at evilwalrus dot com Summary:Extend strip_tags() Status: Assigned Type: Feature/Change Request Package:Strings related Operating System: * PHP Version:* Assigned To:moriyoshi Block user comment: N Private report: N New Comment: I've added the patch base64 encoded because of a bug in php's bugtracker (bug #53703). Previous Comments: [2011-01-09 21:16:09] jthijssen at noxlogic dot nl I know it's a (very) old bug, but on occasion I need a "blacklist" intead of a "whitelist" strip_tags() function. I've created a patch with an addtional bool to strip_tags() with which you can use the $allowable_tags parameter as a blacklist instead of a whitelist. Examples: strip_tags('Clickhere', ''); => Clickhere strip_tags('Clickhere', '', false); => Clickhere [2003-05-20 13:47:14] eric at evilwalrus dot com Right now strip_tags() is a great function. You specify a string and the tags you want to keep. What I would like to see is another argument in strip tags so that you could tell it to keep or remove the tags you specify. I saw bug #5976 that had something to do with this very thought, but this extends the idea further. For example, if I have a string full of HTML and I want to remove all
[PHP-BUG] Req #53709 [NEW]: [feat] md5_file and sha1_file should accept an additional length
From: Operating system: NA PHP version: 5.3SVN-2011-01-10 (SVN) Package: Strings related Bug Type: Feature/Change Request Bug description:[feat] md5_file and sha1_file should accept an additional length Description: Sometimes you want to have the md5() or sha1() from a file, but not the whole file. This is particularly handy when you want to sync directories and you don't want to md5 whole files but just the first 4096 or 8192 bytes to speed up the checking. This patch implements an additional parameter to md5_file() and sha1_file() where you can add the number of bytes that needs to be read/md5()'d from the source file. Test script: --- Returns the md5 from the first 8192 bytes from the iso-file: md5_file('dvdimage.iso', false, 8192); Returns the md5 from the complete file, even though length is way larger than the file: md5_file('dvdimage.iso', false, 8192000); Expected result: The md5_file() and sha1_file() functions actually accepting the additional parameter. Actual result: -- Currently, it does not accept a 3rd paramter. The patch adds the additional parameter (which defaults to -1, which means to read the complete file). Additionally added and fixed tests in md5_file.phpt and sha1_file.phpt -- Edit bug report at http://bugs.php.net/bug.php?id=53709&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53709&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53709&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53709&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53709&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53709&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53709&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53709&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53709&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53709&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53709&r=support Expected behavior: http://bugs.php.net/fix.php?id=53709&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53709&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53709&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53709&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53709&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=53709&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53709&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53709&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53709&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53709&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53709&r=mysqlcfg
Req #53709 [Com]: [feat] md5_file and sha1_file should accept an additional length
Edit report at http://bugs.php.net/bug.php?id=53709&edit=1 ID: 53709 Comment by: jthijssen at noxlogic dot nl Reported by:jthijssen at noxlogic dot nl Summary:[feat] md5_file and sha1_file should accept an additional length Status: Open Type: Feature/Change Request Package:Strings related Operating System: NA PHP Version:5.3SVN-2011-01-10 (SVN) Block user comment: N Private report: N New Comment: I've added the patch in a base64 format because of a bug in the php bugtracker (bug #53703). Previous Comments: [2011-01-10 22:11:44] jthijssen at noxlogic dot nl Description: Sometimes you want to have the md5() or sha1() from a file, but not the whole file. This is particularly handy when you want to sync directories and you don't want to md5 whole files but just the first 4096 or 8192 bytes to speed up the checking. This patch implements an additional parameter to md5_file() and sha1_file() where you can add the number of bytes that needs to be read/md5()'d from the source file. Test script: --- Returns the md5 from the first 8192 bytes from the iso-file: md5_file('dvdimage.iso', false, 8192); Returns the md5 from the complete file, even though length is way larger than the file: md5_file('dvdimage.iso', false, 8192000); Expected result: The md5_file() and sha1_file() functions actually accepting the additional parameter. Actual result: -- Currently, it does not accept a 3rd paramter. The patch adds the additional parameter (which defaults to -1, which means to read the complete file). Additionally added and fixed tests in md5_file.phpt and sha1_file.phpt -- Edit this bug report at http://bugs.php.net/bug.php?id=53709&edit=1
Req #23723 [Com]: Extend strip_tags()
Edit report at http://bugs.php.net/bug.php?id=23723&edit=1 ID: 23723 Comment by: jthijssen at noxlogic dot nl Reported by:eric at evilwalrus dot com Summary:Extend strip_tags() Status: Assigned Type: Feature/Change Request Package:Strings related Operating System: * PHP Version:* Assigned To:moriyoshi Block user comment: N Private report: N New Comment: I know it's a (very) old bug, but on occasion I need a "blacklist" intead of a "whitelist" strip_tags() function. I've created a patch with an addtional bool to strip_tags() with which you can use the $allowable_tags parameter as a blacklist instead of a whitelist. Examples: strip_tags('Clickhere', ''); => Clickhere strip_tags('Clickhere', '', false); => Clickhere Previous Comments: [2003-05-20 13:47:14] eric at evilwalrus dot com Right now strip_tags() is a great function. You specify a string and the tags you want to keep. What I would like to see is another argument in strip tags so that you could tell it to keep or remove the tags you specify. I saw bug #5976 that had something to do with this very thought, but this extends the idea further. For example, if I have a string full of HTML and I want to remove all
[PHP-BUG] Req #53659 [NEW]: Implementing RegexIterator::getRegex() method
From: Operating system: All PHP version: 5.3SVN-2011-01-05 (SVN) Package: SPL related Bug Type: Feature/Change Request Bug description:Implementing RegexIterator::getRegex() method Description: I'd like to see an getRegex() method in the regexIterator class that will return the regular expression that is initialized during its __construct(). Currently there is no way of retrieving that information except for saving it yourself outside the object or extending regexiterator in order to save the regex inside a custom constructor. It would be nice if the information about the object could actually be retrieved natively since this data is already present, just not visible to the outside world. Attached is a patch with an implementation. Test script: --- $array = array('cat', 'hat', 'sat'); $iterator = new ArrayIterator($array); $regexIterator = new RegexIterator($iterator, '/.at/'); var_dump($regexIterator->getRegex()); Expected result: string(5) "/.at/" Actual result: -- PHP Fatal error: Call to undefined method ArrayIterator::getRegex() -- Edit bug report at http://bugs.php.net/bug.php?id=53659&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53659&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53659&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53659&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53659&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53659&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53659&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53659&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53659&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53659&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53659&r=support Expected behavior: http://bugs.php.net/fix.php?id=53659&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53659&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53659&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53659&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53659&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=53659&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53659&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53659&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53659&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53659&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53659&r=mysqlcfg