Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request 29463 assert() user message #150

Closed
wants to merge 4 commits into from
Closed

Conversation

lonnylot
Copy link

@lonnylot lonnylot commented Aug 6, 2012

Added 2nd, optional, param to assert. When passed in it will be added to the printed warnings and passed as a 4th param to a callback

@laruence
Copy link
Member

laruence commented Aug 6, 2012

please merge them into one commit. it will be easier for us to see what exactly you have committed.

@lonnylot
Copy link
Author

lonnylot commented Aug 7, 2012

I've updated the branch to be 1 commit.

Thank you!

On Mon, Aug 6, 2012 at 3:00 AM, Xinchen Hui <
reply@reply.github.com

wrote:

please merge them into one commit. it will be easier for us to see what
exactly you have committed.


Reply to this email directly or view it on GitHub:
#150 (comment)

Lonny Kapelushnik
http://lonnylot.com
(732) 807-5509

Added 2nd, optional, param to assert. When passed in it will be added
to the printed warnings and passed as a 4th param to a callback
@lonnylot
Copy link
Author

lonnylot commented Aug 7, 2012

I apologize. I had some extra files I accidentally committed earlier. I've removed them and recommitted the correct files in 1 commit.

Checks if assertion is false */
PHP_FUNCTION(assert)
{
zval **assertion;
int val;
int val, descriptionlen = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be description_len

@lstrojny
Copy link
Contributor

This is quite cool, as it enables testing framework authors to use assert() as a base for assertions.

@travisbot
Copy link

This pull request fails (merged c126da5 into 1190bc4).

@@ -28,7 +28,7 @@ var_dump($rao=assert_options("F1","f1"));

//Wrong number of parameters for assert()
$sa="0 != 0";
var_dump($r2=assert($sa,1));
var_dump($r2=assert($sa,"message",1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another spacing issue.

@lstrojny
Copy link
Contributor

Thank you, we’re getting closer. See my other remarks.

@lonnylot
Copy link
Author

Lars,

Thanks for reviewing this. The spacing issue was b/c I was using two different editors. This is now fixed. Also, you were correct that variable length arrays are not C89. I switched it to use safe_emalloc instead.

@travisbot
Copy link

This pull request fails (merged b2ea052 into 1190bc4).

@@ -196,7 +200,7 @@ static void php_assert_init_globals(zend_assert_globals *assert_globals_p TSRMLS
}

if (ASSERTG(callback)) {
zval *args[3];
zval **args = safe_emalloc( description_len == 0 ? 3 : 4, sizeof(zval **), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading space before description_len is wrong here

@travisbot
Copy link

This pull request fails (merged 92b77e8 into 1190bc4).

@lstrojny
Copy link
Contributor

Thanks. I will test the patch locally this weekend. I'll keep you updated.

@php-pulls
Copy link

Comment on behalf of lstrojny at php.net:

Thanks for your contribution. The patch has been merged into 5.4 and master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants