[Chameleon] Re: Problem with MapNotes

Jimmy Lam j.lam at i-real.nl
Thu Jul 6 07:53:15 EDT 2006


Hi,

Sorry it took so long, I almost forgot about this. It's been a while 
since I made the change. I've not encountered problems since. If you 
look at it semantically, it's correct and there shouldn't be any problems.

Regards,

Jimmy Lam

Julien-Samuel Lacroix schreef:
> Hi,
> Thanks for the patch. Let us know when you finish to test it and if 
> there's any more changes. We'll then add it to CVS.
>
> Thanks
> Julien
>
> Jimmy Lam wrote:
>> Well, I think I found something that should fix it.
>> Code lines #297-324 in properties.php from MapNotes:
>>
>> for ( $i=1; $i<=$nCount; $i++ ){
>>    $aRec = dbase_get_record_with_names( $dbfFile, $i );
>>     if ( $aRec['id'] == $nId ){
>>    dbase_delete_record( $dbfFile, $i );
>>    dbase_pack( $dbfFile );
>> -- 
>> -
>> }
>>
>> With this code, after an Id has been found, its row is deleted from 
>> the dbf immediately. So if it's not the last row in the dbf, the for 
>> loop will continue because $nCount is not updated. When $i gets to 
>> $nCount -1, it will give the bad record warning because there is now 
>> 1 less record to read. If you delete the record after going through 
>> all the records, this problem should not occur anymore.
>> So if you change the above code to:
>>
>> for ( $i=1; $i<=$nCount; $i++ ){
>>    $aRec = dbase_get_record_with_names( $dbfFile, $i );
>>     if ( $aRec['id'] == $nId ){
>>    dbase_delete_record( $dbfFile, $i );
>> -- 
>> -
>> }
>> dbase_pack( $dbfFile );
>>
>> that should fix the problem. I'll need to test it a bit more but I'm 
>> pretty positive this will fix it.
>>
>> Regards,
>>
>> Jimmy Lam
>>
>>> Hi list,
>>>
>>> I was wondering if truly noone has encountered or could reproduce 
>>> this error. Well it says warning, technically. I've now tried it on 
>>> some public sites that have Chameleon samples online and those also 
>>> have the same error. At first I didn't see them on my server but 
>>> after checking the error log, they were definitely there. In 
>>> php.ini, set show_errors to On if you want to see errors on the page 
>>> instead of in the log. Unfortunately, I still haven't figured it out 
>>> yet..
>>>
>>> Regards,
>>>
>>> Jimmy Lam
>>>
>>>> Hi list,
>>>>
>>>> While trying to build a widget based on MapNotes that adds points 
>>>> to an Oracle db, I encountered a problem with retrieving rows from 
>>>> a dbf file. The line of code in question is at #300 of 
>>>> properties.php of MapNotes: $aRec = dbase_get_record_with_names( 
>>>> $dbfFile, $i );. I get an error message under certain circumstances 
>>>> about trying to read a bad record. I can reproduce this error by 
>>>> following this scenario:
>>>> Add 2 points on a map using MapNotes (sample_enhanced works)
>>>> Edit the first point. On submitting, the error will occur.
>>>> My setup is MS4W 1.5.x with Chameleon 2.4 final. I tried using a 
>>>> vanilla MS4W 2.0 and Chameleon 2.4 but that has the same result. I 
>>>> had to edit properties.php to load php_dbase earlier in the file or 
>>>> I'd get an error about dbase_open being undefined after the 2nd 
>>>> point but this can't be the reason I think. One thing I noticed 
>>>> while looking in the dbf files is that sometimes 2 IDs are 
>>>> identical. Not sure if this has anything to do with it but I'll 
>>>> need to look into it a bit more. Could anyone else confirm they get 
>>>> the same error?
>>
>>
>>
>> _______________________________________________
>> Chameleon mailing list
>> Chameleon at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/chameleon
>



More information about the Chameleon mailing list