-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
182 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
#include "PhpErrorData.h" | ||
|
||
#include <main/php.h> | ||
#include <Zend/zend_alloc.h> | ||
#include <Zend/zend_builtin_functions.h> | ||
#include <Zend/zend_types.h> | ||
#include <Zend/zend_variables.h> | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
namespace elasticapm::php { | ||
PhpErrorData::PhpErrorData(int type, std::string_view fileName, uint32_t lineNumber, std::string_view message) : type_(type), fileName_(fileName), lineNumber_(lineNumber), message_(message) { | ||
ZVAL_UNDEF(&stackTrace_); | ||
zend_fetch_debug_backtrace(&stackTrace_, /* skip_last */ 0, /* options */ 0, /* limit */ 0); | ||
} | ||
|
||
PhpErrorData::~PhpErrorData() { | ||
zval_ptr_dtor(&stackTrace_); | ||
} | ||
|
||
int PhpErrorData::getType() const { | ||
return type_; | ||
} | ||
|
||
std::string_view PhpErrorData::getFileName() const { | ||
return fileName_; | ||
} | ||
|
||
int PhpErrorData::getLineNumber() const { | ||
return lineNumber_; | ||
} | ||
|
||
std::string_view PhpErrorData::getMessage() const { | ||
return message_; | ||
} | ||
|
||
zval *PhpErrorData::getStackTrace() { | ||
return &stackTrace_; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include <Zend/zend_types.h> | ||
#include <string> | ||
#include <string_view> | ||
|
||
namespace elasticapm::php { | ||
|
||
class PhpErrorData { | ||
public: | ||
PhpErrorData(int type, std::string_view fileName, uint32_t lineNumber, std::string_view message); | ||
~PhpErrorData(); | ||
|
||
int getType() const; | ||
std::string_view getFileName() const; | ||
int getLineNumber() const; | ||
std::string_view getMessage() const; | ||
zval *getStackTrace(); | ||
|
||
private: | ||
int type_ = -1; | ||
std::string fileName_; | ||
uint32_t lineNumber_ = 0; | ||
std::string message_; | ||
zval stackTrace_; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.