Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-11

WebLaz bug

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

I don't know if this bug is related to Lazarus, WebLaz or FPC. Please tell me and I'll post it on Mantis:

To reproduce it, please follow this steps:

1) Create a CGI application. You'll need WebLaz package.
2) Add an FPWebModule.
3) Add two or three actions. Compile and check if they work as expected.
4) Delete the method "onRequest..." of one action from code, DO NOT REMOVE THE ACTION USING THE ACTIONS EDITOR, just delete the method similar to this (from interface and implementation):

    procedure myActionRequest(Sender: TObject; ARequest: TRequest;
      AResponse: TResponse; var Handled: Boolean);

5) Compile and test. When you invoke any action of this webmodule, you'll get this:

Error reading XXXXXXX.Actions: Error reading TFPWebAction.OnRequest: Invalid value for property

Reply by email

Erwin van den Bosch
to Leonardo M. Ramé
procedure TForm1.Button1Click(Sender: TObject);
var
   iLastError: integer;
begin
   iLastError:=10053;
   if iLastError in [10053, 10054] then Label1.Caption:='Yes, it works!'
                                   else Label1.Caption:='No, it doesn''t
work!';
   // Output : No, it doesn''t work!
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
   iLastError:=53;
   if iLastError in [53, 54] then Label1.Caption:='Yes, it works!'
                             else Label1.Caption:='No, it doesn''t work!';
   // Output : Yes, it works!
end;

Is there A compiler directive for testing on big nummers?

(fpc:2.6.1 Lazarus: 1.0.3 i386 on Windows 7 x64)

Erwin

Reply by email

Maxim Ganetsky
to Erwin van den Bosch

29.11.2012 2:15, Erwin van den Bosch ?????:

Show quoted text 10 lines
procedure TForm1.Button1Click(Sender: TObject); var iLastError: integer; begin iLastError:=10053; if iLastError in [10053, 10054] then Label1.Caption:='Yes, it works!' else Label1.Caption:='No, it doesn''t work!'; // Output : No, it doesn''t work! end;

This should generate range check errors, because AFAIK sets are limited to byte values.

Show quoted text 9 lines
procedure TForm1.Button2Click(Sender: TObject); begin iLastError:=53; if iLastError in [53, 54] then Label1.Caption:='Yes, it works!' else Label1.Caption:='No, it doesn''t work!'; // Output : Yes, it works! end; Is there A compiler directive for testing on big nummers?

No.

(fpc:2.6.1 Lazarus: 1.0.3 i386 on Windows 7 x64)
Best regards, Maxim Ganetsky mailto:

Reply by email

leledumbo
to Leonardo M. Ramé: I don't know if this bug is related to Lazarus, WebLaz or FPC. Please tell me and I'll…
I don't know if this bug is related to Lazarus, WebLaz or FPC. Please

tell me and I'll post it on Mantis:

To reproduce it, please follow this steps:

1) Create a CGI application. You'll need WebLaz package.
2) Add an FPWebModule.
3) Add two or three actions. Compile and check if they work as expected.
4) Delete the method "onRequest..." of one action from code, DO NOT REMOVE THE ACTION USING THE ACTIONS EDITOR, just delete the method similar to this (from interface and implementation):

    procedure myActionRequest(Sender: TObject; ARequest: TRequest;
      AResponse: TResponse; var Handled: Boolean);

5) Compile and test. When you invoke any action of this webmodule, you'll get this:

Error reading XXXXXXX.Actions: Error reading TFPWebAction.OnRequest: Invalid value for property

That's normal, as if you delete a generated event handler from any application (e.g. OnClick of a TButton). The resource file is not automatically updated with your changes in the code. Simply don't do such a thing, and use the actions editor, that's why it exists.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-WebLaz-bug-tp4027787p4027790.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Howard Page-Clark
to Erwin van den Bosch: procedure TForm1.Button1Click(Sender: TObject); var iLastError: integer; begin…
Erwin van den Bosch wrote 10 lines
procedure TForm1.Button1Click(Sender: TObject); var iLastError: integer; begin iLastError:=10053; if iLastError in [10053, 10054] then Label1.Caption:='Yes, it works!' else Label1.Caption:='No, it doesn''t work!'; // Output : No, it doesn''t work! end;

You may be thinking of how "in" is used in a for..in..do loop like this

procedure TForm1.Button1Click(Sender: TObject);
var
    iLastError, j: integer;
    intArray: array[0..1] of integer = (10053,10054);
begin
    iLastError:=10053;
    for j in intArray do
     if j=iLastError
      then begin
            Label1.Caption:='iLastError present';
            Break;
           end
     else label1.Caption:= 'iLastError not found';
end;

Reply by email

Erwin van den Bosch
to Maxim Ganetsky: 29.11.2012 2:15, Erwin van den Bosch ?????: This should generate range check errors,…
Maxim Ganetsky wrote 14 lines
29.11.2012 2:15, Erwin van den Bosch ?????: > procedure TForm1.Button1Click(Sender: TObject); > var > iLastError: integer; > begin > iLastError:=10053; > if iLastError in [10053, 10054] then Label1.Caption:='Yes, it works!' > else Label1.Caption:='No, it doesn''t > work!'; > // Output : No, it doesn''t work! > end; This should generate range check errors, because AFAIK sets are limited to byte values.

I should have turned range checking on! Then I saved a few hours debugging :-(

Thanks for your answer.

Reply by email

Leonardo M. Ramé
to leledumbo: tell me and I'll post it on Mantis: To reproduce it, please follow this steps: 1) Create…
leledumbo wrote 29 lines
> I don't know if this bug is related to Lazarus, WebLaz or FPC. Please tell me and I'll post it on Mantis: To reproduce it, please follow this steps: 1) Create a CGI application. You'll need WebLaz package. 2) Add an FPWebModule. 3) Add two or three actions. Compile and check if they work as expected. 4) Delete the method "onRequest..." of one action from code, DO NOT REMOVE THE ACTION USING THE ACTIONS EDITOR, just delete the method similar to this (from interface and implementation): procedure myActionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); 5) Compile and test. When you invoke any action of this webmodule, you'll get this: Error reading XXXXXXX.Actions: Error reading TFPWebAction.OnRequest: Invalid value for property That's normal, as if you delete a generated event handler from any application (e.g. OnClick of a TButton). The resource file is not automatically updated with your changes in the code. Simply don't do such a thing, and use the actions editor, that's why it exists.

Well, I wouldn't try to synchronize code with lfm, but I'd add more info to the error message, for example "...Invalid value for property AAAAA", just add the property with problems.

Reply by email

Leonardo M. Ramé
to leledumbo
leledumbo wrote 10 lines
> for example "...Invalid value for property AAAAA" AAAAA in > Error reading TFPWebAction.OnRequest: Invalid is TFPWebAction.OnRequest

Ok, OnRequest is the property. Then, it could help if the message is changed to:

Invalid value (name_of_removed_method) for property TFPWebAction.OnRequest.

Reply by email