ID: 12368
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Feedback
Status: Open
Bug Type: Regexps related
Operating System: Linux
PHP Version: 4.0.4pl1
New Comment:
Hi and thanks for your interrest!
Here is an example to ilustrate my problem! I'm not sure if is a memory problem or a
bug.
I copyed and adapted a part of my source:
<?php
$LEN=5000; //-- is not working
//$LEN=1000; //-- is working
// creating a long string containg a sub "block"
$BlockTemplate=str_repeat("0", $LEN)."<!-- BEGIN BLOCK: abc -->".str_repeat("I",
$LEN)."<!-- END BLOCK: abc -->".str_repeat("0", $LEN);
$BLOCKS=array();
function _createChildren_(){
global $BlockTemplate,$BLOCKS;
$part="[a-z,0-9,\_]*";
$_start_tag_ = "<!--";
$_end_tag_ = "-->";
$_begin_block_ = "BEGIN[[:blank:]]*BLOCK:";
$_end_block_ = "END[[:blank:]]*BLOCK:";
// creating pattern ...
$patern_begin =
$_start_tag_."[[:blank:]]*".$_begin_block_."[[:blank:]]*(".$part.")[[:blank:]]*".$_end_tag_;
$patern_end1 = $_start_tag_."[[:blank:]]*".$_end_block_."[[:blank:]]*";
$patern_end2 = "[[:blank:]]*".$_end_tag_;
while
((eregi("(".$patern_begin.")(.*)$",$BlockTemplate,$res))&&(eregi("^((.*)".$patern_end1.$res[2].$patern_end2.")",
$res[3], $res2))){
// now $res2[2] is the content of the new block
// and $res[2] is the name ...
// colecting in $BLOCKS the block contain if was found
$BLOCKS[$res[2]] = $res2[2];
$patern = $res[1].$res2[1];
$BlockTemplate = str_replace($patern,"{ABC.".$res[2]."}",
$BlockTemplate);
}//while
}
//the following will extract all chlidren block from text ...
_createChildren_();
//if the block was found will be printed
echo "--".$BLOCKS["abc"]."--";
?>
This problem apears only on php4.0.4pl1
Thanks for your collaboration!
Stefan
Previous Comments:
------------------------------------------------------------------------
[2001-08-30 10:54:10] [EMAIL PROTECTED]
Unable to reproduce, see the following code:
<?php
$string = str_repeat("0", 10000)."abc".str_repeat("0", 10000);
echo ereg("abc", $string)?"true":"false";
?>
Returns true.
Can you post a snippet of your code?
------------------------------------------------------------------------
[2001-07-25 11:51:09] [EMAIL PROTECTED]
hi
I used the regexp functions (ereg and eregi) to split a file in blocks, the delimiters
are somthing like:
<!-- BEGIN BLOCK: main -->
<!-- END BLOCK: main -->
but the split operation failt if the file size is bigger then (aproximative value) 11k
So, this is a bug or this was already specified in some place?
Stefan
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12368&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]