Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 83db7ac

Browse files
author
Andrew Zenin
committed
Fixed critical bug
1 parent 0514dbb commit 83db7ac

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

‎Source/PHPFunctions.pas‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -663,31 +663,23 @@ function TZendVariable.GetAsVariant: variant;
663663
function TZendVariable.GetDataType: integer;
664664
begin
665665
if not Assigned(FValue) then
666-
begin
667-
Result := IS_NULL;
668-
Exit;
669-
end;
666+
Exit(IS_NULL);
670667

671668
Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF};
672669
end;
673670

674671
function TZendVariable.GetIsNull: boolean;
675672
begin
676673
if not Assigned(FValue) then
677-
begin
678-
Result := true;
679-
Exit;
680-
end;
674+
Exit(True);
675+
681676
Result := {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} = IS_NULL;
682677
end;
683678

684679
function TZendVariable.GetTypeName: string;
685680
begin
686681
if not Assigned(FValue) then
687-
begin
688-
Result := 'null';
689-
Exit;
690-
end;
682+
Exit('null');
691683

692684
case {$IFDEF PHP7}FValue^.u1.v._type{$ELSE} FValue^._type{$ENDIF} of
693685
IS_NULL: result := 'null';

‎Source/ZENDAPI.pas‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ procedure VariantToZend(const Value:Variant;z:pzval;
16351635
W : WideString;
16361636
S: String;
16371637
begin
1638-
if VarIsEmpty(value) then
1638+
if VarIsEmpty(value) or VarIsNull(Value) then
16391639
begin
16401640
ZVALVAL(z);
16411641
Exit;

‎Source/php4delphi.pas‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,16 @@ function TPHPEngine.GetConstantCount: integer;
15031503
begin
15041504
Result := FConstants.Count;
15051505
end;
1506-
1506+
{
1507+
procedure log(i:String);
1508+
var f:TextFile;
1509+
begin
1510+
AssignFile(f, 'log.txt');
1511+
Append(f);
1512+
Write(f, #10 + #13 + i);
1513+
CloseFile(f);
1514+
end;
1515+
}
15071516
procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
15081517
return_value_ptr: ppzval; this_ptr: pzval; return_value_used: integer;
15091518
TSRMLS_DC: pointer);
@@ -1519,7 +1528,6 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
15191528
ReturnValue : variant;
15201529
begin
15211530
FParameters := TFunctionParams.Create(nil, TFunctionParam);
1522-
try
15231531

15241532
if ht > 0 then
15251533
begin
@@ -1564,23 +1572,22 @@ procedure TPHPEngine.HandleRequest(ht: integer; return_value: pzval;
15641572
FParameters[j].ZendValue := (Params[j]^);
15651573
end;
15661574
end; { if ht > 0}
1567-
1575+
//log(FActiveFunctionName);
15681576
FZendVar := TZendVariable.Create;
1569-
try
15701577
FZendVar.AsZendVariable := return_value;
15711578
AFunction.OnExecute(Self, FParameters, ReturnValue, FZendVar, TSRMLS_DC);
1572-
if FZendVar.ISNull then {perform variant conversion}
1573-
VariantToZend(ReturnValue, return_value);
1574-
finally
1575-
FZendVar.Free;
1576-
end;
1579+
if Assigned(FZendVar) then
1580+
begin
1581+
if FZendVar.ISNull then {perform variant conversion}
1582+
VariantToZend(ReturnValue, return_value);
1583+
FZendVar.Free;
1584+
end
1585+
else
1586+
VariantToZend(ReturnValue, return_value);
15771587
end; {if assigned AFunction.OnExecute}
15781588
end;
1579-
1580-
finally
15811589
FParameters.Free;
15821590
dispose_pzval_array(Params);
1583-
end;
15841591
end;
15851592

15861593
procedure TPHPEngine.PrepareIniEntry;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /