php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13725 --disable-assert to disable assert() completely?
Submitted: 2001-10-18 01:25 UTC Modified: 2015-02-17 09:07 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: yasuo_ohgaki at yahoo dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 - 38 = ?
Subscribe to this entry?

 
 [2001-10-18 01:25 UTC] yasuo_ohgaki at yahoo dot com
If there is assert() in script, function call for assert() is issued at execution. (If assert is not active, it returns TRUE simply)

It may be nice if there is "--disable-assert" option so that  disable assert() function calls completely for production script. Especially if there are MANY assert() in scripts. I don't see any reason to call assert() for production scripts just to return TRUE, even if it a little overhead. 
(I'll use a perl script that comments out all assert() from production scripts for the time being. There are more than 500 assert in my scripts :)

There are sevral options
1) Change zend_compile.c
2) Change zend_execute.c
3) Implement assert in Zend
4) Leave as it is. Educate users to comment out assert() for production scripts.
5) Leave as it is. Because it doesn't hart performance much.
6) Other?
It seems this can be done with little change  
ZEND_DO_FCALL to ignore assert() in zend_execute.c
or
"zend_do_begin_function_call" to ignore assert() in zend_compile.c

1) or 2) may be easier to implement, but it breaks concept of modulality. 3) is most preffered. 4) is good enough, since it's trivial text subsutitution.
What do you think?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-17 13:42 UTC] jani@php.net
-Package: Feature/Change Request +Package: *General Issues -Operating System: ANY +Operating System: * -PHP Version: 4.0.6 +PHP Version: *
 [2015-02-17 09:07 UTC] krakjoe@php.net
-Status: Open +Status: Wont fix
 [2015-02-17 09:07 UTC] krakjoe@php.net
This is a good idea, there is currently an RFC in progress to address this issue exactly, and you yourself are involved in the conversation regarding solutions to better assertion still 14 years later ... props to you.

I'm going to mark as won't fix, this kind of change requires an RFC today.

This report can still be found and will be referenced by the current RFC.

Sorry about the wait.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC