Skip to content

Instantly share code, notes, and snippets.

View Girgias's full-sized avatar
🐘

Gina Peter Banyard Girgias

🐘
View GitHub Profile
@Girgias
Girgias / entity-counter.php
Last active March 19, 2019 19:09
PHPDoc-Entity-Counter version 0.1.1
<?php
/*
* TODO
* CLI options:
* - Language (default EN, Active Lang, All)
* - Output format
*
* Optional HTML output
*
@Girgias
Girgias / pandoc-docbook-implementations.txt
Last active November 7, 2019 00:53
Needed docbook tags support in Pandoc for PHP documentation.
{-
List of all DocBook tags, with [x] indicating implemented,
[o] meaning intentionally left unimplemented (pass through):
[N] are needed for the PHP documentation.
[?] are maybe needed for the PHP documentation.
Currently: 20 tags need support
8 tags maybe need support
@Girgias
Girgias / grep-custom-php-src-formats.txt
Last active January 15, 2020 15:25
Custom snprintf formats used in php-src
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(h|H|k|v|t|j|z|Z|l|L|I).*\)"
ext/bcmath/libbcmath/src/output.c:73:2220: snprintf(digits, sizeof(digits), "%ld", val);
ext/date/php_date.c:51:1925: int st = snprintf(s, len, "%lld", i); \
ext/date/php_date.c:840:35029: case 'Y': length = slprintf(buffer, sizeof(buffer), "%s%04lld", t->y < 0 ? "-" : "", php_date_llabs((timelib_sll) t->y)); break;
ext/date/php_date.c:915:38829: case 'U': length = slprintf(buffer, sizeof(buffer), "%lld", (timelib_sll) t->sse); break;
ext/date/tests/bug63435.phpt:8:146: $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
ext/ftp/ftp.c:1729:32954: eprtarg_len = snprintf(eprtarg, sizeof(eprtarg), "|2|%s|%hu|", out, ntohs(((struct sockaddr_in6 *) &addr)->sin6_port));
ext/imap/php_imap.c:1329:41542: snprintf(tmp + 6, sizeof(tmp) - 6, "%4ld) ", cache->msgno);
ext/imap/php_imap.c:1344:
@Girgias
Girgias / locale_aware_sprintf_calls.txt
Created January 15, 2020 15:58
Locale aware sprintf family calls in php-src (Format f, F, e, E, g, G, k, H)
Command: grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(f|F|e|E|g|G|k|H).*\)"
ext/fileinfo/libmagic/softmagic.c:751:19760: (void)snprintf(buf, sizeof(buf), "%g", vf);
ext/fileinfo/libmagic/softmagic.c:771:20167: (void)snprintf(buf, sizeof(buf), "%g", vd);
ext/mysqlnd/mysql_float_to_double.h:43:1713: sprintf(num_buf, "%.*f", decimals, fp4);
ext/opcache/jit/dynasm/minilua.c:145:3126:#define lua_number2str(s,n)sprintf((s),"%.14g",(n))
ext/pdo_firebird/firebird_statement.c:376:10371: *len = slprintf(*ptr, CHAR_BUF_LEN, "%.*F", -var->sqlscale, *(double*)var->sqldata);
ext/pdo_firebird/firebird_statement.c:384:10741: *len = slprintf(*ptr, CHAR_BUF_LEN, "-0.%0*" LL_MASK "d", -var->sqlscale, -n % f);
ext/pdo_firebird/firebird_statement.c:421:11909: *len = slprintf(*ptr, CHAR_BUF_LEN, "%F", *(float*)var->sqldata);
ext/pdo_firebird/firebird_statement.c:425:12083: *len = slprintf(*ptr, CHAR_BUF_LEN, "%F" , *(double*)var->sqldata);
@Girgias
Girgias / output.txt
Created January 23, 2020 11:56
spprintf custom format grep
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?s(tr)?pprintf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(h|H|k|v|t|j|z|Z|l|L|I).*\)"
ext/ffi/ffi.c:798:21768: return strpprintf(0, "@%s@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
ext/ffi/ffi.c:802:21898: return strpprintf(0, "_%s@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
ext/ffi/ffi.c:806:22050: return strpprintf(0, "%s@@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
ext/pdo_odbc/odbc_driver.c:42:1567: message = strpprintf(0, "%s (%s[%ld] at %s:%d)",
ext/phar/phar.c:2467:69708: spprintf(error, 0, "Illegal filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", index_len);
ext/phar/phar.c:2475:69976: spprintf(error, 0, "Illegal web filename passed in for stub creation, was %zd characters long, and only 400 or less is allowed", web_len);
ext/spl/php_spl.c:849:27082: return strpprintf(32,
@Girgias
Girgias / output.txt
Last active January 23, 2020 12:23
Usage of "p" length modifier/format in php-src
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?(a)?s(n|l)?printf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(p).*\)"
ext/mysqlnd/mysqlnd_vio.c:171:5443: hashed_details_len = mnd_sprintf(&hashed_details, 0, "%p", vio);
ext/opcache/jit/dynasm/minilua.c:698:21469:sprintf(buff,"%p",va_arg(argp,void*));
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$ grep -rPbnH "(v)?s(tr)?pprintf\(.*%(\+|-| |#|0)?(\d+|\*)?(\.(\d+|\*))?(p).*\)"
sapi/phpdbg/phpdbg_list.c:351:11136: fake_name = strpprintf(0, "%s%c%p", filename, 0, op_array->opcodes);
sapi/phpdbg/phpdbg_prompt.c:543:16298: zend_string *source_path = strpprintf(0, "Standard input code%c%p", 0, PHPDBG_G(ops)->opcodes);
george@DESKTOP-GEORGE-P:/mnt/c/Dev/php-src$
@Girgias
Girgias / compiler-output
Created February 3, 2020 11:40
php-src compiled with -Wall -Wpedantic -Wextra at commit ref 4cbffd89d9e82d81a26746aadca27ad061cab43a
This file has been truncated, but you can view the full file.
/bin/bash /mnt/c/Dev/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/mnt/c/Dev/php-src/ext/date/ -DPHP_ATOM_INC -I/mnt/c/Dev/php-src/include -I/mnt/c/Dev/php-src/main -I/mnt/c/Dev/php-src -I/usr/include/valgrind -I/mnt/c/Dev/php-src/ext/date/lib -I/mnt/c/Dev/php-src/TSRM -I/mnt/c/Dev/php-src/Zend -Wall -Wpedantic -Wextra -fvisibility=hidden -O0 -Wall -Wno-strict-aliasing -g -DZEND_SIGNALS -c /mnt/c/Dev/php-src/ext/date/php_date.c -o ext/date/php_date.lo
In file included from /mnt/c/Dev/php-src/Zend/zend_API.h:25:0,
from /mnt/c/Dev/php-src/main/php.h:35,
from /mnt/c/Dev/php-src/ext/date/php_date.c:17:
/mnt/c/Dev/php-src/ext/date/php_date.c: In function ‘zm_activate_date’:
/mnt/c/Dev/php-src/Zend/zend_modules.h:27:29: warning: unused parameter ‘type’ [-Wunused-parameter]
#define INIT_FUNC_ARGS int type, int module_number
^
/mnt/c/Dev/ph
@Girgias
Girgias / appveyor-compiler-error.txt
Created February 27, 2020 12:54
Appveyor compiler errors.
---------------------------------------
Type 'nmake snap' to build a PHP snapshot
Recreating build dirs
Recreating build dirs
bison.exe --output=Zend/zend_ini_parser.c -v -d Zend/zend_ini_parser.y
bison.exe --output=Zend/zend_language_parser.c -v -d Zend/zend_language_parser.y
"re2c.exe" --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
"re2c.exe" --no-generation-date --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
bison.exe --output=sapi/phpdbg/phpdbg_parser.c -v -d sapi/phpdbg/phpdbg_parser.y
"re2c.exe" --no-generation-date -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l
@Girgias
Girgias / commands.md
Last active November 3, 2020 08:32
Commands to update French docs canonical type and sync with EN revision

Changes to be made:

  • <type>integer</type> into <type>int</type>
  • <type>boolean</type> into <type>bool</type>
  • <type>entier</type> into &integer;

Example for <type>integer</type>:

Find and update the SVN Revision first:

@Girgias
Girgias / disgusting.php
Created November 17, 2020 19:07
Weirdly found a way to use variable variables...
<?php
/***
* This only generates a draft from which to work on as Academic and Wellbeing reps are not available
* from the union eActivity API
***/
const EACTIVITY_API_KEY = 'API KEY';
/** CSP id number */
const RCSU_EACTIVITY_ID = 'RCSUID';