-
Notifications
You must be signed in to change notification settings - Fork 94
a lot of bugfixes #19
base: master
Are you sure you want to change the base?
Changes from 1 commit
92261c4
8ae34ad
a4ed4a0
00682c0
f8d4b8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,7 +216,7 @@ public static void ArgumentNull(string argument) | |
/// <param name="argument">The name of the argument.</param> | ||
public static void ReferenceNull(string argument) | ||
{ | ||
Throw(PhpError.Error, CoreResources.GetString("reference_null", argument)); | ||
Throw(PhpError.Warning, CoreResources.GetString("reference_null", argument)); | ||
} | ||
|
||
/// <summary> | ||
|
@@ -607,7 +607,7 @@ public static void Throw(PhpError error, string message) | |
|
||
// determines whether the error will be reported and whether it is handleable: | ||
bool is_error_reported = ((PhpErrorSet)error & config.ErrorControl.ReportErrors) != 0 && !context.ErrorReportingDisabled; | ||
bool is_error_handleable = ((PhpErrorSet)error & PhpErrorSet.Handleable & (PhpErrorSet)config.ErrorControl.UserHandlerErrors) != 0; | ||
bool is_error_handleable = ((PhpErrorSet)error & PhpErrorSet.Handleable & (PhpErrorSet)config.ErrorControl.UserHandlerErrors) != 0 && !context.ErrorReportingDisabled; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOT CORRECT, revert this line please. Example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked on php and user handler not called. what version of php are you using? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. php 5.5.3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i checked behavior on sample from http://www.php.net/manual/en/function.set-error-handler.php and not noticed that user handler checks error reporting status :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
bool is_error_fatal = ((PhpErrorSet)error & PhpErrorSet.Fatal) != 0; | ||
bool do_report = true; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,24 +203,7 @@ private void DumpTo(System.IO.TextWriter/*!*/output) | |
{ | ||
Debug.Assert(output != null); | ||
|
||
const string hex_digs = "0123456789abcdef"; | ||
char[] patch = new char[4] { '\\', 'x', '0', '0' }; | ||
|
||
foreach (byte b in ReadonlyData) | ||
{ | ||
// printable characters are outputted normally | ||
if (b < 0x7f) | ||
{ | ||
output.Write((char)b); | ||
} | ||
else | ||
{ | ||
patch[2] = hex_digs[(b & 0xf0) >> 4]; | ||
patch[3] = hex_digs[(b & 0x0f)]; | ||
|
||
output.Write(patch); | ||
} | ||
} | ||
output.Write(ToString()); | ||
} | ||
|
||
private string DebugView() | ||
|
@@ -421,9 +404,7 @@ string IPhpConvertible.ToString(bool throwOnError, out bool success) | |
/// <param name="output">The output text stream.</param> | ||
public void Print(System.IO.TextWriter output) | ||
{ | ||
output.Write("\""); | ||
DumpTo(output); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. print != dump Print should output this.ToString() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
output.WriteLine("\""); | ||
} | ||
|
||
/// <summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -583,7 +583,12 @@ string IPhpConvertible.ToString() | |
} | ||
} | ||
|
||
/// <summary> | ||
public PhpCallback DeepCopy() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PhpCallback can be MemberwiseCopied, but do not copy this on another thread; on another thread callback has to be re-bound There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method called only on unbounded Callbacks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add Debug.Assert at least please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
{ | ||
return (PhpCallback)MemberwiseClone(); | ||
} | ||
|
||
/// <summary> | ||
/// Converts instance to its string representation according to PHP conversion algorithm. | ||
/// </summary> | ||
/// <param name="success">Indicates whether conversion was successful.</param> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,21 +337,26 @@ public static ScriptContext CurrentContext | |
// ScriptContext is ILogicalThreadAffinative, LogicalCallContext is used. | ||
try | ||
{ | ||
return ((ScriptContext)CallContext.GetData(callContextSlotName)) ?? CreateDefaultScriptContext(); // on Mono, .GetData must be used (GetLogicalData is not implemented) | ||
var weak = (WeakReference<ScriptContext>)CallContext.GetData(callContextSlotName);// on Mono, .GetData must be used (GetLogicalData is not implemented) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. REVERT There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if revert this line then ScriptContext can be leaked after calling async code directly or indirectly (for instance: HttpWebRequest.ServicePoint) and survived context can keep in memory up to several MB. At least cleanup on dispose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ScriptContext.CurrentContext is nullified at RequestEnd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ScriptContext.CurrentContext on current thread is nullifed, but after calling, for example, HttpWebRequest.ServicePoint, reference to this ScriptContext will be in other thread CallContext. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you must never use an instance of ScriptContext on another thread, without wrapping it into Once you get an instance of ScriptContext on a thread, you are responsible for cleaning it up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thats because ScriptContext is not thread safe, and it should not live outside of a RequestContext There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its not used in another thread its just copied to another thread by .net (with all other call context data) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't see why. Anyway CallContext won't be used within the next update at all. There would be just [ThreadStatic] field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ScriptContext result = null; | ||
if (weak!=null) | ||
{ | ||
weak.TryGetTarget(out result); | ||
} | ||
return result ?? CreateDefaultScriptContext(); | ||
} | ||
catch (InvalidCastException) | ||
{ | ||
throw new InvalidCallContextDataException(callContextSlotName); | ||
} | ||
|
||
//return result.AttachToHttpApplication(); | ||
} | ||
set | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. REVERT There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
{ | ||
if (value == null) | ||
CallContext.FreeNamedDataSlot(callContextSlotName); | ||
else | ||
CallContext.SetData(callContextSlotName, value); // on Mono, .SetData must be used (SetLogicalData is not implemented) | ||
CallContext.SetData(callContextSlotName, new WeakReference<ScriptContext>(value)); // on Mono, .SetData must be used (SetLogicalData is not implemented) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this causes cloning of the array :-( maybe clone it for the first time into some private static property, and use that so we avoid cloning every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done