]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Include common extensions in symbol mapper
authorepriestley <git@epriestley.com>
Tue, 12 Jun 2012 19:54:26 +0000 (12:54 -0700)
committerepriestley <git@epriestley.com>
Tue, 12 Jun 2012 19:54:26 +0000 (12:54 -0700)
Summary:
Spamming everyone who got bitten by this. We upgraded the libphutil library system recently, but the "use of undeclared function" lint check used to run only on files you touched and now runs on every file in every library you use. This means that if you don't have pcntl or ldap installed, you'll get errors about use of functions from them on every change.

Instead, ship with a list of functions which are provided by extensions that we'll ignore when calculating dependencies, so not having pcntl doesn't mean you have to excuse through irrelevant errrors every time.

Test Plan: Ran script with an unknown function, got it in the map; added it to the extension list, it vanished from the map.

Reviewers: vrana, btrahan, allenjohnashton, ddfisher, keebuhm, phleet, nodren

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1347

Differential Revision: https://secure.phabricator.com/D2728

scripts/php_extension_functions.txt [new file with mode: 0644]
scripts/phutil_symbols.php

diff --git a/scripts/php_extension_functions.txt b/scripts/php_extension_functions.txt
new file mode 100644 (file)
index 0000000..a503cbd
--- /dev/null
@@ -0,0 +1,264 @@
+apc_add
+apc_bin_dump
+apc_bin_dumpfile
+apc_bin_load
+apc_bin_loadfile
+apc_cache_info
+apc_cas
+apc_clear_cache
+apc_compile_file
+apc_dec
+apc_define_constants
+apc_delete
+apc_delete_file
+apc_exists
+apc_fetch
+apc_inc
+apc_load_constants
+apc_sma_info
+apc_store
+bcadd
+bccomp
+bcdiv
+bcmod
+bcmul
+bcpow
+bcpowmod
+bcscale
+bcsqrt
+bcsub
+curl_close
+curl_copy_handle
+curl_errno
+curl_error
+curl_escape
+curl_exec
+curl_getinfo
+curl_init
+curl_multi_add_handle
+curl_multi_close
+curl_multi_exec
+curl_multi_getcontent
+curl_multi_info_read
+curl_multi_init
+curl_multi_remove_handle
+curl_multi_select
+curl_reset
+curl_setopt
+curl_setopt_array
+curl_share_close
+curl_share_init
+curl_share_setopt
+curl_unescape
+curl_version
+image2wbmp
+image_type_to_extension
+image_type_to_mime_type
+imagealphablending
+imageantialias
+imagearc
+imagechar
+imagecharup
+imagecolorallocate
+imagecolorallocatealpha
+imagecolorat
+imagecolorclosest
+imagecolorclosestalpha
+imagecolorclosesthwb
+imagecolordeallocate
+imagecolorexact
+imagecolorexactalpha
+imagecolormatch
+imagecolorresolve
+imagecolorresolvealpha
+imagecolorset
+imagecolorsforindex
+imagecolorstotal
+imagecolortransparent
+imageconvolution
+imagecopy
+imagecopymerge
+imagecopymergegray
+imagecopyresampled
+imagecopyresized
+imagecreate
+imagecreatefromgd
+imagecreatefromgd2
+imagecreatefromgd2part
+imagecreatefromgif
+imagecreatefromjpeg
+imagecreatefrompng
+imagecreatefromstring
+imagecreatefromwbmp
+imagecreatefromxbm
+imagecreatetruecolor
+imagedashedline
+imagedestroy
+imageellipse
+imagefill
+imagefilledarc
+imagefilledellipse
+imagefilledpolygon
+imagefilledrectangle
+imagefilltoborder
+imagefilter
+imagefontheight
+imagefontwidth
+imagegammacorrect
+imagegd
+imagegd2
+imagegif
+imageinterlace
+imageistruecolor
+imagejpeg
+imagelayereffect
+imageline
+imageloadfont
+imagepalettecopy
+imagepng
+imagepolygon
+imagerectangle
+imagerotate
+imagesavealpha
+imagesetbrush
+imagesetpixel
+imagesetstyle
+imagesetthickness
+imagesettile
+imagestring
+imagestringup
+imagesx
+imagesy
+imagetruecolortopalette
+imagetypes
+imagewbmp
+imagexbm
+ldap_connect
+ldap_close
+ldap_bind
+ldap_sasl_bind
+ldap_unbind
+ldap_read
+ldap_list
+ldap_search
+ldap_free_result
+ldap_count_entries
+ldap_first_entry
+ldap_next_entry
+ldap_get_entries
+ldap_first_attribute
+ldap_next_attribute
+ldap_get_attributes
+ldap_get_values
+ldap_get_values_len
+ldap_get_dn
+ldap_explode_dn
+ldap_dn2ufn
+ldap_add
+ldap_delete
+ldap_modify
+ldap_mod_add
+ldap_mod_replace
+ldap_mod_del
+ldap_errno
+ldap_err2str
+ldap_error
+ldap_compare
+ldap_sort
+ldap_rename
+ldap_get_option
+ldap_set_option
+ldap_first_reference
+ldap_next_reference
+ldap_parse_reference
+ldap_parse_result
+ldap_start_tls
+ldap_set_rebind_proc
+ldap_control_paged_result
+ldap_control_paged_result_response
+pcntl_fork
+pcntl_waitpid
+pcntl_wait
+pcntl_signal
+pcntl_signal_dispatch
+pcntl_wifexited
+pcntl_wifstopped
+pcntl_wifsignaled
+pcntl_wexitstatus
+pcntl_wtermsig
+pcntl_wstopsig
+pcntl_exec
+pcntl_alarm
+pcntl_get_last_error
+pcntl_errno
+pcntl_strerror
+pcntl_getpriority
+pcntl_setpriority
+pcntl_sigprocmask
+posix_kill
+posix_getpid
+posix_getppid
+posix_getuid
+posix_setuid
+posix_geteuid
+posix_seteuid
+posix_getgid
+posix_setgid
+posix_getegid
+posix_setegid
+posix_getgroups
+posix_getlogin
+posix_getpgrp
+posix_setsid
+posix_setpgid
+posix_getpgid
+posix_getsid
+posix_uname
+posix_times
+posix_ctermid
+posix_ttyname
+posix_isatty
+posix_getcwd
+posix_mkfifo
+posix_mknod
+posix_access
+posix_getgrnam
+posix_getgrgid
+posix_getpwnam
+posix_getpwuid
+posix_getrlimit
+posix_get_last_error
+posix_errno
+posix_strerror
+posix_initgroups
+socket_accept
+socket_bind
+socket_clear_error
+socket_close
+socket_connect
+socket_create
+socket_create_listen
+socket_create_pair
+socket_get_option
+socket_get_status
+socket_getopt
+socket_getpeername
+socket_getsockname
+socket_import_stream
+socket_last_error
+socket_listen
+socket_read
+socket_recv
+socket_recvfrom
+socket_select
+socket_send
+socket_sendto
+socket_set_block
+socket_set_blocking
+socket_set_nonblock
+socket_set_option
+socket_set_timeout
+socket_setopt
+socket_shutdown
+socket_strerror
+socket_write
index 282535969f88b0c54274219badc154291dc3d0d2..740ce680d92b3e42768d9391f1b2f05517714a98 100755 (executable)
@@ -415,6 +415,16 @@ function phutil_symbols_get_builtins() {
   $builtin_functions  = get_defined_functions();
   $builtin_functions  = $builtin_functions['internal'];
 
+  // Developers may not have every extension that a library potentially uses
+  // installed. We supplement the list of declared functions with a list of
+  // known extension functions to avoid raising false positives just because
+  // you don't have pcntl, etc.
+  $list = dirname(__FILE__).'/php_extension_functions.txt';
+  $extension_functions = file_get_contents($list);
+  $extension_functions = explode("\n", trim($extension_functions));
+
+  $builtin_functions = array_merge($builtin_functions, $extension_functions);
+
   return array(
     'class'     => array_fill_keys($builtin_classes, true) + array(
       'PhutilBootloader' => true,